From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read image saved in binary file in Matlab

Hello,
I save images in binary file, in one file can be thousands of images, and I would like to read it in Matlab or in some other software.
So I would like to know if it's posssible and if so I would like to know what exactly I save, when I save image, and how image structure look like.
 
Thanks Eva
0 Kudos
Message 1 of 7
(4,158 Views)
Eva,

Are you using LabVIEW? You may want to post this question on the MathWorks forum.  LabVIEW can read a binary file but you have to know how to interpret the file.  You must supply the datatype each byte is, then you can do whatever you want with it.
Doug M
Applications Engineer
National Instruments
For those unfamiliar with NBC's The Office, my icon is NOT a picture of me 🙂
0 Kudos
Message 2 of 7
(4,140 Views)
Hello,
when I save images I use Labview and I know how to read them in Labview, but I would like to read them in Matlab.
So I would like to know, how does look like image structure.
And what exactly I write to binary file, when I save image For example: size of picture,  pixel values, ... and of what data types they are.
 
Thenks Eva
0 Kudos
Message 3 of 7
(4,134 Views)
Hi Eva,

could you show the code where you save them?

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 4 of 7
(4,132 Views)

There is the code.

Eva

0 Kudos
Message 5 of 7
(4,115 Views)
Hi Eva,

I have little knowledge of IMAQ, so I don't know your data type... sorry.

But in general you read the data in MatLAB. You save the image (only 1) 100 times in the same file. Each image is prepended by a I32 with the total byte count of the image. So that is one pointer for you.
What you could do is convert your IMAQ image into a LV picture control (this must be possible) and then convert it into a U32 2D-dbl and read this with Matlab.

Success Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 6 of 7
(4,096 Views)
Eva,

If you wouldn't mind explaining a little more about what it is you are trying to do it would help in understanding your situation.  Can you separate out the images you are reading in and save them as separate bitmap or jpeg files?  You could possibly then read an actual image into a 3rd party software if it has the support.  Another idea is to write the binary pixel values into a text file and then parse the values into another software applicatoin.  What exactly do you want to do with the images?

Regards,
Mark T
Applications Engineering | National Instruments
0 Kudos
Message 7 of 7
(4,077 Views)