You are on page 1of 34

PLANT DISEASES

IDENTIFICATION USING IMAGE


PROCESSING (MATLAB)
Dr.K.Vasanth
Associate Professor
Department of Electronics and Communication
Chaitanya Bharathi Institute of Technology
Hyderabad – 75, Telangana
What Do we Learn in This Course

• Diseases in Plants
• Fungus in Plants
• Why Image processing?
• Dataset image processing
• Image processing flow as case study
• Sample disease identification in Leafs
DISEASES in PLANTS

• A plant is considered to be • The signs of plant diseases include

susceptible to infection if – Wilting spotting (necrosis)


environmental factors alter its – mold
physiological processes thus – Pustules
resulting in a disrupted – Rot
structure, growth, functions, – hypertrophy and hyperplasia
or other parameters. (overgrowth)
– Deformation
– Mummification
– Discoloration
– Destruction of the affected tissue.
DISEASES IN LEAFS

• Parasitic Disease
Plant – Diseases caused by various types
Disease of pathogenic microbes such as
nature of a causative agent moulds, fungi, bacteria, virus,
mycoplasma like organisms
(MLO), nematode, etc.
Non
Infectious
infectious
Not spreading
one susceptible host to from non health
another, Plant to healthy
plant
FUNGUS IN LEAF

• Alternaria • Bacterial
alternata is a • Anthracnose is a blight irregular
fungus causing fungal diseases brown spots,
leaf spots, rots, that typically often beginning
and blights on cause dark on the leaf
many plant parts, lesions on leaves. margins
and other
diseases. Cercospora leaf spot symptoms
are primarily circular lesions
with a white center on pepper
Problems with Existing Technique

• Lack of Early Detection


• Subjectivity and Variability of symptoms
• Time consuming – Manual Identification
• Limited sensitivity – Not visible to human eyes
• Weather and Environmental Factors affecting
Accuracy
• Interaction with other factors – same symptoms for
nutrient deficiency etc.,
WHY IMAGING IN AGRICULTURE

• Imaging provides solutions for


– monitoring field crops
– within-field variability regarding
• crop health status
• weed detection
• yield monitoring

https://www.mdpi.com/journal/agronomy/special_issues/Imaging_crops#:~:text=In%20particular%2C%20satellite%20and%20drone,weed%20dete
ction%20and%20yield%20monitoring.
Image processing to computer vision

The continuum from image processing to computer vision can be


broken up into low-, mid- and high-level processes

Low Level Process Mid Level Process High Level Process


Input: Image Input: Attributes
Input: Image
Output: Image Output: Understanding
Output: Attributes

Examples: Noise Examples: Scene


Examples: Object
removal, image understanding,
recognition,
sharpening autonomous navigation
segmentation
DATASET IN IMAGES

• Image datasets help • PlantVillage Datasets


algorithms learn to • FungiDB
identify and recognize • Stanford Drone Dataset
information in images
and perform related • UCI ML Repository -
cognitive activities. Pima Indians Diabetes
Database
• Kaggle
WORK FLOW

Image Image Image Feature


Clustering
Acquisition Preprocessing Segmentation Extraction

Detection &
Classification
of Disease
Image acquisition

• The images of the plant leaf are captured through the


camera.
• This image is in RGB (Red, Green And Blue) form.
• The RGB Image is obtained using a VGA Camera

eg., graphics programs and color monitors


Image Enhancement – Histogram
equilization
Consider an Example
• The Contrast of the image is
poor while acquiring the
image
• Hence Histogram
equalization is used to
enhance the contrast of an
image
Image Segmentation – Otsu Method

• Otsu's method automatically • The infected leaf shows the symptoms


defines the threshold value of the disease by changing the color of
of the image. the leaf. Hence the greenness of the
• The method assumes that the leaves can be used for the detection of
image has a background and the infected portion of the leaf.
a foreground where it • The threshold is calculated using the
minimizes the intra-class Otsu’s method.
variance and maximizes the • Then the green pixels is masked and
inter-class variance between removed if the green pixel intensities
the two. are less than the computed threshold.
Color Model Conversion

Conversion of RGB to HIS Color model • HIS Color Model


HUE : Angle of measure on Colour Wheel

Intensity: Overall brightness of a color

Saturation: Measure of Color’s Purity


Feature Extraction - Texture

Color co-occurrence Method : • Texture Calculation Using GLCM


• Convert RGB Image into HIS Image • GLCM is Gray level Co-occurrence
• Features Considered are color and Matrix
texture for that image. • four texture features calculated
• Texture: Measure of Spatial from the GLCM,
Arrangement of Color Intensities in a – Homogeneity
Image region – Contrast
– entropy
– Angular Second Moment (ASM).
Homogeneity gives a measure of the similarity in the image.
Contrast is a measure of the local variations present in an image
Entropy is a statistical measure of randomness.
ASM uniformity of distribution of grey level in the image
Feature Extraction - Color

• Texture Calculation Using Lab space


• Convert RGB Image into HIS Image Color Model
• Features Considered are color and • L: describes the lightness of the color,
texture for that image. used interchangeably with intensity
• Color: Hue and saturation together • A: color component ranging from
are called chromaticity. A color can Green to Magenta
be described in terms of its brightness
• B: color component ranging from
and chromaticity.
Blue to Yellow
HSV (Hue-Saturation-Value)
•Hue: describes the dominant wavelength and is the
channel to specify the color
•Saturation: describes the purity/shades of the hue/color
•Value: describes the intensity of the color
Clustering – for Grouping of Likelihood data

• To divide the population or


set of data points into a
number of groups so that the
data points within each group
are more comparable to one
another and different from
the data points within the
other groups.
• The Image has got disease or
not is done in this section
Neural Networks

Sample Neural network Back Propagation Network

This method helps calculate the gradient of a loss


function with respect to all the weights in the
network.

https://www.guru99.com/backpropogation-neural-network.html
Support Vector Machine (SVM)

• Support Vector Machine (SVM) is a supervised machine learning algorithm


used for both classification and regression.
• The main objective of the SVM algorithm is to find the
optimal hyperplane in an N-dimensional space that can separate the data
points in different classes in the feature space.
• The hyperplane tries that the margin between the closest points of different
classes should be as maximum as possible.
• The dimension of the hyperplane depends upon the number of features.
• If the number of input features is two, then the hyperplane is just a line. If
the number of input features is three, then the hyperplane becomes a 2-D
plane.
SVM
Overall System Architecture
Outputs

Image Console Loading acquired Image Image Enhancement

Image Segmentation Features Obtained Classified Fungus in Leaf


THANK YOU
MATRIX LABORATORY

MATLAB
ABOUT MATLAB

• MATLAB is a data analysis and visualization


tool which has been designed with powerful
support for matrices and matrix operations
has excellent graphics capabilities, and own
powerful programming language.
• Consist of many tool boxes with numerous
inbuilt functions
• (Eg.) tool Boxes – Image Processing
Signal Processing
MATLAB FUNCTIONS FOR IMAGE
PROCESSING
READ AN IMAGE
SYNTAX:
Variable= imread(‘Image.Extension’) SIZE OF AN IMAGE
Example:
Syntax
c=imread('cameraman.tif');
[row col] = size(variable where image is stored)
DISPLAY AN IMAGE Example
SYNTAX [row col] = size(c)
Figure (number)
imshow(variable where the image is stored)
Example
Figure(1)
imshow(c);
DATA TYPES IN MATLAB
DISPLAYING AN IMAGE

• Imshow(a) • Double
– Displays the image • changes the data type but does not
change the numeric values
• Imshow(a/255)
– Darkens the image ( all the matrix
values between 0 and 0.5) • Im2double
• changes both the numeric data type and
• Imshow(a/128) the values
– Lighten the image ( all the matrix • If image itself is double then im2double
values between 0 and 2) does not have any effect
Plan extraction of Color Images

• Rgb(:,:,1) – Extracts Red plane


• Rgb(:,:,2) – Extracts green Plane
• Rgb(:,:,3) – Extracts blue plane

Color Model Conversion


• rgb2hsi- converts rgb image into HSI image
Image Enhancement –Histogram
equalization
• hist(image_variable) • bar(xaxis, yaxis)
– To find the histogram of an image – To plot output Using bargraph
- The Image variable should be in
single column
Cumsum(image_variable) imadjust(I) maps the intensity
Find the cumulative sum of the values in grayscale image I to new
image variables values in J . This increases the
./ Division operator for array contrast of the output image J.
K Means Clustering

• Kmeans(X,k) – Performs K means clustering to partition


the observation of the n by p data matrix X into k clusters
FEATURE EXTRACTION
• im2bw – converts grayscale image into binary image
• bwconncomp – find the connected components in binary
image
• regionprops – Measures set of properties specified by
properties of each connected components ( Attributes are
area,boundarybox, Eccentricity,perimeter etc.,)
Feature Extraction
TEXTURE FEATURE
• graycomatrix: Creates a gray level co-occurance matrix from
an image
• graycoprops: calculates the statistics specified in attributes (
Contrast, Correlation, Energy, Homogeneity)
SHAPE FEATURE
Makecform: Creates a Color transformation structure that
defines specific color space conversion. ‘srgb2lab’
Applyform: Converts the color values of the given image
to the color space specified in color Transformation
structure in C
SVM( Support vector machine)

• svmtrain: returns a structure containing information


about trained SVM. Kernal functions( Linear, Quadratic,
Polynomial, rbf, mlp)
• Svmclassify: Classifies each row of the data in sample, a
matrix of data using the information in SVM classifier
structure
THANK YOU

You might also like