06-29-2012 01:42 PM
I am acquiring an image and the output appears to be a grayscale image, but the text states that it is in fact an RGB image. I'd like to save some space and convert it into a GrayScale image. I have labview 8.2 and I don't have vision. Is there any way to do this?
Solved! Go to Solution.
07-02-2012 01:42 PM
Hi:
What do you mean by “I don’t have vision”? In the VI attached I could see that you are using a Vision Acquisition Express VI and also an IMAQ Write vi.
07-02-2012 01:44 PM
I was able to download a trial of IMAQdx but I don't have the majority of vision.
07-02-2012 04:26 PM
Hi,
Here is a almost solution, try if you can get best color, i am viewing black and white :S.
Best Regards,
07-02-2012 04:29 PM
I only have LabView 8.2. Can you please upload an older version?
Thanks!
07-02-2012 04:46 PM
If the RGB image is greyscale, it means that the R, G, and B components are the same for each pixel. Simply create an appropriate color map and retain one of the components as index into it.
07-02-2012 04:51 PM
Hi wiswana,
To convert to a grayscale image we will need the R, G, and B values from the image. The most common technique for converting to a grayscale image is to use a formula like the one below (see this thread for code and more discussion):
Grayscale = 0.299R+0.587G+0.114B
Note: these coefficients are subjective and can be changed depending on your tastes (this link talks about this in depth).
07-02-2012 05:20 PM
I think you describing the conversion of a color image to a pleasing greyscale image.
The way I read the question is that the image is already greyscale, but just represented in 24bit color at the moment. I don't think your scaling is needed and would not make a difference.
Maybe I am reading the question wrong....
07-03-2012 10:52 AM
Hi,
Here is my code fixed at LV 8.0.
Best Regards,
06-22-2018 09:13 AM
I made the mistake of trying this on a picture of my face. It works great - the the image's values are flipped. (So you get the eerie, x-ray image effect).
If this isn't what you want, remove the 'not' vi from the loop, and you get quite a visually pleasing result. Thank you for the algorithm to convert color to grayscale, it was exactly what I needed!