How should find range of disease area in mango image?

I m working on color classification project in which i want to find color range of disease area in Lab color model.But problem is to use only a and b channel for finding range of disease area..How to find threshold from histogram of a and b channel?
if true
no_of_up=1;
for i=1:area
if(a_ch(i)>=110 && a_ch(i)<=125)
no_of_up = no_of_up + 1;
end
end
Unripe_per = (no_of_up.* 100)./ area;
%%percentage of ripeness
no_of_rp=1;
for i=1:area
if(a_ch(i)>=120 && a_ch(i)<=139)
no_of_rp = no_of_rp + 1;
end
end
ripe_per = (no_of_rp.* 100)./ area;
%%percentage of diseased
no_of_dp=1;
for i=1:area
if(a_ch(i)>=135 && a_ch(i)<=140)
no_of_dp = no_of_dp + 1;
end
end
Diseased_per = (no_of_dp.* 100)./ area;
end

 Accepted Answer

Here is your gamut of all your images:
and here it is looking down the L axis onto the a-b plane:
Can you tell me where you'd like to set up dividing lines in the ab plane to set up a box that describes ripe, non-ripe, and diseased areas?

5 Comments

I am not getting your point..but i have to find range for ripe ,unripe diseased mangoes.If its possible only single a channel or b channel then its fine...i have find the range from histogram using a channel but the misclassification is more..I think i have found wrong range...Would you please help me?
What I was trying to show you is that finding such areas strictly by a and b thresholding will not be that successful. I showed you in the other thread how to use HSV color space and set up sector-shaped gamuts that can do a better job of carving out background and mango, and can do a better job of determining color and disease or ripeness state, if you'd give it a chance. But you said that you had to ignore L and only use 2 of the available 3 bits of information for some strange reason. Perhaps that was because you don't have good control over L and your exposure, but that is why you should use an x-rite Color Checker Chart to calibrate your images.
Or you can look in my File Exchange and use delta E, which uses LAB (all 3, not just a and b) to get a color difference. You can trace out background, ripe, non-ripe, and diseased areas and get their centroid. Then calculate the delta E from every pixel to the 4 centroids and assign it to which ever is closest. Kind of like linear discrminant analysis.
I have ignore L channel because it show the luminance..And for that i dont need it...My goal is try to use single channel to classify mango from the color distribution range with fast execution..I haven't time to study more as i have time constraint to complete this project...So if possible then please give me the code to complete it as fast as possible..
What link? Here's a link with a good collection of color sites: http://www.efg2.com/Lab/Library/Color/index.html
I can't just give you the code . If this is for your university, then I'm sure your project does not say "Find someone on the internet to solve your problem for you, and give you code that works, then turn in their code."
I've already spent a lot of time for you and given you code to mask out the mangos. And I've given you demos (in my File Exchange ) that show you how to convert the image into different color spaces and segment out areas based on color ranges such as thresholding in rgb, lab, or hsv color spaces, or by finding radii in lab color space (the delta E demo). All you have to do is to use them to find out what the range or mean value is for the 4 regions (background, ripe, non-ripe, diseased) and determine which region (class) every pixel should be assigned to.

Sign in to comment.

More Answers (0)

Categories

Find more on Agriculture 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!