RGB Images: extracting individual channels
I am doing research with RGB images and most of the information I want is in the blue channel of the RGB image. I tried
ImageTransform rgb2grayto convert the RGB photo into gray and run analysis, but the result is very noisy from the red and green channel contributions.
The helpfile also recommended
gray2DWave=c1*image[p][q][0]+c2*image[p][q][1]+c3*image[p][q][2]
but every time I try that igor returns an error.
The last thing I attempted, also from the helpfile was
Make/O/N=3 scaleWave={c1,c2,c3} ImageTransform/D=scaleWave scalePlanes image ImageTransform sumPlanes M_ScaledPlanes
but that too only returned errors.
I know I can use the Lineprofile macro under the built in Image Analysis package, but I am looking to do batch analysis, so I want a process that doesnt involve plotting the image and using the GUI.
I just want to be able to plug in the wave name and have the program do it automatically.
The helpfile also recommended
but every time I try that igor returns an error.
[/quote]
What errors did this cause? You have to make sure that c1, c2, and c3 are defined as local variables (if you do this from a user-defined function) or global variables (if you do this from the command line). So, for example, here is what you would type on the command line to do this:
This should give you the same results that using ImageTransform with the rgb2gray keyword would give you (assuming that image is the name of a 3D RGB wave). You will need to adjust the values of c1, c2, and c3 for your purpose.
[quote=sleepingawake86]
The last thing I attempted, also from the helpfile was
but that too only returned errors.
[/quote]
I'm guessing that you didn't define c1, c2, and c3, as I mentioned above.
[quote=sleepingawake86]
I know I can use the Lineprofile macro under the built in Image Analysis package, but I am looking to do batch analysis, so I want a process that doesnt involve plotting the image and using the GUI.
I just want to be able to plug in the wave name and have the program do it automatically.[/quote]
You haven't really said what it is that you actually want to do. If you want to extract *only* the blue channel from a 3D wave into a 2D wave, you can do this:
The output of ImageTransform in this case, M_ImagePlane, would be a 2D wave containing only the data in the 2nd (blue) layer of the original wave.
July 5, 2010 at 03:09 pm - Permalink
You need to extract the Blue channel as a plane from the image
ImageTransform/p=2 getPlane RGBImageWaveUse p=0 for Red, p=1 for Green and p=2 for Blue. The wave output is called M_ImagePlane.
From here you can call the image analysis commands, such as thresholding, eg at 64 levels
Extracting a line profile from this channel can be done by specifying the row number in the M_ImagePlane 2D wave in a function like this:
Hope this helps,
Jason.
July 5, 2010 at 03:22 pm - Permalink