Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

LabWindows/CVI and IMAQ - Invalid Image Type when saving bitmap

I create and image, grab it, then display it, but when I go to save it using imaqWriteBMPFile, I get an error that maps to Invalid Image Type, so I use imaqCast to cast it to an IMAQ_IMAGE_U8 type (which is what the orignal image was created as), then it works, except that my image has changed, that looks like the contrast or something has changed. Any suggestions?
0 Kudos
Message 1 of 3
(3,724 Views)
What kind of camera & IMAQ board are you using? I have seen similar problems when a 12 bit camera is used. The image is acquired as a 16 bit image, and if you just convert it to an 8 bit image, it ends up looking like the one you attached. To correctly convert to 8 bits, you need to shift the appropriate number of bits during the conversion. For a 12 bit camera, that would be 4 bits.

Bruce
Bruce Ammons
Ammons Engineering
Message 2 of 3
(3,724 Views)
16-bit images can only be saved in png, tiff, and AIPD (NI format). 16-bit tiffs are not standardized very well and it may look black in photoshop or other viewers, but opening it with IMAQ Vision functions will look good. BMP, JPEG, only support 8-bit and RGB images.

Hope this helps,
Brad
0 Kudos
Message 3 of 3
(3,724 Views)