Sunteți pe pagina 1din 10

ECC3191 COMPUTER PROGRAMMING AND APPLICATIONS

SEMESTER 1 2013/2014

VEGETABLE CLASSIFICATION:
TOMATO AND SUGARSNAPS
INTRODUCTION
Color in tomato (Lycopersiconesculentum) is the most important external characteristic to
assess ripeness and postharvest life, and is a major factor in the consumers purchase
decision. The degree of ripening is usually estimated visually by human graders comparing
the tomato color to a chart that classify fresh tomatoes into six maturity stages according to
the USDA standard classification: Green, Breakers, Turning, Pink, Light Red, and Red. This
manual practice of tomato maturity classification often results into errors due to human
subjectivitiy, visual stress, and tiredness. We developed a color image analysis procedure and
a neural network model to automate the classification of tomato maturity. We captured using
a computer-connected digital camera 6,000 color images of locally grown and harvested
tomatoes equally representing the six maturity stages (1,000 each). The average classification
by five expert graders from a local commercial farm was used as the maturity classification
of each tomato. Using the red, green and blue (RGB) spectral values of the captured images
as inputs, we trained a neural network-based tomato maturity classifier to indicate the degree
of maturity within each stage and to provide a continuous index over the complete maturity
range. We trained a 3-layer neural network via the feed-forward, back propagation training
algorithm using 70% of the captured images as the training set (4,200 images) and 10% as the
test set (600 images), equally representing each maturity stage. The test set was used during
training to avoid model over-fitting. Validation results agreed with manual grading in 97% of
the remaining tomatoes (1,200 images), while the remaining 3% were classified wrongly but
within one maturity stage difference. With this result, an automatic vision system for tomato
grading could be a potent alternative to manual grading.
Keywords: tomato grading, neural network, image processing, feed-forward, back-propagation
The snap pea is a cool season vegetable. It may be planted in spring as early as the soil can be
worked. Seeds should be planted one to one-and-a-half inches (2,5-4cm) deep. It tolerates light frost
when young; it also has a wider adaptation and tolerance of higher temperatures than some other pea
cultivars. Snap peas may grow to two metres (6.56 feet) or more, but more typically are about 1.3
metres (about four feet). They have a vining habit and require a trellis or similar support structure.
They should get 4-6 hours of sunlight each day.

ECC3191 COMPUTER PROGRAMMING AND APPLICATIONS


SEMESTER 1 2013/2014

MATERIAL AND METHODOLOGY

Image acquisition
In this method, we takes several pictures of tomato and sugar snaps . In order to classify
the vegetable , the picture must be :

Tomato only

Sugarsnap only

Greycale image
The original image is then process by using RGB so that we can obtain the new image which
is greyscale .

Image segmentation
Otsu method has been used to automatically segment the tomato and sugarsnap image with
the background. It will produce the binary image of the samples. After that, a noise is remove
by using this . Otsus method is using threshold value by using this formula Pixel =
lig h t intensity
1
250
.
Feature extraction
Automated Grading System based on image processing : colour , shape and size.
1) Colour : Adopt the Dominant Colour Method (tomato= red)(sugar snap=green) into a*
channel.

ECC3191 COMPUTER PROGRAMMING AND APPLICATIONS


SEMESTER 1 2013/2014

2) Shape : Obtained by drawing the lines and the class with k-means clustering methods
for the image.
3) Size : Described by the largest diameter or the length .

RESULT

The greyscale of tomato

ECC3191 COMPUTER PROGRAMMING AND APPLICATIONS


SEMESTER 1 2013/2014

Threshold of tomato

Figure 1.0 : IMAGE OF TOMATO

The greyscale of sugarsnap

ECC3191 COMPUTER PROGRAMMING AND APPLICATIONS


SEMESTER 1 2013/2014

Threshold of sugarsnap

FIGURE 2.0 : IMAGE OF SUGARSNAP

Figure 3.0 : histogram of the greyscale image of tomato

ECC3191 COMPUTER PROGRAMMING AND APPLICATIONS


SEMESTER 1 2013/2014

Figure 4.0 : histrogram of the greyscale image of sugarsnap

PROGRAM
We have create a program to classify the tomato and sugarsnap.
This is the command in editor

Figure (a): Program to classify tomato

ECC3191 COMPUTER PROGRAMMING AND APPLICATIONS


SEMESTER 1 2013/2014

Figure (b): Program to classify sugarsnap

PSEUDOCODE
Print load image
Read image
Convert the image to greyscale image
Obtain Greyscale image
Image segmentation (otsu method)
Get the threshold image
If pixel_area>400
Print tomato
Else
Print sugarsnap
End

ECC3191 COMPUTER PROGRAMMING AND APPLICATIONS


SEMESTER 1 2013/2014

DISCUSSION
The table 1 shows the images of tomato. The first image shows the grayscale
image of tomato. The image then processed by using RGB so that we can obtain
the greyscale image. The second image shows the binary image of tomato. To
get the black and white image, a threshold must be set to separate the
background and the object. In this image, the background was black which is 0
and the object is 1.

ECC3191 COMPUTER PROGRAMMING AND APPLICATIONS


SEMESTER 1 2013/2014
Figure 2.0 shows the image of sugarsnap. The first image shows the grayscale
image of sugar snap after the process of RGB . The second image is the
threshold image of sugar snap. The threshold of sugar snap is 0.54 based on the
histogram . Recall from the start of our project, the pixel of sugar snap were not
counted accurately due to the noise of the picture cannot be remove. Hence , we
used higher threshold value.
Figure

3.0and figure 4.0 shows the histogram graph of image tomato and

sugarsnap. The histogram is used to determine the threshold value.The threshold


value is important so that we can see the clear area of pixel. Histogram graph
show the intensity of light from 0(darker black) to 250(light white). After finding
the ideal threshold for the both image, the input intensity must be inserted an
equation so that it can be read in the Matlab program.
We use the method of finding pixel area so that we can easier
determine the classification of the both image, we used the object area to
differentiate it. If the pixel is more than 400 pixels, we consider the image as
tomato otherwise it is sugarsnap.

CONCLUSION
As the result from our project of vegetables classification of tomato and sugar snap , we can
differentiate both vegetables by finding their pixel area. Plus , the threshold value is also
important because it leads to the accurate value of pixel that we can obtain in the image.
lig h t intensity
1
So ,we get the pixel value based on the formula ;Pixel =
from the
250
histogram and for the tomato the threshold value is 0.47 and sugarsnap is 0.54 .Hence, the
pixel_area>400 can consider as tomato and otherwise is sugarsnap .

ECC3191 COMPUTER PROGRAMMING AND APPLICATIONS


SEMESTER 1 2013/2014

START

LOAD IMAGE

AREA_PIXEL>
400
READ IMAGE
END
GET
THRESHOLD
IMAGE
(PIXEL)
IMAGE
SEGMENTATION
OTSU
METHOD TOMATO
GET
GREYSCALE
SUGAR
SNAP
CONVERT
TO GREYIMAGE
SCALE
IMAGE

S-ar putea să vă placă și