LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Order of elements (pixel positions) in RGB arrays

Solved!
Go to solution

Hi!

I have two questions:

1) I have a number of images, and I want to create a 3D plot for each of the RGB Values for each image. The plot should contain: x-coordinate (x position of pixel), y-coordinate (y position of pixel) and R-value for example as z- coordinate. I get the R, G and B values of the image as 1D arrays. Each array starts at 0,0 position and as I can see on my displayed image, it goes forward on the x-axis (1,0; 2,0; ...n;0,.....). I cannot find out what comes after position (n;0). It's not (1,0) and not (n,1).

2) Is there an easy way to create a 2D Array for R, for G and for B values, where the position of the R value (for ex) in the array represents the pixel position on the image? the Option Color image to array (vision) gives the pixel values with the "correct" position but not the r, g and b values.

Thanks in advance for helping me!

 

0 Kudos
Message 1 of 8
(3,228 Views)

Sarah,

     Please help us by attaching actual LabVIEW code (a file ending in .vi).  Pictures can't be manipulated, edited, executed, expanded, etc.

 

Bob Schor

0 Kudos
Message 2 of 8
(3,221 Views)

Hi Bob, I've copied the relative part for my question in the attached vi. I hope u can help me in this (may be very simple) issue.

Download All
0 Kudos
Message 3 of 8
(3,197 Views)
Solution
Accepted by topic author s.steen

Hi Sarah,

Use IMAQ ExtractColorPlanes.VI to individually get the R,G,B components on the image. Then use IMAQ ImagetoArray.VI for each generated color components to be able to obtain its 2D U8 equivalent. Ive attached my sample VI. Hope it helps

 

Front PanelFront PanelBlockDiagram.png 

Message 4 of 8
(3,184 Views)

@s.steen wrote:

Hi!

I have two questions:

1) I have a number of images, and I want to create a 3D plot for each of the RGB Values for each image. The plot should contain: x-coordinate (x position of pixel), y-coordinate (y position of pixel) and R-value for example as z- coordinate. I get the R, G and B values of the image as 1D arrays. Each array starts at 0,0 position and as I can see on my displayed image, it goes forward on the x-axis (1,0; 2,0; ...n;0,.....). I cannot find out what comes after position (n;0). It's not (1,0) and not (n,1).

2) Is there an easy way to create a 2D Array for R, for G and for B values, where the position of the R value (for ex) in the array represents the pixel position on the image? the Option Color image to array (vision) gives the pixel values with the "correct" position but not the r, g and b values.

Thanks in advance for helping me!

 


 

I suppose you are looking forward to do this:

https://forums.ni.com/t5/LabVIEW/image-to-RGB-color-separation/m-p/596148#M278340

 

RGB_GRAYSCALE.png

 

Message 5 of 8
(3,172 Views)

@ clnglenn
oh yes.. sure 🙂 I could've used the IMAQ ImagetoArray (giving U8 equivalent values) for each of the r,g,and b values.. not only for grey scale images..

Thank you very much for your help!!!!

0 Kudos
Message 6 of 8
(3,155 Views)
Thank you for ur answer.
This is exactly what I tried to do in my vi. unfortunately, sometimes I don't get the correct r,g,b values at the correct positions in the array using the information out of the "read jpeg"! I still don't understand it.
0 Kudos
Message 7 of 8
(3,153 Views)

@s.steen wrote: I don't get the correct r,g,b values at the correct positions in the array using the information out of the "read jpeg"! I still don't understand it.

what have you tried, to substantiate your assumption?

e.g. "Read Jpeg" does output the correct HEX value for Pixel (5,10)

 

 

 

RGB_hex.png

 

 

 

 

 

 

0 Kudos
Message 8 of 8
(3,147 Views)