03-23-2015 11:32 AM
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
03-23-2015 11:45 AM - edited 03-23-2015 11:47 AM
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"?
03-23-2015 11:54 AM
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
03-23-2015 11:57 AM
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
03-23-2015 12:25 PM
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...
03-23-2015 12:45 PM
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
03-23-2015 01:30 PM
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:
OR
03-23-2015 01:36 PM
May plz help
03-23-2015 01:48 PM
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
03-23-2015 02:03 PM
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.