Detecting "brown spots" on leafs

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

Antworten (3)

Image Analyst
Image Analyst am 20 Dez. 2013

1 Stimme

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 Kommentare

Elvin
Elvin am 20 Dez. 2013

Actually, I'm trying to detect three types of plant disease, these are the images.

Bacterial Leaf Blight

Brown Spot

Rice Blast

Should I use the same method (the one you posted above) for the three diseases? Can you show me the methods of detecting each disease.

Thank you very much.

Image Analyst
Image Analyst am 20 Dez. 2013
Yes. The delta E will detect all color differences. Once you have identified the spots that are not green, you can do analysis of them to determine which disease they are based on their color, pattern, or whatever is it that distinguishes one disease from another.
Elvin
Elvin am 21 Dez. 2013
I'm confused again. I have the ff questions:
1. I'd first define a mean green color. Then convert to lab color space and calculate a delta E image
- What do you mean by "define a mean green color"? Also, how will I be able to get the delta E of the image if I only have one LAB channels?
2. Note, you cannot use automatic thresholding...
- Can you show me how to do it manually? I never used thresholding before.
3. Once you have identified the spots that are not green, you can do analysis of them to determine which disease they are based on their color, pattern, or whatever is it that distinguishes one disease from another.
- Can you suggest an analysis for identifying the disease?
Um, kind of looks like you're wanting me to write the whole app for you. I'll give you some pointers - that's all I have time for.
1. Convert to lab color space. Then you need to define a "healthy" or "normal" green. Try looking at a leaf with no disease and finding out what the mean LAB is. Then calculate the delta L, deltaA and deltaB for every pixel in the image to that reference green. Square them add them and take square root to get the delta E. You will get a monochrome image where high values are disease and low values are normal healthy tissue.
2. Threshold at some value, like 5 or something
diseasedPixels = deltaEImage > 5; % a binary image of diseased areas.
3. I don't know what the different diseases are. Maybe some give white spots and some give red spots. Or some give round spots and some give slivers. I don't know but I think you must know what is different. All diseases don't look the same do they? If not, then identify what is different and measure that.
Elvin
Elvin am 21 Dez. 2013
1. First I need to mask the leaf part only for more accuracy right? I have this code in my nitrogen before:
LeafImage = imread('test1.jpg');
leaf_mask = LeafImage(:,:,2) > 32;
will that mask only the green part of the leaf or it will also include the brown/white spot present on the leaf?
2. thanks for that. I'll try it.
3. Do you think shape detection is enough for this?
Image Analyst
Image Analyst am 21 Dez. 2013
1. That could work. Try it and see. 3. I have no idea. Could be color, could be texture, could be shape, could be size. You're the one with the different disease images, not me, so I have no idea. I would think you would know. What do you see that is different between the different diseases?
Elvin
Elvin am 21 Dez. 2013
Bearbeitet: Elvin am 21 Dez. 2013
1. The code for masking works only for green. The leaf contains also different color such as brown and white. How should I mask the leaf containing all the colors present in the leaf?
Can I just compare the histograms for identifying the disease?
Image Analyst
Image Analyst am 21 Dez. 2013
It should work for any color channel, as long as that color channel's pixels are brighter than 32. If you get holes, then call imfill(binaryImage, 'holes'); or bwareaopen().
Elvin
Elvin am 21 Dez. 2013
I tried the imfill but there are still holes in my mask.
By the way, what do you mean by * You will get a monochrome image where high values are disease and low values are normal healthy tissue*? When I tried using imshow(deltaE), I've got nothing. I've tried the method of getting the deltaE of a healthy leaf and a diseased leaf. What's next with that?
Try
imshow(deltaE,[])
Elvin
Elvin am 21 Dez. 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 am 21 Dez. 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.
You need to do an element by element squaring:
deltaE = sqrt(deltaL.^2 + deltaA.^2 + deltaB.^2);

Melden Sie sich an, um zu kommentieren.

sai rama krishna gondela
sai rama krishna gondela am 25 Mär. 2015

0 Stimmen

can any one write complete program for brown spots or tthe above program is itself correct

1 Kommentar

Image Analyst
Image Analyst am 25 Mär. 2015
Probably. And I think you're one of those people.

Melden Sie sich an, um zu kommentieren.

Kameshwar Pramanik
Kameshwar Pramanik am 27 Nov. 2015

0 Stimmen

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 Kommentare

Image Analyst
Image Analyst am 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 am 2 Mär. 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.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Agriculture finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 20 Dez. 2013

Kommentiert:

am 2 Mär. 2017

Community Treasure Hunt

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

Start Hunting!

Translated by