MATLAB Answers

Detecting "brown spots" on leafs

19 views (last 30 days)
Elvin
Elvin on 20 Dec 2013
Commented: swathi on 2 Mar 2017

Can you show me will I be able to detect the "brown spots" in this image? Thanks

  0 Comments

Sign in to comment.

Answers (3)

Image Analyst
Image Analyst on 20 Dec 2013
I'd first define a mean green color. Then convert to lab color space and calculate a delta E image. Then threshold the delta E to find out where the delta E is more than some certain amount. Those will be the non-green pixels. See my delta E demo at http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862 and adapt it. I do this kind of thing all the time and yours is not that hard. Note, you cannot use automatic thresholding despite what some novices at image processing may suggest because you need to find all amounts of brown from 0% to 100%.

  13 Comments

Elvin
Elvin on 21 Dec 2013
Still nothing :(
Here's my code:
clc
clear
HealthyImage = imread('1.jpg');
cform = makecform('srgb2lab');
HealthyImage = applycform(HealthyImage,cform);
LChannel_HealthyImage = mean2(HealthyImage(:, :, 1));
AChannel_HealthyImage = mean2(HealthyImage(:, :, 2));
BChannel_HealthyImage = mean2(HealthyImage(:, :, 3));
RBImage = imread('RB - 1.jpg');
cform = makecform('srgb2lab');
RBImage = applycform(RBImage,cform);
LChannel_RBImage = mean2(RBImage(:, :, 1));
AChannel_RBImage = mean2(RBImage(:, :, 2));
BChannel_RBImage = mean2(RBImage(:, :, 3));
deltaL = LChannel_HealthyImage - LChannel_RBImage;
deltaA = AChannel_HealthyImage - AChannel_RBImage;
deltaB = BChannel_HealthyImage - BChannel_RBImage;
deltaE = sqrt(deltaL^2 + deltaA^2 + deltaB^2);
imshow(deltaE,[])
Image Analyst
Image Analyst on 21 Dec 2013
deltaE is a 2D array that has a color difference value it it, just like any other 2D numerical array. Look at deltaE in the variable inspector to see the values or use imshow like Walter showed. If you don't know what the variable inspector is, then see this.
Image Analyst
Image Analyst on 21 Dec 2013
You need to do an element by element squaring:
deltaE = sqrt(deltaL.^2 + deltaA.^2 + deltaB.^2);

Sign in to comment.


sai rama krishna gondela
sai rama krishna gondela on 25 Mar 2015
can any one write complete program for brown spots or tthe above program is itself correct

  1 Comment

Image Analyst
Image Analyst on 25 Mar 2015
Probably. And I think you're one of those people.

Sign in to comment.


Kameshwar Pramanik
Kameshwar Pramanik on 27 Nov 2015
can you tell me how to correct following line i am getting error on this. That is File "RB - 1.jpg" does not exist.
for Code is: RBImage = imread('RB - 1.jpg');

  2 Comments

Image Analyst
Image Analyst on 27 Nov 2015
Make sure the filename is spelled correctly and the file is in the current folder or on the search path.
swathi
swathi on 2 Mar 2017
Hello.. Even I am looking for similar sort of code, on the mango images. finding spot pixels. I tried the same code, but its not wworking, Could somebody please help.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!