Me again... (the other problem is still not solved)
but now I got a new problem... My webcam generates 32 bit images... now some IMAQ vi's only accept a 16bit or 8bit image... How do I convert my 32bit image from my webcam to a 16/8 bit image in labview?
I think your web cam produces a RGB image. That consist of 3 channel (red green and blue). Each channel is encoded with 8 bits. Its extended to 4 Bytes. If you try to display as 8 bit you loose the color information and you have a grayscale image. 16 bits is also a grayscale image. You can apply a color table to grayscale image but I haven't an algorithm for calculating an optimal colortable from the color distribution in the RGB image.
In some cases you might have a 32bit grayscale image, which mean that each pixel is represented by a 32bit floating point number.
Then you need some more information about the image. You can do a transformation from min to may value from the 32bit numbers to 0-255 (values of 8bit image) or just convert the number to 8 bit and clip values exceeding the range from 0 to 255.
There are several VIs in the IMAQ-Vision package performing the described functions. But before giving more advice please check the camera whether it is RGB or 32bit floating point number grayscale and give some more information on your task.
Well I figured the following stuff out...
Image type is indeed RGB and 4 bytes per pixel. (atleast that is what labview says about the image)
Btw I've the following cam: http://www.logitech.com/index.cfm/webcam_communications/webcams/devices/3056&cl=NL,NL
It has a colordepth of 24 bit. It doesn't have any technical detail furthermore..
Use the IMAQ IntegerToColorValue.VI to convert your camera data into a form that is accepted by the IMAQ ArrayToColorImage.VI The image for that VI should be created as a RGB (U32) image.
What do you want to do with the images? Do need a conversion to grayscale?
I found the following formula on http://www.mathworks.com/support/solutions/data/1-1ASCU.html for RGB to grayscale conversion:
intensity = 0.2989*red + 0.5870*green + 0.1140*blue
The Vision Concepts Manual gives the same formula or suggest simple averaging of the three color planes.
There might be different formulas. Just google for "rgb grayscale conversion".
With IMAQ Vision split up the RGB image with 'Color Utilities > IMAQ ExtractColorPlanes'multiply with a constant and sum up with the 'Image processing > Operator' VIs.
Can't you just connect the image type "Grayscale (U8)" or "Grayscale (I16)" to the "Image type" connector of the "IMAQ Create" vi? The conversion will be done automatically by LabView.
I'll do it that way and the result is fine for me
Maybe it will satisfy you also
Attached 3 screen shots
Snag-001 : IMAQ Create.vi to create memory locations
Snag-002 : Load an image, even if it's a 32bit colour image it loads and show as an 8 bit grayscale image in the image control
Snag-003 : Process the image and show the result in the image control
This code is part of a complete project that load's 32 bit colour images from microscopes and analyse them in a certain way.
Right, if you load the image from disk it is automatically converted. I was thinking of an array of U32 representing colored pixels. U32-arrays can only converted to images with color planes using IMAQ ArrayToColorImage. I think Wouser might be interested in processing a stream of images. Then he wouldn't store them before processing and he would need the described algorithms.