LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I have extracted R, G, B of jpeg image now I want to convert each one to matrix

Hi,

I have extracted R, G, B of jpeg image using IMAQ extract single color plane, now I want to convert each one to matrix.

and then remove red from the image and add green and blue matrix and create the image again

My problem is thet I cant find a vi to convert Red, Green, Blue to matrix. I used  IMAQ color image to array but it is wrong bcoz now I have separated color planes

I would appreciate your suggestions

regards

0 Kudos
Message 1 of 19
(3,540 Views)

IMAQ ColorImageToArray should produce an array of all the pixel values of the image.

 

The plain IMAQ ImageToArray should produce an array of pixel intensities of an image, so you may be able to use this individually on the R, G, and B versions of your image.

 

 

Edit: Why was IMAQ ColorImageToArray wrong for having "separated color planes"?



0 Kudos
Message 2 of 19
(3,531 Views)

Hi,

Thank you very much for your prompt reply.

I have connected "IMAQ image to array" to R, G, and B, my problem is that how can I get the matrix at oulet of this vi. because after that I should use math function " + " to add G and B and " -" to remove R from my image. Then I should convert Matrix from G+B to a new Jpeg image

Thanks again

0 Kudos
Message 3 of 19
(3,524 Views)

I have started Labview recently (it is about 2weeks) and I am training myseldf using sources from internet. And recently realized that I can ask for help here. so, please accept my apologies if my questions are so basic

0 Kudos
Message 4 of 19
(3,523 Views)

If you use IMAQ ImageToArray on each of your R, G, and B plane images, you should get a 2D Array out for each.

You would therefore have three 2D arrays - an array of the R value of every pixel from the original image, an array of the G value of every pixel from the original image, and an array of the B value of every pixel from the original image.

Note that the VI provides output terminals for each type of image, but only populates the output terminal for the type of data in the image that you provided (U8 pixel values, U16 pixel values, etc.).

 

If you use IMAQ ColorImageToArray to begin with, then you get a single 2D array with each pixel represented by a single combined integer value.  You can use IMAQ IntegerToColorValue to convert these to RGB value clusters.

 

 

If you add G and B values, what do you expect that to look like?  If you actually had an array of G values and an array of B values and performed elementwise addition between them, then you would end up with a single array with a single value for each pixel, which would only be reasonably represented as a grayscale image...



0 Kudos
Message 5 of 19
(3,503 Views)

Yes, Convert to Grayscale is what exactly I want, bcoz I have to convert my image to Grayscalein such a way that the value of intensity of each pixel doesn't change. I used IMAQ cast image before and converted my image using that (1. by removing luminance and 2. by removing red) to gray scale, but this cahnges the value of pixels.

So, thats why this time I used IMAQ extract single color plane (I have attachd my file here) and want to convert them to Matrix (Array) and do this by mathematical functions.

my problem is that after that I use IMAQ ColorImageToArray or IMAQ ImageToArray , I don't see any arrey in FP window, and I dont know how can I connect this to math functions

 

0 Kudos
Message 6 of 19
(3,495 Views)

1. Summing the G and B values of every pixel while discarding the R will not produce an image with equal intensity in every pixel as the original.

 

2. You don't see an array indicator on the front panel simply because you didn't create one.  2D arrays are available as output terminals from IMAQ ImageToArray.  Yours would be Image Pixel (U8).  If you want to see it, then create an associated indicator and wire it (right-click the terminal and select Create -> Indicator to do this for you); if you want to use it with mathematical functions, then wire out from it.

 

 

Do you need to:

  • Only convert to grayscale in such a way that the value of intensity of each pixel does not change?

OR

  • Remove all R values and THEN convert the result to grayscale in such a way that the value of intensity of each pixel is equal to the intensities in the original image?

 



0 Kudos
Message 7 of 19
(3,483 Views)

May plz help

0 Kudos
Message 8 of 19
(3,479 Views)

Hi Vltan,

Thank you so much, now I can see the array. case1: I have to remove all R values and then combine G & B and then grayscal 

case2. combine all R,G,B again and show this new image. And then, I have to convert the result of this combination to grayscale and compare it with case1

 

BTW, I have Wired G & B to a "+ " but now I cant connect the out put of this to "IMAQ Integer to color value"

 

Thank you so much for helping me

Regards

0 Kudos
Message 9 of 19
(3,474 Views)

What about maintaining pixel intensity?  Is that required for case1?

 

Are you sure that for "combine G & B" you want to add the G and B intensities together?

 

When adding G and B values, be careful of overflowing the U8 representation.  For example, if you have 250 G and 8 B and add them together, the element will come out as 2.  If you are actually adding them like this, then you will need to decide how you are going to handle this.

 

 

 

IMAQ IntegerToColorValue operates on a combined 32-bit integer value like I mentioned for IMAQ ColorImageToArray.  If you add the B and G U8 arrays, then you will have a U8 array.  This can be converted to a grayscale image using IMAQ ArrayToImage.



0 Kudos
Message 10 of 19
(3,467 Views)