SlideShare a Scribd company logo
TOMATO
CLASSIFICATION
Presented By:
Raman Pandey(CSJMA12001390146)
Neha Chowdhary(CSJMA12001390136)
B.Tech, 4th Year (Information
Technology)
Introduction
The ability to identify the tomatoes based on quality in the food industry which
is the most important technology in the realization of automatic tomato sorting
machine in order to reduce the work of human and also time consuming.
Automation of quality control is highly significant because saving time and
expenses is always a necessity in industrial applications.
An automated system has to be developed which acquires the images of the
tomatoes and various features would be extracted using Image Processing and
these features would be further used to train machine using some Machine
Learning Algorithm and data would be classified and analyzed and accuracy and
quality of the test data will be determined.
APPLICATIONS USED
 MATLAB :Matlab (MATrix LABoratory) is a multi-
paradigm numerical computing environment and
fourth generation programming language.
 R :R is a language and environment for statistical
computing and graphics.
E1071 and RGL libraries are used for SVM
classification and visualization.
 WEKA :Waikato Environment for Knowledge
Analysis. Weka is a collection of machine learning
algorithms for data mining tasks.
Libsvm package is used to classify data.
Proposed Methodology
ALGORITHM
 Images are acquired by camera with precision of 20 cm from the surface above from
standard scale for calibration.
 Contrast is adjusted for the acquired image.
 Segmentation is performed using Otsu’ segmentation method.
 Histogram of Images are bimodal hence pixel set of each histogram are calculated and
subtracted and the obtained pixel set is used for threshold.
 Mask is generated from threshold level and median filter is applied.
 Morphological erosion and filling operation is performed on the mask to generated finally
binary segmented image.
 Region props is used to calculated features such as centroid, major Axis Length for radius
and this will be used to find volume and area.
Algorithm Continued…
 Gradient weight is used to find the image weight.
 RGB to HSV transformation is applied on the acquired image and threshold level is
calculated for each red , green and blue level and these threshold are used to find
maximum number of pixels of different colors.
 The maximum value of red pixels represents very good quality of tomato and maximum
value of yellow pixels represents good quality of tomato and maximum value of green
pixels represents poor quality of tomato.
 These features data acquired and stored in the database and hence eventually total 145
samples feature data are stored.
 These samples are feed into WEKA for classification.
 SVM Multi class classification of Sequential Marginal Optimization algorithm is used to
classify data.
 70% of the data used for training and 30% is used for testing which generates accuracy of
74%.
Algorithm in Code
 Clear the Workspace;
clc
clear workspace;
 Read and load the image
I=imread('t56.jpg');
figure;
imshow(I)
title('original image')
 Adjust Contrast of blue channel of the Original Image
IL = imadjust(I(:,:,3))
Algorithm in Code
 Get the size and total pixel count of the image
[rows, columns, numberOfColorBands] = size(IL);
[pixelCount, grayLevels] = imhist(IL, 256);
 Divide image in two half and get the total pixel count of the left half image
middleColumn = floor(columns/2);
leftHalfImage = IL(:, 1:middleColumn);
[pixelCountL, grayLevelsL] = imhist(leftHalfImage, 256);
 Get the pixel count of the another half right image
rightHalfImage = IL(:, middleColumn+1:end);
[pixelCountR, grayLevelsR] = imhist(rightHalfImage, 256);
Algorithm in Code
 Subtract the two left and right pixelcount and get the subtracted histogram
diffHistogram = int16(pixelCountL - pixelCountR);
 Create the threshold level of subtracted histogram value. Find Otsu threshold
level
thresholdLevel = 255 * graythresh(diffHistogram)
 Create mask from the threshold level
mask1 = IL > thresholdLevel;
 Apply Median Filter to the Mask
mask2 = medfilt2(mask1)
Algorithm in Code
 Apply Morphological Operation on the mask which will generate segmented Image
SE = strel('disk',2)
mask3 = imerode(mask2,SE)
mask4 = ~imfill(~mask3,'holes')
figure;
imshow(mask4)
title('Segmented Image')
 Get the separate Channels of the Original Image
red = I(:, :, 1)
green = I(:, :, 2)
blue = I(:, :, 3)
 Get the Gradient Weight of the Image
weight = mean2(gradientweight(IL))
Algorithm in Code
 Get the Major Axis Length
radii = regionprops(mask3,'MajorAxisLength')
radii2 = mean2(cat(1,radii.MajorAxisLength))
 Calculate Volume
volume = (4.0/3.0)*pi*(radii2^3)
 Calculate Area
area=4.0*pi*(radii2^2)
 %Convert to HSV Image
hsvImage = rgb2hsv(I)weight = mean2(gradientweight(IL))
Algorithm in Code
 Extract out the H, S, and V images individually
hImage = hsvImage(:,:,1);
sImage = hsvImage(:,:,2);
vImage = hsvImage(:,:,3);
 Threshold for Yellow Color
YhueThresholdLow = 0.10;
YhueThresholdHigh = 0.14;
YsaturationThresholdLow = 0.4;
Algorithm in Code
YsaturationThresholdHigh = 1;
YvalueThresholdLow = 0.8;
YvalueThresholdHigh = 1.0;
 % Now apply each color band's particular thresholds to the color band for
yellow
YhueMask = (hImage >= YhueThresholdLow) & (hImage <= YhueThresholdHigh);
YsaturationMask = (sImage >= YsaturationThresholdLow) & (sImage <=
YsaturationThresholdHigh);
YvalueMask = (vImage >= YvalueThresholdLow) & (vImage <=
YvalueThresholdHigh);
Algorithm in Code
 Smooth the border using a morphological closing operation, imclose().
YstructuringElement = strel('disk', 4);
YcoloredObjectsMask = imclose(YcoloredObjectsMask, YstructuringElement);
 Fill in any holes in the regions, since they are most likely red also.
YcoloredObjectsMask = imfill(logical(YcoloredObjectsMask), 'holes');
YcoloredObjectsMask = cast(YcoloredObjectsMask, 'like', I);
Algorithm in Code
 Use the colored object mask to mask out the colored-only portions of the rgb
image.
YmaskedImageR = YcoloredObjectsMask .* red;
YmaskedImageG = YcoloredObjectsMask .* green;
YmaskedImageB = YcoloredObjectsMask .* blue;
yellowImage = cat(3, YmaskedImageR, YmaskedImageG, YmaskedImageB);
 Yellow Pixel Count
yel = mean2(yellowImage(find(yellowImage)))
Algorithm in Code
 Threshold for Red Color
RhueThresholdLow = 0.03;
RhueThresholdHigh = 1.5;
RsaturationThresholdLow = 0.18;
RsaturationThresholdHigh = 1.5;
RvalueThresholdLow = 0.05;
RvalueThresholdHigh = 1.8;
Algorithm in Code
 Now apply each color band's particular thresholds to the color band for Red
RhueMask = (hImage >= RhueThresholdLow) & (hImage <= RhueThresholdHigh);
RsaturationMask = (sImage >= RsaturationThresholdLow) & (sImage <=
RsaturationThresholdHigh);
RvalueMask = (vImage >= RvalueThresholdLow) & (vImage <=
RvalueThresholdHigh);
RcoloredObjectsMask = uint8(RhueMask & RsaturationMask & RvalueMask);
RstructuringElement = strel('disk', 4);
RcoloredObjectsMask = imclose(RcoloredObjectsMask, RstructuringElement);
Algorithm in Code
 Fill in any holes in the regions, since they are most likely red also.
RcoloredObjectsMask = imfill(logical(RcoloredObjectsMask), 'holes');
RcoloredObjectsMask = cast(RcoloredObjectsMask, 'like', I);
 Use the colored object mask to mask out the colored-only portions of the rgb
image.
RmaskedImageR = RcoloredObjectsMask .* red;
RmaskedImageG = RcoloredObjectsMask .* green;
RmaskedImageB = RcoloredObjectsMask .* blue;
redImage = cat(3, RmaskedImageR, RmaskedImageG, RmaskedImageB);
 Red Pixel Count
rel = mean2(redImage(find(redImage)))
Algorithm in Code
 Threshold for Green Color
GhueThresholdLow = 0.15;
GhueThresholdHigh = 0.60;
GsaturationThresholdLow = 0.36;
GsaturationThresholdHigh = 1;
GvalueThresholdLow = 0;
GvalueThresholdHigh = 0.8;
Algorithm in Code
 Now apply each color band's particular thresholds to the color band for Green
GhueMask = (hImage >= GhueThresholdLow) & (hImage <= GhueThresholdHigh);
GsaturationMask = (sImage >= GsaturationThresholdLow) & (sImage <=
GsaturationThresholdHigh);
GvalueMask = (vImage >= GvalueThresholdLow) & (vImage <=
GvalueThresholdHigh);
GcoloredObjectsMask = uint8(GhueMask & GsaturationMask & GvalueMask);
GstructuringElement = strel('disk', 4);
GcoloredObjectsMask = imclose(GcoloredObjectsMask, GstructuringElement);
Algorithm in Code
 Fill in any holes in the regions, since they are most likely red also.
GcoloredObjectsMask = imfill(logical(GcoloredObjectsMask), 'holes');
GcoloredObjectsMask = cast(GcoloredObjectsMask, 'like', I);
 Use the colored object mask to mask out the colored-only portions of the rgb
image.
GmaskedImageR = GcoloredObjectsMask .* red;
GmaskedImageG = GcoloredObjectsMask .* green;
GmaskedImageB = GcoloredObjectsMask .* blue;
greenImage = cat(3, GmaskedImageR, GmaskedImageG, GmaskedImageB);
 Green Pixel Count
gel = mean2(greenImage(find(greenImage)))
Algorithm in Code
 Find the Maximum Number of Pixels to determine the ripeness
ripe = max([yel rel gel])
if ripe == yel
ripeVal = 'Yellow'
else if ripe == rel
ripeVal = 'Red'
else if ripe == gel
ripeVal = 'Green'
else
ripeVal = 'Undefined'
end
end
end
 % Store Values in Local Database
data = [radii2,area,volume,weight,centroidxavg,centroidyavg,rel,gel,yel,ripeVal]
dlmwrite('test.csv',data,'delimiter',',','-append');
R Code
 Load Required Library
require(e1071) #For SVM
require(rgl) #For 3 D Plotting
 Load Data Set
FeaturesTrainingData <- read.csv("G:/8th sem/BTP Tomato Complete
Sample/FinalBTPGUI/FeaturesTrainingData.csv")
View(FeaturesTrainingData)
 Create Data Frame from Training Data
ftd <-
data.frame(R=FeaturesTrainingData$Radius,A=FeaturesTrainingData$Area,V=FeaturesT
rainingData$Volume,W=FeaturesTrainingData$Weight,C=FeaturesTrainingData$Class)
View(ftd)
R Code
 Create SVM Model
svm_model <- svm(C~., ftd, type='C-classification', kernel='linear',scale=FALSE)
w <- t(svm_model$coefs) %*% svm_model$SV
 Visualizing the Hyperplane and Support Vectors
detalization <- 100
grid <- expand.grid(seq(from=min(ftd$R),to=max(ftd$R),length.out=detalization),
+ +
seq(from=min(ftd$A),to=max(ftd$A),length.out=detalization))
z <- (svm_model$rho- w[1,1]*grid[,1] - w[1,2]*grid[,2]) / w[1,3]
plot3d(grid[,1],grid[,2],z, xlab="PC1 (72%)", ylab="PC2 (19%)", zlab="PC3 (7%)", col="pink")
spheres3d(ftd$R[which(ftd$C=='A')], ftd$A[which(ftd$C=='A')], ftd$V[which(ftd$C == 'A')],
col='red',type="s",radius=0.01)
spheres3d(ftd$R[which(ftd$C=='B')], ftd$A[which(ftd$C=='B')], ftd$V[which(ftd$C == 'B')],
col='blue',type="s",radius=0.01)
Result
A B C
14 0 2
5 0 0
4 0 18
Accuracy %age : 74.42%
Confusion Matrix
Summary
Correctly Classified Instances 32
Incorrectly Classified Instances 11
Kappa statistics 0.5456
Mean Absolute Error 0.2946
RMS Error 0.3827
Relative Absolute Error 72.7541 %
Root relative squared Error 84.8467 %
Main Application GUI
Loading the Image
Segmentation of Image
Features Extraction
DATA SETS
Loading Data for Classification
Performing Classification
3 D SVM HyperPlane
CONCLUSION AND RESULTS
 In this automated system, we have developed a methodology which identifies
and detect tomato ripeness and its quality based on an image processing
algorithm followed by classification process. In the algorithm, tomatoes
images are acquired via different perspectives and preprocessed and
segmented.And after segmentation process, five features are extracted such
as area,volume,weight,radius,perimeter and ripeness.The real value of
features of tomatoes are calculated such as volume using Archimedes
Principle and weight using weighing machine.
 In classification process, SVM is used with multi-class classification in
WEKA.We provided the training data in WEKA and Weka calculated SVM
accuracy of 74.41% and classified into three classes named A, B and C which
represent quality class of very good, good and poor respectively.
Future Scope
 The future scope of this Automated Application is in the industry of harvest
engineering and Automated Agriculture.
 This Automated Application will be helpful for easing of Supply Chain Management.
 This Application is used to detection of bad quality tomatotes using Computer
Vision.
 It is also used to analyzed remote sensing data for farming purpose and large scale
control production.
 Image processing technique has been proved as effective machine vision
system for agriculture domain. we can conclude that image processing was
the non invasive and effective tool that can be applied for the
agriculture domain with great accuracy for analysis of agronomic
parameters.
References
 Rafael C.Gonzalez and Richard E. woods, “Digital Image Processing”, Pearson
Education, Second Edition,2005
 A simple method for removing reflection and distortion from a single
image.[IJEIT]
 Recognition and localization of ripen tomato based on machine vision.[AICS]
 Noise removal and enhancement of binary images using morphological
operations.
 Tomato classification and sorting with machine vision using SVM,MLP and
LVQ.[IJACS]
THANK YOU!!!

More Related Content

What's hot

EDM
EDMEDM
Types of road material and its tests
Types of road material and its testsTypes of road material and its tests
Types of road material and its tests
Govt, Polytechnic Tekari, Gaya
 
Contouring
ContouringContouring
Contouring
GAURAV. H .TANDON
 
Rendering Algorithms.pptx
Rendering Algorithms.pptxRendering Algorithms.pptx
Rendering Algorithms.pptx
SherinRappai
 
Concrete Mix Design 10262-2019.pptx
Concrete Mix Design 10262-2019.pptxConcrete Mix Design 10262-2019.pptx
Concrete Mix Design 10262-2019.pptx
Sunil Jha
 
Asphalt rubber pavement
Asphalt rubber pavementAsphalt rubber pavement
Asphalt rubber pavement
SUPREETH Suppi
 
Aluminium composite panels(acp)
Aluminium composite panels(acp)Aluminium composite panels(acp)
Aluminium composite panels(acp)Parivesh Sharma
 
steel ppt.pdf
steel ppt.pdfsteel ppt.pdf
steel ppt.pdf
H20021
 
Drainage
DrainageDrainage
Drainage
Rajiva Gupta
 
Notes 2D-Transformation Unit 2 Computer graphics
Notes 2D-Transformation Unit 2 Computer graphicsNotes 2D-Transformation Unit 2 Computer graphics
Notes 2D-Transformation Unit 2 Computer graphics
NANDINI SHARMA
 
Welcome to the presentation on ‘total station
Welcome to the presentation on ‘total stationWelcome to the presentation on ‘total station
Welcome to the presentation on ‘total stationShashank Javalagi
 
Introduction to computer graphics part 1
Introduction to computer graphics part 1Introduction to computer graphics part 1
Introduction to computer graphics part 1
Ankit Garg
 
ENERGY INTERACTIONS WITH EARTH SURFACE FEATURES
 ENERGY INTERACTIONS WITH EARTH SURFACE FEATURES  ENERGY INTERACTIONS WITH EARTH SURFACE FEATURES
ENERGY INTERACTIONS WITH EARTH SURFACE FEATURES
diponnath
 
Room acoustics and sound absorption materials
Room acoustics and sound absorption materialsRoom acoustics and sound absorption materials
Room acoustics and sound absorption materials
Pankaj Kumar
 
lecture4 raster details in computer graphics(Computer graphics tutorials)
lecture4 raster details in computer graphics(Computer graphics tutorials)lecture4 raster details in computer graphics(Computer graphics tutorials)
lecture4 raster details in computer graphics(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
1. New Land Acquisition Act Process Flow
1. New Land Acquisition Act Process Flow1. New Land Acquisition Act Process Flow
1. New Land Acquisition Act Process Flow
Home , Individual
 
Sokkia Total station setup and operation
Sokkia Total station setup and operationSokkia Total station setup and operation
Sokkia Total station setup and operation
Charitha Seneviratne
 
Random and raster scan
Random and raster scanRandom and raster scan
Random and raster scan
ankur bhalla
 
Total station
Total stationTotal station
Total stationlbbinh
 
Factors affecting the strenght of concrete
Factors affecting the strenght of concreteFactors affecting the strenght of concrete
Factors affecting the strenght of concrete
MUBARAKALI111
 

What's hot (20)

EDM
EDMEDM
EDM
 
Types of road material and its tests
Types of road material and its testsTypes of road material and its tests
Types of road material and its tests
 
Contouring
ContouringContouring
Contouring
 
Rendering Algorithms.pptx
Rendering Algorithms.pptxRendering Algorithms.pptx
Rendering Algorithms.pptx
 
Concrete Mix Design 10262-2019.pptx
Concrete Mix Design 10262-2019.pptxConcrete Mix Design 10262-2019.pptx
Concrete Mix Design 10262-2019.pptx
 
Asphalt rubber pavement
Asphalt rubber pavementAsphalt rubber pavement
Asphalt rubber pavement
 
Aluminium composite panels(acp)
Aluminium composite panels(acp)Aluminium composite panels(acp)
Aluminium composite panels(acp)
 
steel ppt.pdf
steel ppt.pdfsteel ppt.pdf
steel ppt.pdf
 
Drainage
DrainageDrainage
Drainage
 
Notes 2D-Transformation Unit 2 Computer graphics
Notes 2D-Transformation Unit 2 Computer graphicsNotes 2D-Transformation Unit 2 Computer graphics
Notes 2D-Transformation Unit 2 Computer graphics
 
Welcome to the presentation on ‘total station
Welcome to the presentation on ‘total stationWelcome to the presentation on ‘total station
Welcome to the presentation on ‘total station
 
Introduction to computer graphics part 1
Introduction to computer graphics part 1Introduction to computer graphics part 1
Introduction to computer graphics part 1
 
ENERGY INTERACTIONS WITH EARTH SURFACE FEATURES
 ENERGY INTERACTIONS WITH EARTH SURFACE FEATURES  ENERGY INTERACTIONS WITH EARTH SURFACE FEATURES
ENERGY INTERACTIONS WITH EARTH SURFACE FEATURES
 
Room acoustics and sound absorption materials
Room acoustics and sound absorption materialsRoom acoustics and sound absorption materials
Room acoustics and sound absorption materials
 
lecture4 raster details in computer graphics(Computer graphics tutorials)
lecture4 raster details in computer graphics(Computer graphics tutorials)lecture4 raster details in computer graphics(Computer graphics tutorials)
lecture4 raster details in computer graphics(Computer graphics tutorials)
 
1. New Land Acquisition Act Process Flow
1. New Land Acquisition Act Process Flow1. New Land Acquisition Act Process Flow
1. New Land Acquisition Act Process Flow
 
Sokkia Total station setup and operation
Sokkia Total station setup and operationSokkia Total station setup and operation
Sokkia Total station setup and operation
 
Random and raster scan
Random and raster scanRandom and raster scan
Random and raster scan
 
Total station
Total stationTotal station
Total station
 
Factors affecting the strenght of concrete
Factors affecting the strenght of concreteFactors affecting the strenght of concrete
Factors affecting the strenght of concrete
 

Viewers also liked

GSM Based Device Controlling and Fault Detection
GSM Based Device Controlling and Fault DetectionGSM Based Device Controlling and Fault Detection
GSM Based Device Controlling and Fault Detection
IJCERT
 
Flower Classification Using Neural Network Based Image Processing
Flower Classification Using Neural Network Based Image ProcessingFlower Classification Using Neural Network Based Image Processing
Flower Classification Using Neural Network Based Image Processing
IOSR Journals
 
A supervised lung nodule classification method using patch based context anal...
A supervised lung nodule classification method using patch based context anal...A supervised lung nodule classification method using patch based context anal...
A supervised lung nodule classification method using patch based context anal...
ASWATHY VG
 
Application of Image processing in Defect Detection of PCB by Jeevan B M
Application of Image processing in Defect Detection of PCB by Jeevan B MApplication of Image processing in Defect Detection of PCB by Jeevan B M
Application of Image processing in Defect Detection of PCB by Jeevan B MJeevan B M
 
Indian cricket team
Indian cricket  teamIndian cricket  team
Indian cricket team
Padma Lalitha
 
Support Vector Machine(SVM) with Iris and Mushroom Dataset
Support Vector Machine(SVM) with Iris and Mushroom DatasetSupport Vector Machine(SVM) with Iris and Mushroom Dataset
Support Vector Machine(SVM) with Iris and Mushroom Dataset
Pawandeep Kaur
 
Digital image classification
Digital image classificationDigital image classification
Digital image classification
Aleemuddin Abbasi
 
A project report on Remote Monitoring of a Power Station using GSM and Arduino
A project report on Remote Monitoring of a Power Station using GSM and ArduinoA project report on Remote Monitoring of a Power Station using GSM and Arduino
A project report on Remote Monitoring of a Power Station using GSM and Arduino
Jawwad Sadiq Ayon
 
MY PROJECT-automatic load sharing of transformer by using GSM tecnique.
MY PROJECT-automatic load sharing of transformer by using GSM tecnique.MY PROJECT-automatic load sharing of transformer by using GSM tecnique.
MY PROJECT-automatic load sharing of transformer by using GSM tecnique.nikhilhiware
 
traffic jam detection using image processing
traffic jam detection using image processingtraffic jam detection using image processing
traffic jam detection using image processingMalika Alix
 
Vehicle detection through image processing
Vehicle detection through image processingVehicle detection through image processing
Vehicle detection through image processingGhazalpreet Kaur
 
Face recognition using neural network
Face recognition using neural networkFace recognition using neural network
Face recognition using neural networkIndira Nayak
 
Image Classification And Support Vector Machine
Image Classification And Support Vector MachineImage Classification And Support Vector Machine
Image Classification And Support Vector MachineShao-Chuan Wang
 
Final Project presentation on Image processing based intelligent traffic cont...
Final Project presentation on Image processing based intelligent traffic cont...Final Project presentation on Image processing based intelligent traffic cont...
Final Project presentation on Image processing based intelligent traffic cont...
Louise Antonio
 
Bangladesh Cricket Team
Bangladesh Cricket TeamBangladesh Cricket Team
Bangladesh Cricket Team
Shaikat Saha
 
Deep Learning for Computer Vision: Medical Imaging (UPC 2016)
Deep Learning for Computer Vision: Medical Imaging (UPC 2016)Deep Learning for Computer Vision: Medical Imaging (UPC 2016)
Deep Learning for Computer Vision: Medical Imaging (UPC 2016)
Universitat Politècnica de Catalunya
 
Deep Learning for Computer Vision: Segmentation (UPC 2016)
Deep Learning for Computer Vision: Segmentation (UPC 2016)Deep Learning for Computer Vision: Segmentation (UPC 2016)
Deep Learning for Computer Vision: Segmentation (UPC 2016)
Universitat Politècnica de Catalunya
 
Apple iPhone 7 Plus: Rear-Facing Dual Camera Module 2016 teardown reverse cos...
Apple iPhone 7 Plus: Rear-Facing Dual Camera Module 2016 teardown reverse cos...Apple iPhone 7 Plus: Rear-Facing Dual Camera Module 2016 teardown reverse cos...
Apple iPhone 7 Plus: Rear-Facing Dual Camera Module 2016 teardown reverse cos...
Yole Developpement
 
Final Project Report on Image processing based intelligent traffic control sy...
Final Project Report on Image processing based intelligent traffic control sy...Final Project Report on Image processing based intelligent traffic control sy...
Final Project Report on Image processing based intelligent traffic control sy...
Louise Antonio
 

Viewers also liked (20)

CBIR MIni project2
CBIR MIni project2CBIR MIni project2
CBIR MIni project2
 
GSM Based Device Controlling and Fault Detection
GSM Based Device Controlling and Fault DetectionGSM Based Device Controlling and Fault Detection
GSM Based Device Controlling and Fault Detection
 
Flower Classification Using Neural Network Based Image Processing
Flower Classification Using Neural Network Based Image ProcessingFlower Classification Using Neural Network Based Image Processing
Flower Classification Using Neural Network Based Image Processing
 
A supervised lung nodule classification method using patch based context anal...
A supervised lung nodule classification method using patch based context anal...A supervised lung nodule classification method using patch based context anal...
A supervised lung nodule classification method using patch based context anal...
 
Application of Image processing in Defect Detection of PCB by Jeevan B M
Application of Image processing in Defect Detection of PCB by Jeevan B MApplication of Image processing in Defect Detection of PCB by Jeevan B M
Application of Image processing in Defect Detection of PCB by Jeevan B M
 
Indian cricket team
Indian cricket  teamIndian cricket  team
Indian cricket team
 
Support Vector Machine(SVM) with Iris and Mushroom Dataset
Support Vector Machine(SVM) with Iris and Mushroom DatasetSupport Vector Machine(SVM) with Iris and Mushroom Dataset
Support Vector Machine(SVM) with Iris and Mushroom Dataset
 
Digital image classification
Digital image classificationDigital image classification
Digital image classification
 
A project report on Remote Monitoring of a Power Station using GSM and Arduino
A project report on Remote Monitoring of a Power Station using GSM and ArduinoA project report on Remote Monitoring of a Power Station using GSM and Arduino
A project report on Remote Monitoring of a Power Station using GSM and Arduino
 
MY PROJECT-automatic load sharing of transformer by using GSM tecnique.
MY PROJECT-automatic load sharing of transformer by using GSM tecnique.MY PROJECT-automatic load sharing of transformer by using GSM tecnique.
MY PROJECT-automatic load sharing of transformer by using GSM tecnique.
 
traffic jam detection using image processing
traffic jam detection using image processingtraffic jam detection using image processing
traffic jam detection using image processing
 
Vehicle detection through image processing
Vehicle detection through image processingVehicle detection through image processing
Vehicle detection through image processing
 
Face recognition using neural network
Face recognition using neural networkFace recognition using neural network
Face recognition using neural network
 
Image Classification And Support Vector Machine
Image Classification And Support Vector MachineImage Classification And Support Vector Machine
Image Classification And Support Vector Machine
 
Final Project presentation on Image processing based intelligent traffic cont...
Final Project presentation on Image processing based intelligent traffic cont...Final Project presentation on Image processing based intelligent traffic cont...
Final Project presentation on Image processing based intelligent traffic cont...
 
Bangladesh Cricket Team
Bangladesh Cricket TeamBangladesh Cricket Team
Bangladesh Cricket Team
 
Deep Learning for Computer Vision: Medical Imaging (UPC 2016)
Deep Learning for Computer Vision: Medical Imaging (UPC 2016)Deep Learning for Computer Vision: Medical Imaging (UPC 2016)
Deep Learning for Computer Vision: Medical Imaging (UPC 2016)
 
Deep Learning for Computer Vision: Segmentation (UPC 2016)
Deep Learning for Computer Vision: Segmentation (UPC 2016)Deep Learning for Computer Vision: Segmentation (UPC 2016)
Deep Learning for Computer Vision: Segmentation (UPC 2016)
 
Apple iPhone 7 Plus: Rear-Facing Dual Camera Module 2016 teardown reverse cos...
Apple iPhone 7 Plus: Rear-Facing Dual Camera Module 2016 teardown reverse cos...Apple iPhone 7 Plus: Rear-Facing Dual Camera Module 2016 teardown reverse cos...
Apple iPhone 7 Plus: Rear-Facing Dual Camera Module 2016 teardown reverse cos...
 
Final Project Report on Image processing based intelligent traffic control sy...
Final Project Report on Image processing based intelligent traffic control sy...Final Project Report on Image processing based intelligent traffic control sy...
Final Project Report on Image processing based intelligent traffic control sy...
 

Similar to Tomato Classification using Computer Vision

Image processing using matlab
Image processing using matlab Image processing using matlab
Image processing using matlab
SangeethaSasi1
 
Image Processing using Matlab . Useful for beginners to learn Image Processing
Image Processing using Matlab . Useful for beginners to learn Image ProcessingImage Processing using Matlab . Useful for beginners to learn Image Processing
Image Processing using Matlab . Useful for beginners to learn Image Processing
Ashok Kumar
 
Android based application for graph analysis final report
Android based application for graph analysis final reportAndroid based application for graph analysis final report
Android based application for graph analysis final report
Pallab Sarkar
 
Digital Image Processing (Lab 07)
Digital Image Processing (Lab 07)Digital Image Processing (Lab 07)
Digital Image Processing (Lab 07)
Moe Moe Myint
 
Client Side Programming with Applet
Client Side Programming with AppletClient Side Programming with Applet
Client Side Programming with Appletbackdoor
 
Performance Anaysis for Imaging System
Performance Anaysis for Imaging SystemPerformance Anaysis for Imaging System
Performance Anaysis for Imaging System
Vrushali Lanjewar
 
Image processing
Image processingImage processing
Image processingmaheshpene
 
C Graphics Functions
C Graphics FunctionsC Graphics Functions
C Graphics Functions
SHAKOOR AB
 
Traffic sign detection via graph based ranking and segmentation
Traffic sign detection via graph based ranking and segmentationTraffic sign detection via graph based ranking and segmentation
Traffic sign detection via graph based ranking and segmentation
PREMSAI CHEEDELLA
 
05 contours seg_matching
05 contours seg_matching05 contours seg_matching
05 contours seg_matching
ankit_ppt
 
Graphics in C++
Graphics in C++Graphics in C++
Graphics in C++
Ahsan Mughal
 
Computer graphics
Computer graphics Computer graphics
Computer graphics
shafiq sangi
 
ImageProcessingWithMatlab(HasithaEdiriweera)
ImageProcessingWithMatlab(HasithaEdiriweera)ImageProcessingWithMatlab(HasithaEdiriweera)
ImageProcessingWithMatlab(HasithaEdiriweera)Hasitha Ediriweera
 
IRJET- 3D Vision System using Calibrated Stereo Camera
IRJET- 3D Vision System using Calibrated Stereo CameraIRJET- 3D Vision System using Calibrated Stereo Camera
IRJET- 3D Vision System using Calibrated Stereo Camera
IRJET Journal
 
Circles graphic
Circles graphicCircles graphic
Circles graphic
alldesign
 
Performance analysis of transformation and bogdonov chaotic substitution base...
Performance analysis of transformation and bogdonov chaotic substitution base...Performance analysis of transformation and bogdonov chaotic substitution base...
Performance analysis of transformation and bogdonov chaotic substitution base...
IJECEIAES
 
Image processing with matlab
Image processing with matlabImage processing with matlab
Image processing with matlab
Aman Gupta
 
maxbox starter60 machine learning
maxbox starter60 machine learningmaxbox starter60 machine learning
maxbox starter60 machine learning
Max Kleiner
 
BMVA summer school MATLAB programming tutorial
BMVA summer school MATLAB programming tutorialBMVA summer school MATLAB programming tutorial
BMVA summer school MATLAB programming tutorial
potaters
 

Similar to Tomato Classification using Computer Vision (20)

Image processing using matlab
Image processing using matlab Image processing using matlab
Image processing using matlab
 
Image Processing using Matlab . Useful for beginners to learn Image Processing
Image Processing using Matlab . Useful for beginners to learn Image ProcessingImage Processing using Matlab . Useful for beginners to learn Image Processing
Image Processing using Matlab . Useful for beginners to learn Image Processing
 
Android based application for graph analysis final report
Android based application for graph analysis final reportAndroid based application for graph analysis final report
Android based application for graph analysis final report
 
Digital Image Processing (Lab 07)
Digital Image Processing (Lab 07)Digital Image Processing (Lab 07)
Digital Image Processing (Lab 07)
 
Client Side Programming with Applet
Client Side Programming with AppletClient Side Programming with Applet
Client Side Programming with Applet
 
Performance Anaysis for Imaging System
Performance Anaysis for Imaging SystemPerformance Anaysis for Imaging System
Performance Anaysis for Imaging System
 
Image processing
Image processingImage processing
Image processing
 
C Graphics Functions
C Graphics FunctionsC Graphics Functions
C Graphics Functions
 
Traffic sign detection via graph based ranking and segmentation
Traffic sign detection via graph based ranking and segmentationTraffic sign detection via graph based ranking and segmentation
Traffic sign detection via graph based ranking and segmentation
 
05 contours seg_matching
05 contours seg_matching05 contours seg_matching
05 contours seg_matching
 
Graphics in C++
Graphics in C++Graphics in C++
Graphics in C++
 
Computer graphics
Computer graphics Computer graphics
Computer graphics
 
ImageProcessingWithMatlab(HasithaEdiriweera)
ImageProcessingWithMatlab(HasithaEdiriweera)ImageProcessingWithMatlab(HasithaEdiriweera)
ImageProcessingWithMatlab(HasithaEdiriweera)
 
IRJET- 3D Vision System using Calibrated Stereo Camera
IRJET- 3D Vision System using Calibrated Stereo CameraIRJET- 3D Vision System using Calibrated Stereo Camera
IRJET- 3D Vision System using Calibrated Stereo Camera
 
Circles graphic
Circles graphicCircles graphic
Circles graphic
 
Performance analysis of transformation and bogdonov chaotic substitution base...
Performance analysis of transformation and bogdonov chaotic substitution base...Performance analysis of transformation and bogdonov chaotic substitution base...
Performance analysis of transformation and bogdonov chaotic substitution base...
 
Image processing with matlab
Image processing with matlabImage processing with matlab
Image processing with matlab
 
maxbox starter60 machine learning
maxbox starter60 machine learningmaxbox starter60 machine learning
maxbox starter60 machine learning
 
Report
ReportReport
Report
 
BMVA summer school MATLAB programming tutorial
BMVA summer school MATLAB programming tutorialBMVA summer school MATLAB programming tutorial
BMVA summer school MATLAB programming tutorial
 

Recently uploaded

Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
AmarGB2
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
VENKATESHvenky89705
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
BrazilAccount1
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
Vijay Dialani, PhD
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
R&R Consult
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 

Recently uploaded (20)

Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
road safety engineering r s e unit 3.pdf
road safety engineering  r s e unit 3.pdfroad safety engineering  r s e unit 3.pdf
road safety engineering r s e unit 3.pdf
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
English lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdfEnglish lab ppt no titlespecENG PPTt.pdf
English lab ppt no titlespecENG PPTt.pdf
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptxCFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
CFD Simulation of By-pass Flow in a HRSG module by R&R Consult.pptx
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 

Tomato Classification using Computer Vision

  • 1. TOMATO CLASSIFICATION Presented By: Raman Pandey(CSJMA12001390146) Neha Chowdhary(CSJMA12001390136) B.Tech, 4th Year (Information Technology)
  • 2. Introduction The ability to identify the tomatoes based on quality in the food industry which is the most important technology in the realization of automatic tomato sorting machine in order to reduce the work of human and also time consuming. Automation of quality control is highly significant because saving time and expenses is always a necessity in industrial applications. An automated system has to be developed which acquires the images of the tomatoes and various features would be extracted using Image Processing and these features would be further used to train machine using some Machine Learning Algorithm and data would be classified and analyzed and accuracy and quality of the test data will be determined.
  • 3. APPLICATIONS USED  MATLAB :Matlab (MATrix LABoratory) is a multi- paradigm numerical computing environment and fourth generation programming language.  R :R is a language and environment for statistical computing and graphics. E1071 and RGL libraries are used for SVM classification and visualization.  WEKA :Waikato Environment for Knowledge Analysis. Weka is a collection of machine learning algorithms for data mining tasks. Libsvm package is used to classify data.
  • 5. ALGORITHM  Images are acquired by camera with precision of 20 cm from the surface above from standard scale for calibration.  Contrast is adjusted for the acquired image.  Segmentation is performed using Otsu’ segmentation method.  Histogram of Images are bimodal hence pixel set of each histogram are calculated and subtracted and the obtained pixel set is used for threshold.  Mask is generated from threshold level and median filter is applied.  Morphological erosion and filling operation is performed on the mask to generated finally binary segmented image.  Region props is used to calculated features such as centroid, major Axis Length for radius and this will be used to find volume and area.
  • 6. Algorithm Continued…  Gradient weight is used to find the image weight.  RGB to HSV transformation is applied on the acquired image and threshold level is calculated for each red , green and blue level and these threshold are used to find maximum number of pixels of different colors.  The maximum value of red pixels represents very good quality of tomato and maximum value of yellow pixels represents good quality of tomato and maximum value of green pixels represents poor quality of tomato.  These features data acquired and stored in the database and hence eventually total 145 samples feature data are stored.  These samples are feed into WEKA for classification.  SVM Multi class classification of Sequential Marginal Optimization algorithm is used to classify data.  70% of the data used for training and 30% is used for testing which generates accuracy of 74%.
  • 7. Algorithm in Code  Clear the Workspace; clc clear workspace;  Read and load the image I=imread('t56.jpg'); figure; imshow(I) title('original image')  Adjust Contrast of blue channel of the Original Image IL = imadjust(I(:,:,3))
  • 8. Algorithm in Code  Get the size and total pixel count of the image [rows, columns, numberOfColorBands] = size(IL); [pixelCount, grayLevels] = imhist(IL, 256);  Divide image in two half and get the total pixel count of the left half image middleColumn = floor(columns/2); leftHalfImage = IL(:, 1:middleColumn); [pixelCountL, grayLevelsL] = imhist(leftHalfImage, 256);  Get the pixel count of the another half right image rightHalfImage = IL(:, middleColumn+1:end); [pixelCountR, grayLevelsR] = imhist(rightHalfImage, 256);
  • 9. Algorithm in Code  Subtract the two left and right pixelcount and get the subtracted histogram diffHistogram = int16(pixelCountL - pixelCountR);  Create the threshold level of subtracted histogram value. Find Otsu threshold level thresholdLevel = 255 * graythresh(diffHistogram)  Create mask from the threshold level mask1 = IL > thresholdLevel;  Apply Median Filter to the Mask mask2 = medfilt2(mask1)
  • 10. Algorithm in Code  Apply Morphological Operation on the mask which will generate segmented Image SE = strel('disk',2) mask3 = imerode(mask2,SE) mask4 = ~imfill(~mask3,'holes') figure; imshow(mask4) title('Segmented Image')  Get the separate Channels of the Original Image red = I(:, :, 1) green = I(:, :, 2) blue = I(:, :, 3)  Get the Gradient Weight of the Image weight = mean2(gradientweight(IL))
  • 11. Algorithm in Code  Get the Major Axis Length radii = regionprops(mask3,'MajorAxisLength') radii2 = mean2(cat(1,radii.MajorAxisLength))  Calculate Volume volume = (4.0/3.0)*pi*(radii2^3)  Calculate Area area=4.0*pi*(radii2^2)  %Convert to HSV Image hsvImage = rgb2hsv(I)weight = mean2(gradientweight(IL))
  • 12. Algorithm in Code  Extract out the H, S, and V images individually hImage = hsvImage(:,:,1); sImage = hsvImage(:,:,2); vImage = hsvImage(:,:,3);  Threshold for Yellow Color YhueThresholdLow = 0.10; YhueThresholdHigh = 0.14; YsaturationThresholdLow = 0.4;
  • 13. Algorithm in Code YsaturationThresholdHigh = 1; YvalueThresholdLow = 0.8; YvalueThresholdHigh = 1.0;  % Now apply each color band's particular thresholds to the color band for yellow YhueMask = (hImage >= YhueThresholdLow) & (hImage <= YhueThresholdHigh); YsaturationMask = (sImage >= YsaturationThresholdLow) & (sImage <= YsaturationThresholdHigh); YvalueMask = (vImage >= YvalueThresholdLow) & (vImage <= YvalueThresholdHigh);
  • 14. Algorithm in Code  Smooth the border using a morphological closing operation, imclose(). YstructuringElement = strel('disk', 4); YcoloredObjectsMask = imclose(YcoloredObjectsMask, YstructuringElement);  Fill in any holes in the regions, since they are most likely red also. YcoloredObjectsMask = imfill(logical(YcoloredObjectsMask), 'holes'); YcoloredObjectsMask = cast(YcoloredObjectsMask, 'like', I);
  • 15. Algorithm in Code  Use the colored object mask to mask out the colored-only portions of the rgb image. YmaskedImageR = YcoloredObjectsMask .* red; YmaskedImageG = YcoloredObjectsMask .* green; YmaskedImageB = YcoloredObjectsMask .* blue; yellowImage = cat(3, YmaskedImageR, YmaskedImageG, YmaskedImageB);  Yellow Pixel Count yel = mean2(yellowImage(find(yellowImage)))
  • 16. Algorithm in Code  Threshold for Red Color RhueThresholdLow = 0.03; RhueThresholdHigh = 1.5; RsaturationThresholdLow = 0.18; RsaturationThresholdHigh = 1.5; RvalueThresholdLow = 0.05; RvalueThresholdHigh = 1.8;
  • 17. Algorithm in Code  Now apply each color band's particular thresholds to the color band for Red RhueMask = (hImage >= RhueThresholdLow) & (hImage <= RhueThresholdHigh); RsaturationMask = (sImage >= RsaturationThresholdLow) & (sImage <= RsaturationThresholdHigh); RvalueMask = (vImage >= RvalueThresholdLow) & (vImage <= RvalueThresholdHigh); RcoloredObjectsMask = uint8(RhueMask & RsaturationMask & RvalueMask); RstructuringElement = strel('disk', 4); RcoloredObjectsMask = imclose(RcoloredObjectsMask, RstructuringElement);
  • 18. Algorithm in Code  Fill in any holes in the regions, since they are most likely red also. RcoloredObjectsMask = imfill(logical(RcoloredObjectsMask), 'holes'); RcoloredObjectsMask = cast(RcoloredObjectsMask, 'like', I);  Use the colored object mask to mask out the colored-only portions of the rgb image. RmaskedImageR = RcoloredObjectsMask .* red; RmaskedImageG = RcoloredObjectsMask .* green; RmaskedImageB = RcoloredObjectsMask .* blue; redImage = cat(3, RmaskedImageR, RmaskedImageG, RmaskedImageB);  Red Pixel Count rel = mean2(redImage(find(redImage)))
  • 19. Algorithm in Code  Threshold for Green Color GhueThresholdLow = 0.15; GhueThresholdHigh = 0.60; GsaturationThresholdLow = 0.36; GsaturationThresholdHigh = 1; GvalueThresholdLow = 0; GvalueThresholdHigh = 0.8;
  • 20. Algorithm in Code  Now apply each color band's particular thresholds to the color band for Green GhueMask = (hImage >= GhueThresholdLow) & (hImage <= GhueThresholdHigh); GsaturationMask = (sImage >= GsaturationThresholdLow) & (sImage <= GsaturationThresholdHigh); GvalueMask = (vImage >= GvalueThresholdLow) & (vImage <= GvalueThresholdHigh); GcoloredObjectsMask = uint8(GhueMask & GsaturationMask & GvalueMask); GstructuringElement = strel('disk', 4); GcoloredObjectsMask = imclose(GcoloredObjectsMask, GstructuringElement);
  • 21. Algorithm in Code  Fill in any holes in the regions, since they are most likely red also. GcoloredObjectsMask = imfill(logical(GcoloredObjectsMask), 'holes'); GcoloredObjectsMask = cast(GcoloredObjectsMask, 'like', I);  Use the colored object mask to mask out the colored-only portions of the rgb image. GmaskedImageR = GcoloredObjectsMask .* red; GmaskedImageG = GcoloredObjectsMask .* green; GmaskedImageB = GcoloredObjectsMask .* blue; greenImage = cat(3, GmaskedImageR, GmaskedImageG, GmaskedImageB);  Green Pixel Count gel = mean2(greenImage(find(greenImage)))
  • 22. Algorithm in Code  Find the Maximum Number of Pixels to determine the ripeness ripe = max([yel rel gel]) if ripe == yel ripeVal = 'Yellow' else if ripe == rel ripeVal = 'Red' else if ripe == gel ripeVal = 'Green' else ripeVal = 'Undefined' end end end  % Store Values in Local Database data = [radii2,area,volume,weight,centroidxavg,centroidyavg,rel,gel,yel,ripeVal] dlmwrite('test.csv',data,'delimiter',',','-append');
  • 23. R Code  Load Required Library require(e1071) #For SVM require(rgl) #For 3 D Plotting  Load Data Set FeaturesTrainingData <- read.csv("G:/8th sem/BTP Tomato Complete Sample/FinalBTPGUI/FeaturesTrainingData.csv") View(FeaturesTrainingData)  Create Data Frame from Training Data ftd <- data.frame(R=FeaturesTrainingData$Radius,A=FeaturesTrainingData$Area,V=FeaturesT rainingData$Volume,W=FeaturesTrainingData$Weight,C=FeaturesTrainingData$Class) View(ftd)
  • 24. R Code  Create SVM Model svm_model <- svm(C~., ftd, type='C-classification', kernel='linear',scale=FALSE) w <- t(svm_model$coefs) %*% svm_model$SV  Visualizing the Hyperplane and Support Vectors detalization <- 100 grid <- expand.grid(seq(from=min(ftd$R),to=max(ftd$R),length.out=detalization), + + seq(from=min(ftd$A),to=max(ftd$A),length.out=detalization)) z <- (svm_model$rho- w[1,1]*grid[,1] - w[1,2]*grid[,2]) / w[1,3] plot3d(grid[,1],grid[,2],z, xlab="PC1 (72%)", ylab="PC2 (19%)", zlab="PC3 (7%)", col="pink") spheres3d(ftd$R[which(ftd$C=='A')], ftd$A[which(ftd$C=='A')], ftd$V[which(ftd$C == 'A')], col='red',type="s",radius=0.01) spheres3d(ftd$R[which(ftd$C=='B')], ftd$A[which(ftd$C=='B')], ftd$V[which(ftd$C == 'B')], col='blue',type="s",radius=0.01)
  • 25. Result A B C 14 0 2 5 0 0 4 0 18 Accuracy %age : 74.42% Confusion Matrix
  • 26. Summary Correctly Classified Instances 32 Incorrectly Classified Instances 11 Kappa statistics 0.5456 Mean Absolute Error 0.2946 RMS Error 0.3827 Relative Absolute Error 72.7541 % Root relative squared Error 84.8467 %
  • 32. Loading Data for Classification
  • 34. 3 D SVM HyperPlane
  • 35. CONCLUSION AND RESULTS  In this automated system, we have developed a methodology which identifies and detect tomato ripeness and its quality based on an image processing algorithm followed by classification process. In the algorithm, tomatoes images are acquired via different perspectives and preprocessed and segmented.And after segmentation process, five features are extracted such as area,volume,weight,radius,perimeter and ripeness.The real value of features of tomatoes are calculated such as volume using Archimedes Principle and weight using weighing machine.  In classification process, SVM is used with multi-class classification in WEKA.We provided the training data in WEKA and Weka calculated SVM accuracy of 74.41% and classified into three classes named A, B and C which represent quality class of very good, good and poor respectively.
  • 36. Future Scope  The future scope of this Automated Application is in the industry of harvest engineering and Automated Agriculture.  This Automated Application will be helpful for easing of Supply Chain Management.  This Application is used to detection of bad quality tomatotes using Computer Vision.  It is also used to analyzed remote sensing data for farming purpose and large scale control production.  Image processing technique has been proved as effective machine vision system for agriculture domain. we can conclude that image processing was the non invasive and effective tool that can be applied for the agriculture domain with great accuracy for analysis of agronomic parameters.
  • 37. References  Rafael C.Gonzalez and Richard E. woods, “Digital Image Processing”, Pearson Education, Second Edition,2005  A simple method for removing reflection and distortion from a single image.[IJEIT]  Recognition and localization of ripen tomato based on machine vision.[AICS]  Noise removal and enhancement of binary images using morphological operations.  Tomato classification and sorting with machine vision using SVM,MLP and LVQ.[IJACS]