LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read 12 bit data in 16 bit binary file

I have a binary file that has taken 12 bit data from a camera and has written it to 16 bit file. Is it possible to read this file with Labview? I keep on getting numbers above 4096. 4 Of the 16 bits in the file are not used, but I don't know how to tell this to Labview.

Thnks for the help.
0 Kudos
Message 1 of 5
(4,051 Views)
hi,

in case the file has been written by an external application it may has a different byteorder than labView assumes to be default for binary files. try to read the file as I16 and then pass the data to "Swap Bytes" from the Advanced/Data Manipulation palette. if it dosn't work please post a datafile.

best regards
chris
Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
Message 2 of 5
(4,051 Views)
Hello Chris,

It worked! You're my hero for today. I have no clue what this "swap bytes" function does, but I got what I want now.

Thanks
Jeroen
0 Kudos
Message 3 of 5
(4,051 Views)
hi
an windows platforms binary files are mostly written in "big endian" format, i.e. the higher bytes are written to the file before the lower bytes. LabView reads and writes binary files as "little endian", i.e. first the lower bytes and then the higher one (as most apps on unix/mac os). if you mix both (on a windows platform) you get into trouble, so you have to swap the order of the bytes, and thats exactly what the "Swap Bytes" function does.

best regards
chris
Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 4 of 5
(4,051 Views)
Hello,

Now I can open this file, I would also like to write my Labview array (U16) in the same format to this file. I have included an example of this file which consists of two images of 1024x1024. Could you please help me ??

Thanks
Jeroen
0 Kudos
Message 5 of 5
(4,051 Views)