LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

cant convert color image to black and white

i have the following attachment of code.

Im trying to take a color image

then convert it to black and white

But using the standard conversion formula

http://en.wikipedia.org/wiki/Grayscale

gray = 0.299*Red + 0.587Green+ 0.114*B

 

The attached code is my attempt at this.

Im not sure what im doing wrong.

I keept getting an error 'invalid image type'

 

The basics are that i am trying to extract the RGB from the image

Then apply the scalar offsets.

then combine the three arrays into the one grayscale.
ideally i figured there would be a premade function to do something like this.

im not talking about just capturing one channel though.

 

The acquistion is done inside a loop as the display needs to be done repetitively

The save is only at the end

 

Ive attached a screen shot of my MAX of the camera

 

Any help is appreciated.

 

0 Kudos
Message 1 of 9
(4,361 Views)

Your attachments did not make it into your message.

0 Kudos
Message 2 of 9
(4,334 Views)

attachments should be on this time.

not sure why they didnt show

 

Download All
0 Kudos
Message 3 of 9
(4,307 Views)

Any help on this is appreciated..

0 Kudos
Message 4 of 9
(4,284 Views)

I believe the problem appears to be with the IMAQ ReplaceColorPlane VI. If you open the detailed help for this VI, it shows that's expecting RGB or HSL images types. Whereas, you're passing it U8 grayscale images. If you would like to combine the different grayscale images you're generating into a single image through addition, try using the IMAQ Add VI.

0 Kudos
Message 5 of 9
(4,271 Views)

hi jimmyinct3,

 

I I don't have access to Vision, so I can't test if my approach would work, but I think this is not a Vision-specific task.

 

Here's my plain Labview approach2014-03-23_grayscale.PNG:

Please note:

The color input-picture is in u32 as well as the grayscale output-picture

 

 

Regards,
Alex

0 Kudos
Message 6 of 9
(4,238 Views)

Hi, Biosolutions,

 

I thought you may not use the pixel manipulation within it, instead of image operators.

Then you can apply the U8 format to the result image.

 

0 Kudos
Message 7 of 9
(4,216 Views)

Hi

I work with the guy who posted this question.

The file you uploaded is version 2013 and I have 2012 on mine and cannot open it. Could you please convert it to 2012 and re-post it? I appreciate your help.

0 Kudos
Message 8 of 9
(4,165 Views)

Hi, 

 

I'm not sure the VI is what you want, I've saved it to LabVIEW 2012.

You can try it:)

Message 9 of 9
(4,148 Views)