ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Image conversion

Hi there,

I need to convert 16-bit gray-scale images into 8-bit images for image analysis.
I can use two VIs to do this: one is IMAQ Convert and another is IMAQ Shift16To8.
But all three images (16-bit original, 8-bit from IMAQ Shift16To8, and 8-bit
from IMAQ Convert)look different. I understand that such a conversion causes
resolution loss. But even two 8-bit images look different. I use vision
5 with Labview 6 for Windows 98. Thanks in advance. I could e-mail my sample
code and image file to anyone who are interested.

Hugh
0 Kudos
Message 1 of 2
(3,140 Views)
Yes, there is a difference:

IMAQ Convert: recopies the bit value of 16-bit image to 8-bit images. If the value is less than 0, it is coerced to 0, if the value is more than 255, it is coerced to 255. I think there will be a lot of white area in your image after this conversion.

IMAQ Shift16to8: It divides by 256, it is probably better. If the result is not the same, it is probably because the pixel value in 16-bit image is signed (I16), while the pixel value of 8bit image is unsigned (U8). So white in 16bit image will become half gray in 8bit image, I think. You should multiply the resulting image by 2, if you want that it is the same as 16 bit original.
0 Kudos
Message 2 of 2
(3,140 Views)