I need to calculate the number of green pixels in a bunch of images?

3 views (last 30 days)

I'll be analyzing many plant images. I need to count how many green pixels are there in each image, I'll have 5000 images produced every day, for 30 days. I have not used matlab before, I have been playing with it for the last month trying to understand what's going on, and find a way to do the analysis but no way. I'll be happy if somebody can help me with that even in analyzing few images.

I need help writing the code for the whole bunch of images. Also I having difficulty getting to write the color threshold which I got from image thresholder into matlab

Answers (1)

Image Analyst
Image Analyst on 20 Nov 2014
You can do that with the color segmentation demos in my File Exchange http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862. I might recommend the HSV method as the one to start with.
  2 Comments
Abdalla
Abdalla on 22 Nov 2014
Thanks Image Analyst. First I ran the code as it is and I saw the results and it worked just fine. Then I changed the code and the Threshold a little bit to match my images. I was adding codes one by one and was working fine until I came to line 364, it started to give me error, it is telling me" Illegal use of reserved keyword "catch ME", this is in line 385 in your code. I don't know why is that? Thanks
Image Analyst
Image Analyst on 22 Nov 2014
Attach your modifications to my code with the paper clip icon. It won't give that error if all you did was change the threshold numbers. And the error is NOT referring to the "catch ME" line - that is where the execution goes to once you've thrown an exception. You need to look at the line before it moves to the catch block. Also, you didn't include the error message - ALL the red text - so I can't see the line of code that threw the exception.

Sign in to comment.

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!