File Exchange

image thumbnail

Plant Disease Classification

version (263 KB) by Manu BN
A Matlab code to classify the type of disease using SVM


Updated 26 Jan 2016

View License

A Matlab code is written to classify the type of disease affected leaf. Here I have considered two different types of diseases, i.e 'Anthranose' & 'Blackspot'. Segmentation of the disease affected area was performed by K means clustering. Over 13 different statistical and texture based features are extracted. Classification is done by SVM.
How to run??
1. Place the 'Disease Analysis' folder in your path
2. Run Classify.m
3. Select a leaf from the 'Disease Dataset' folder.
4. Observe the results of K means clustering.
5. In the dialogue box enter the cluster no containing the disease affected part. (1 or 2 or 3).
6. Observe the results on command window.
Note: This is a semi automatic approach for classification. Suggestion for improvement are always welcome.
A multiclass approach to the same is available in the following link:
Manu B.N

Cite As

Manu BN (2021). Plant Disease Classification (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (25)

Sajitha K.N.

In this code asking for which cluster number want to select. But if we have large dataset then what can we do?

Jack Gridenco


Renuka Baswante

Thank u so much ...but i want only cotton plant disease detection plzz can u send the deta

jouli srikanth

Tqu so much .....???

i have an error in classify, in this code svmStructDisease = svmtrain(diseasefeat,diseasetype);. how to solve it?

Krithika Sasti

how to load N no of image feature extraction value in mat-file or trained image feature extraction value to save

amruta naik

Chen Xiao

Thanks for our code.
From where we can get the data set of leaves images with various diseases?

Azeem Iqbal

I guess everyone is still looking for the procedure to create the dataset of .mat format! Please respond to this very important tutorial. How can I use my own image to create the Accuracy and Training data set using MATLAB?

safa makni

j'ai utilisé je code , je n'ai pas su comment corriger cet erreur , pouvez vous m'aider et merci

Error using kmeans/loopBody (line 418)
An empty cluster error occurred in every replicate.

Error in internal.stats.parallel.smartForReduce (line 128)
reduce = loopbody(iter, S);

Error in kmeans (line 295)
ClusterBest = internal.stats.parallel.smartForReduce(...

Error in Classify (line 30)
[cluster_idx cluster_center] = kmeans(ab,nColors,'distance','sqEuclidean', ...

Bijoy Mohanta

Nicolas Yu

I am not sure how to extract these features?

Manu BN

@ selim: Follow the multiclass approach which uses the same features set

selim hossain

some one could tell me that what is the fist feature in this diseasefeat dataset.

Prathusha Reddy

Nice work

split range

Manu BN

Use Matlab 2013 or higher versions.
Firstly you need to train a multiclass SVM with features from more than 3 classes of leaves.

priya y

i have tried with multisvm code but the following error is occuring. Matlab verson i am using is R2008a.Do i have to install any additional software for this?
??? Maximum recursion limit of 500 reached. Use set(0,'RecursionLimit',N)
to change the limit. Be aware that exceeding your available stack space can
crash MATLAB and/or your computer.

Error in ==> multisvm

Manu BN

My code is a sample one only. It works on 2 types of diseses only.
For more than 2 classes you need to use a multiclass SVM. The code is available on net. Plz search.

priya y

Thank you sir.
But i am working on classifying more than 2 disease.I have tried your code,its working for only 2 types of diseases.So to classify more than 2 diseases,please can u suggest which classifier to use and how to code it.

Manu BN

@ Priya Y: Use the save command in Matlab

priya y

from where do we have to get/download plant disease dataset in.mat form.?

rohit ranjan

need help for this programe

mohammad ghr



hey by using which database software u did Diseaseset mat file.

MATLAB Release Compatibility
Created with R2013a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!

Disease Analysis/