Posted by
Joel Sheffield on
Jan 01, 2010; 6:49pm
URL: http://imagej.273.s1.nabble.com/macro-help-please-tp3689867p3689881.html
It seems to me, without doing the measurements, that you may be having
problems in the conversion from rgb to 8-bit. The actual conversion is
somewhat complicated, since each of the channels are weighted differently in
the calculation of the grey values. If you are actually interested in the
foliage, as measured by green and black in the original, I would suggest
that you try to separate out the channels, rather than use a general
conversion. Use Image>colors>split channels, and then select the green
channel. Then carry out your threshold and measurements, etc.
Alternatively, you can use Gabriel Landini's color deconvolution plugin to
select more accurately.
Best of luck.
Joel
On Fri, Jan 1, 2010 at 1:05 PM, Larry Nolan <
[hidden email]> wrote:
> Working with a set of 1000 images from ten years ago now; I've succesfully
> processed images from this summer with the macro I completed.
>
> Each old Jpeg image is 320x240. All were taken with the same camera.
>
> I'm worried that there is something different in some of the files that is
> causing my macro not to process the images correctly. I've randomly pulled
> three images and used this macro to analyze them to find the canopy cover
> (leaves and branches).
>
> Here's the macro; I open the file twice so I can compare the original with
> the thresholded result:
>
> dir = getDirectory("Choose a Directory ");
> list = getFileList(dir);
> setOption("display labels", true);
>
> for (i=0; i<list.length; i++) {
> path = dir+list[i];
> showProgress(i, list.length);
> open(path); open(path);
>
> run("8-bit");
> setAutoThreshold();
> run("Measure");
> }
>
> After running the macro on a folder with the three files (attached in order
> below):
>
> File 11.jpg has the sky selected as red, not the foliage; area results
> wrong
> File 61.jpg appears to be OK with the foliage selected as red and the
> analysis result looking reasonable
> File 1933.jpg has the sky selected as red, not the foliage; area results
> wrong
>
> i don't understand what's going on. Is there something possibly different
> with file 11.jpg and 1933.jpg vs. 61.jpg? How would I figure out what it
> is?
>
> I don't want to have to manually process all 1000 images to get valid
> analysis results.
>
> Larry
>
>
--
Joel B. Sheffield, Ph.D
Department of Biology
Temple University
Philadelphia, PA 19122
Voice: 215 204 8839
e-mail:
[hidden email]
URL:
http://astro.temple.edu/~jbs