how to calculate the disease severity in percentage.

조회 수: 4 (최근 30일)
Keerthi  D
Keerthi D 2020년 10월 2일
댓글: Keerthi D 2020년 10월 12일
The severity of a disease depends upon the region being covered by an infection.After identifying the test leaf image sample,percentation of a leaf infection can easily be computed as a ratio of the number of infected pixels is to the number of healthy pixels in the leaf image.
A=(sum of Ai/ AL)*100
Ai is the number of infected image pixels in cluster i(i=1,2,3) and AL represent the total number of pixels lying in the extracted ROI of a leaf image.
upto segmentation code is:
fontSize=10;
location='C:\Users\Keerthi Dev\Desktop\50datasample\original';%folder in which your images exists
ds=imageDatastore(location); %create datastore for all images in your folder
new_folder='C:\Users\Keerthi Dev\Desktop\50datasample\after_resized'; %new folder
k=1;
while hasdata(ds)
img=read(ds); %read image from datastore
scale=imresize(img,[256 256]);
fileName=sprintf('image_%d.jpg',k);
fullFileName=fullfile(new_folder,fileName);
imwrite(scale,fullFileName);
%size(scale)
k=k+1;
%lab conversion
labImage = rgb2lab(scale);
ab = labImage(:,:,2:3);
ab = im2single(ab);
%segmentation
nColors = 3; %repeat the clustering 3 times to avoid local minima
pixel_labels = imsegkmeans(ab,nColors,'NumAttempts',3);
%imshow(pixel_labels,[])
%title('Image labeled by cluster Index');
figure;
subplot(1,4,1)
imshow(scale);
title('leaf image');
mask1 = pixel_labels==1;
cluster1 = scale .* uint8(mask1);
subplot(1,4,2);
imshow(cluster1);
title('objects in cluster1');
mask2 = pixel_labels==2;
cluster2 = scale .* uint8(mask2);
subplot(1,4,3);
imshow(cluster2);
title('objects in cluster2');
mask3 = pixel_labels==3;
cluster3 = scale .* uint8(mask3);
subplot(1,4,4);
imshow(cluster3);
title('objects in cluster3');
end
how to calculate the disease severity?
  댓글 수: 2
Harsh Parikh
Harsh Parikh 2020년 10월 5일
Hi,
I believe the three cluster variables are 'cluster1', 'cluster2' and 'cluster3'.
Depending on the criteria for a pixel to be considered as 'infected' you can use the following piece of code: (I have, as an example, taken the pixel intensity <10, to be considered as an infected pixel.)
cluster1_infected = length(nonzeros(cluster1<10));
cluster2_infected = length(nonzeros(cluster2<10));
cluster3_infected = length(nonzeros(cluster3<10));
disease_severity = ((cluster1_infected+cluster2_infected+cluster3_infected)/(numel(cluster1)+numel(cluster2)+numel(cluster3)))*100
You can change the equations of clusterX_infected according to your need.
Keerthi  D
Keerthi D 2020년 10월 12일
When I try this code, healthy leaf also have disease severity. How is it possible?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Agriculture에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by