LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert *.dat to image

Solved!
Go to solution

Hello,

 

i have converted image into *.dat file in matlab , but now i want to convert  *.dat file into image format in labview ,

how can i do it.

 

thanks and regards

0 Kudos
Message 1 of 13
(2,954 Views)

Why not store the image as jpeg instead of the dat file?

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 13
(2,937 Views)

What version of LabVIEW are you using?

Does it support MATLAB script?

 

George Zou
0 Kudos
Message 3 of 13
(2,923 Views)

A *.dat file can be anything. Unlike e.g. *.png it is not reserved for any specific data structure.

 

So have a look at your Matlab code to see how the data is saved, then reverse engineer it in LabVIEW. If it is binary, you need to know the # of rows and # of columns, the datatype (# of bytes per pixel, B&W, RGB? RGBA? Palleted?) and the byte order for any multibyte value. I am sure it is all in there somewhere....

0 Kudos
Message 4 of 13
(2,912 Views)

Hello,

 

the application is such a way that i have to convert to *.dat then into image

 

regards

0 Kudos
Message 5 of 13
(2,849 Views)

@tushar.V wrote:

Hello,

 

i have converted image into *.dat file in matlab , but now i want to convert  *.dat file into image format in labview ,

how can i do it.

 

thanks and regards


You do the same procedure as you did in Matlab, but in reverse. How's the image saved? Pure data? Any header? 24 bit RGB values?

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 13
(2,832 Views)

If you use IMAQ Vision functions you would basically import the numeric data in whatever binary format you write it in Matlab and then use the IMAQ Array To Image functions.

 

If you want to use the LabVIEW Pixmap format instead you need to do the same import and then try using one of the Draw Unflattened Pixmap instances.

Rolf Kalbermatter
My Blog
0 Kudos
Message 7 of 13
(2,825 Views)

Hello,

 

I'am able to convert *.dat to *.png  image, but i'am getting two images in earth.png

 

regards

Download All
0 Kudos
Message 8 of 13
(2,814 Views)

Hi V.,


@tushar.V wrote:

I'am able to convert *.dat to *.png  image, but i'am getting two images in earth.png


Then your conversion is wrong!

(Are you sure your "dat" data is organized in a 900×900 scheme?)

 

Btw. why don't you cleanup the code before posting such images?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 13
(2,811 Views)

Hello,

 

the gray scale image is 810000 bytes i'am using reshape array to to convert it into 2d array, how can i get single image instead of two

 

Regards 

0 Kudos
Message 10 of 13
(2,806 Views)