LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how do I import 16 bit grayscale image into LabVIEW without IMAQ?

Solved!
Go to solution

Hi,

 

I am writing a simple imaging demonstration for an Infrared Solutions IR-160 imaging camera.I do not have IMAQ and unfortunately, there are no funds available at this point. (If the demo is successful, funds might become available.) I have LV 8.5.1, full edition.

 

The camera creates 16 bit grayscale images, but the image format is not well documented. I know that the image is 160 pixels wide x 120 pixels high, that the gray values are stored as plain bytes (not ASCII), and that the data format is 16 bit signed words, most significant byte first.

 

I attach two sample images (8 bit and 16 bit) and two test  vis.

I am able to read the image, but instead of grayscale, everything is blue, and there are artifacts across the top of the image.

 

The camera also creates 8 bit images in pgm format, but I have the same issues there. (The pgm image opens fine in e.g., corel paintshop pro.).

 

What do I need to do to make the image appear in grayscale, and save it as a bitmap?

 

Thank you for your help.

 

Peter

0 Kudos
Message 1 of 12
(6,218 Views)

Your fundamental problem was using the grayscale data as rgb data.  For grayscale r=g=b=0-255.

 

 You can simply scale the image to a 8-bit grayscale image and then save to BMP format if you so choose (I prefer PNG).

 

22955i02558C8A3CEA7DE2

 

I assume the picture is right (orientation-wise), did not have a program on this machine to look at the other image.  You can re-wire this example to open a file since I just use default data, change the contrast using the cursors, then save to BMP.

 

0 Kudos
Message 2 of 12
(6,201 Views)

Hi Darin, Thank you very much for your fast reply.

0 Kudos
Message 3 of 12
(6,191 Views)

However, I would like to keep the full 16bit data depth. How am I gonna do this? Thanks.

0 Kudos
Message 4 of 12
(6,187 Views)

Also, I need the vi in LV 8.5.1, not LV9. Thanks again. Peter

0 Kudos
Message 5 of 12
(6,182 Views)

Here is the LV8.5 Version.

 

What do you want to do with this image?  Fix it for export to some other viewer, manipulate it in LV, or both?   

0 Kudos
Message 6 of 12
(6,167 Views)

I would like to manipulate it in LabVIEW. I need to subtract one image file (background) from another image file (sample), then I would like to export it to some other viewer in a standard imaging format. Thanks,.

0 Kudos
Message 7 of 12
(6,165 Views)

HI Paul,

 

It looks like Darin may have included the ability to save.  In order to manipulate the image, you're going to have to go into the image cluster and manipulate the array of points from there.  In the case of subtracting one image from another, you'd be loading two images of the same size and looping through the arrays in the image clusters and subtracting the values from one from the other. 

Jared S.
Applications Engineering
National Instruments
0 Kudos
Message 8 of 12
(6,132 Views)

Sorry for the delay. I was out of town. My earlier question how to display the data in full 16 bit depth was not yet addressed. The example vi provided by Darin converts the data into 8bit for display.

Thanks everybody for your continuing help.

 

Peter

0 Kudos
Message 9 of 12
(6,056 Views)

Hi Peter,

 

The picture control is only going to be capable of displaying an 8-bit grayscale image.  However, you can still work with and manipulate the image in 16-bits.  It looks like your initial VI was already able to read the data in 16-bit.  You'll just need to apply the manipulations to the array.  Then when you want to display, you can convert to 8-bit and display the image.  Something to note about that: most monitors will only use 8-bits per component or color.  Since all three color components need to have the same value for grayscale, there's effectively only 8-bits available for display of a grayscale image.

Jared S.
Applications Engineering
National Instruments
0 Kudos
Message 10 of 12
(6,039 Views)