Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

to convert an rgb image to 8 bit grayscale

Hey,
I need to convert an rgb image to 8 bit grayscale image as the image is being acquired, im using the imaq create VI, which has an 'image type' terminal which allows the choice of image to be selected.however this isnt working. any solutions?

also
Im trying to make a image constant for the imaq subtraction VI, so the this constant image is subtracted from each image as its acquired.what would be the easiest way of doing this, without having the user specify the same image path each time? thanks.
0 Kudos
Message 1 of 10
(8,976 Views)
Please see a attached file.

Message Edited by Ancle on 04-27-2005 09:28 PM

Message Edited by Ancle on 04-27-2005 09:28 PM

0 Kudos
Message 2 of 10
(8,971 Views)
Hello I have downloaded the example code but I'm missing the IMAQ Cast image. Do you know where I can find this VI ? I have the rest of the VIs but this one don't. Also I'm missing IMAQ Extract Color Planes, do you know something about this

Thank you

0 Kudos
Message 3 of 10
(8,629 Views)
Brendan,

It seems that you do not have NI Vision Development Module (VDM) installed. If you do not have VDM, then download it from http://joule.ni.com/nidu/cds/view/p/id/839/lang/en

Hope this helps,

JohannS
0 Kudos
Message 4 of 10
(8,617 Views)
Thank you Brendan

But is there other way to convert a RGB image to grayscale without using the NI Vision Development Module. I tried with the VI attached but the image that I get is the same input image. I think the problem could be in how I manage the labview image data (6 clusters etc). In fact, I'm not sure about the difference between 1-D array image and 1-D array color. Please if any of you could help me, I will really appreciate it.

Message Edited by Lamas on 08-28-2007 10:48 AM

0 Kudos
Message 5 of 10
(8,614 Views)
HSL Color Space

If you would like to convert an RGB image into an 8-bit grayscale, you would need to convert from the RGB color space to the HSL color space, and extract the luminance layer. I attached a link above that discusses how you can do the conversion. I hope this helps you out. With Vision Development Module, you would be able to do this very easily, but unfortunately it is much more difficult to do in LabVIEW alone.

The reason that you were getting the same input image as your output in the VI you included is because you are not using indexing in your for loop. Thus, only the very last pixel in your picture is getting affected. I have attached a modified version of your code which fixes this indexing issue, but unfortunately, all that it really does is make the image darker.
0 Kudos
Message 6 of 10
(8,587 Views)

Hello there... I have used the attached VI in order to convert an RGB image into Grayscale but i found that i have to retrieve an image that is saved on my hard disk. My question is that if i was able to capture an image using a webcam, how can i directly convert it into grayscale? is it possible to do the conversion without the need to save the image like the attached VI shows? 

Regards... 

0 Kudos
Message 7 of 10
(7,359 Views)

I made a modification to the VI.  It can convert 32, 24, or 8 bit images to grayscale.  However, it doesn't change an image from 32 or 24 bit to 8 bit.  I know this is an old post but maybe this will help someone.

Quentin "Q" Alldredge

Chief LabVIEW Architect, Testeract | Owner, Q Software Innovations, LLC (QSI)
Director, GCentral | Admin, LabVIEW Wiki | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner



0 Kudos
Message 8 of 10
(6,160 Views)

Can you try extracting a single plane ?

0 Kudos
Message 9 of 10
(6,152 Views)

Not sure what you mean by extracting a plane?

 

Here is a VI that will convert an image to 8-Bit.  This paired with the grayscale one will get the desired result.  See example.vi below.  Order that they are applied does give slightly different results.

Quentin "Q" Alldredge

Chief LabVIEW Architect, Testeract | Owner, Q Software Innovations, LLC (QSI)
Director, GCentral | Admin, LabVIEW Wiki | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner



0 Kudos
Message 10 of 10
(6,143 Views)