Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

how to get rgb 2d array of values from 8 bit grayscale image

Hi,
I am new to labview programming.Actually i have some blockdiagram which captures 8 bit gray scale image from the CCD camera, extracts 2D array values of the image, calculate intensity and plots the intensities of in a grayph.Now i want to change this to get R, G, B values in 2D array and calculate the intensity of each(R, G, B) color and plot them accordingly on the graph.So please help me in doing this.I will better understand if u can provide me the block diagram for this.
 
 
0 Kudos
Message 1 of 3
(4,507 Views)
Hi,

Thank you for posting on the NI forums!  To get an array of color pixels, you need to use the IMAQ ColorImageToArray.vi.  That will output an array of U32 pixels.  To get the individual colors, you can either do matrix manipulations and type casting, or use the Color To RGB.vi which outputs the individual color values as U8 integers.  I posted an example of this sort of thing here.  That VI is the reverse of what you want to do, so if you call the VIs in the opposite order, it should work for you.  In the array manipulation example, once you have the U8 2D array, you can use index array to grab any one column, which will be all the pixel values for one color.

I hope this helps!
Maclean G.
Applications Engineering
National Instruments
0 Kudos
Message 2 of 3
(4,490 Views)

Hi,

Thank you very much for your suggestion.ColorImageToArray.vi is working for me.

0 Kudos
Message 3 of 3
(4,475 Views)