LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

image data type

I am trying to understand LabVIEW's image data type.  I have a 16-bit TIFF that I am reading into LV.  When I do this with Matlab, I get a 3D matrix.  The first plane representing red, the 2nd green and the 3rd blue.  All values are from 0 to 65535.
I am not quite sure what I am seeing in LabVIEW.  In LV, I am first creating a RGB (U32) image using the IMAQ create.vi.  Then I read in the TIFF with the IMAQ ReadFile.vi.  Then I am converting the LV image to pixels with the IMAQ ColorImageToArray.vi.  This creates a 2D array.  I am not sure how to interpret this data.  Some of the values of this array are not in the interval (0, 65535).
Can anybody shed any light on the subject?
Thanks
0 Kudos
Message 1 of 13
(6,977 Views)

A U32 RGB image will only store 8 bits per color.  You would need to use a U64 RGB image to store 16 bits per color.  I'm not sure if LV will read a 16 bit color image and keep all the images.

The output of the color image to array will be a U32 integer for each pixel.  Each 8 bits of the U32 represents one color plane with a range 0-255.  The last 8 bits is unused.

If you can get your image into a U64 RGB image, you could extract each color plane as a separate I16 image, then convert each color plane to a U16 array which would give you the proper range.

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 13
(6,970 Views)

Hi Bruce, thanks for your reply.

After I get my image into a U64 RGB format and separate each plane as an I16, the individual planes only have a maximum value of 32767 and a minimum of 0. 

I am not sure why I lost have of my range.

0 Kudos
Message 3 of 13
(6,964 Views)
An I16 is a signed 16 bit number - which ranges from -32768 to 32767. A U16 or un-signed 16 bit number ranges from 0 to 65536.
 
IMAQ does not currently support U16 bit opperations for any of the Vision algorithms - however, LabVIEW in gerneral can handle numbers with either U16 or I16 bit depth without a problem. If your data is comming in as a U16, convert it to a I16 to display properly etc.
0 Kudos
Message 4 of 13
(6,949 Views)

Hi Marc,

Thanks for your reply.  How would one go about converting an image to a I16 in labview.

Do you have an example.

Thanks

0 Kudos
Message 5 of 13
(6,920 Views)

Hi Marc,

Thanks for your reply.  How would one go about converting an image to a I16 in labview.

Do you have an example.

Thanks for

0 Kudos
Message 6 of 13
(6,920 Views)
Currently, we do not have any example programs that convert U16->I16.  I created this example for you which should convert an U16->I16.  Please let me know if it works.
 
Regards,
 
Ryan M.
Applications Engineer
National Instruments
0 Kudos
Message 7 of 13
(6,897 Views)
Ryan M,
Thanks for your response.  The vi works fine.  The problem is I am not sure how to implement it.  When I read in the TIFF in LabVIEW and call the IMAQ ImageToArray.vi, LabVIEW clips all the data above 32767, so I do not have a chance to use your vi.
Is there some way of converting the data before LabVIEW clips the data?
0 Kudos
Message 8 of 13
(6,879 Views)
All U16 and I16 numbers are composed of 16 bits.  If the data being sent is U16, it will be composed of 16 bits.  If LabVIEW is expecting an I16, LabVIEW is expecting 16 bits.  There is no truncating of the data just different way of interpretation.  It looks like there was a bug in the last vi.  Which could be causing you problems.  Try this one instead.
 
Regards,
 
Ryan M.
Applications Engineer
National Instruments
0 Kudos
Message 9 of 13
(6,865 Views)
Hi Ryan,
The problem I am having is that when I read my TIF into LabVIEW and convert the image to a pixel array, all the values are within the range [0,32767].
The values should be within the range [0,65535].
I have confirmed that there are values greater than 32767 with Matlab.
This is why I said that LabVIEW must be clipping any value above 32767.
 
So I really haven't had a chance to use your vi because by the time I read my TIF file with LV it has adjusted the values into the range [0,32767].
Is there a way to force a specific pixel range in LabVIEW, when it reads a TIF?
 
Thanks for your help. 
0 Kudos
Message 10 of 13
(6,837 Views)