Thresholding a false-colour image
john_crow
I am trying to threshold a loaded false-colour image and am (predictably) having trouble.
Below is the code I am using. I have attached an example image - if you throw that in a folder and run the code it should load it up for you. Can someone tell me what is going on in the thresholded image? What are the purple areas?
I assume this would work better if the image was grayscale? Does Igor have a built-in function for the conversion if this is the case?
<br />
function process() <br />
newpath/Q path1 <br />
pathinfo path1<br />
string path=S_path<br />
string filepath = path + "1.jpg"<br />
ImageLoad/T=JPEG/N=image filepath<br />
Imagethreshold/i/t=10 image<br />
newimage image<br />
newimage M_ImageThresh<br />
end<br />
function process() <br />
newpath/Q path1 <br />
pathinfo path1<br />
string path=S_path<br />
string filepath = path + "1.jpg"<br />
ImageLoad/T=JPEG/N=image filepath<br />
Imagethreshold/i/t=10 image<br />
newimage image<br />
newimage M_ImageThresh<br />
end<br />
Thanks!
When you load a JPEG image into IGOR you get a 3D wave. This is not "false color". ImageThreshold applies to a 2D wave so you need to convert your data.
The image that you posted appears to be mostly green so chances are good that most of the data are in the green channel of your image. You can then either extract the green channel, e.g.,
or you could convert your whole image to grayscale:
I think you might benefit from going through the Image Processing Tutorial (File Menu->Example Experiments->Tutorials->Image Processing Tutorial.
A.G.
WaveMetrics, Inc.
August 17, 2014 at 09:52 am - Permalink