Sub 155362

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

International Journal of Science and Research (IJSR)

ISSN (Online): 2319-7064


Index Copernicus Value (2013): 6.14 | Impact Factor (2013): 4.438

Automated Inspection and Grading of Vegetables


Using Multisorting System Based on Embedded
Platform
Archana Kumari1, Vivek Chawla2
1
M-tech, Robotics and Automation, Indira Gandhi Delhi Technical University for Women (IGDTUW), Delhi, India
2
Assistant Professor, Department of Mechanical and Automation Engineering, Indira Gandhi Delhi Technical University for Women
(IGDTUW), Delhi, India

Abstract: Food is essential for nourishment and sustenance of life. The food sorting system gives us various information like color,
shape, size, defect etc. There are two way for inspecting food products, first is the external food inspection while other is the internal
food inspection. External inspection is done through image processing while internal measurement is done by sensors which can
calculate moisture content, sugar content etc. In this paper embedded system is designed for multisorting and it is implemented through
Matlab. It is a user dependent system, where user has to decide what type of sorting is required whether its on basis of color, size or
quality. Manual method is slow, costly and also lacks reliability and objectivity required in competitive food industries. The system
consist of one web camera, personal computer, two servomotors, one PCB, microcontroller working on Arduino platform, one LCD for
displaying on which mode are you working and other mechanical part. The samples of different vegetables are situated in front of
camera and are calibrated off line. All the information are extracted and saved in database.

Keywords: Machine vision, Image processing, multisorting, embedded, vegetable.

1. Introduction baked, moderately baked, over baked, considerably over


baked based on two analysis support vector machine (SVM)
By giving a vision to computer, its application has extended and wilks analysis [5].
in various field where significant information is extracted
automatically from images and it has also provided necessary In this research, an embedded system based on Matlab is
theory and example for a practitioner in field of multimedia, developed for multisorting purpose based on color, size and
art and design, geographic information system, image quality for vegetables. Here we have tested the system for
database, medical imaging, remote sensing, computer tomatoes and capsicum however the system can be applied
cartography, autonomous vehicles and robot sensing [1]. for other vegetables, but for that special training as well as
With advancement of methodologies in machine vision efficient calibration is required. This paper is organized in
human endeavor is replaced by automatically perceived four parts, in first part all the hardware component, software
image which are obtained by combination of physical image part, and their working have been described, second one is
sensor, dedicated hardware and software instruments [2]. For the hardware testing part third one is the material and method
providing consistency in product quality and to handle large for computer vision and matlab working part and last one is
varieties of vegetables and fruits automation via computer the result and analysis.
vision is required. The United States of Department of
Agriculture (USDA) has classified five grades of potatoes. 2. Hardware components and software used
The attributes for deciding these grades are size, shape,
external defect. The system correctly classified 80%, 77% 2.1 Embedded System Hardware
and 88% of moving potatoes in three runs at 3 potatoes per
minute and 98%, 97%, 97% in three run of stationary Embedded Systems are components integrating software and
potatoes [8]. With the help of capability of computer vision hardware jointly and specifically designed to provide given
in food industry, this industry is now ranked among the top functionalities. A combination of computer hardware and
10 industries. Many vision based system has been designed software, and perhaps additional mechanical or other parts,
for different food products automated inspection such as designed to perform a dedicated function. In some cases,
tomato, dates, oranges, potatoes, bakery products, aquatic embedded systems are part of a larger system or product, as
foods, grains and many other products [3][7][4][8][5][6]. in the case of an antilock braking system in a car. Such
One of the important parameter is freshness of fish, which equipment is electrical or battery powered. The chip controls
can be calculated using techniques of machine vision. Here a one or more functions of the equipment, such as
digital color imaging system was applied to provide accurate remembering how long it has-been since the device last
CIELAB color measurement of eyes and gills [6]. An received maintenance. An Embedded System is a special-
automatic and intelligent system has been developed by S. purpose computer system designed to perform one or a few
Nashal, A. Abdullah, S. Armvith, M. Z. Abdullan [2011] for dedicated functions, often with real-time computing
classification of biscuit products according to their color. constraints. In our work embedded hardware is dedicated to
Here biscuits are classified in 4 groups basically under rotate servomotor toward specific bin based on what type of
Volume 4 Issue 6, June 2015
www.ijsr.net
Paper ID: SUB155362 1021
Licensed Under Creative Commons Attribution CC BY
International Journal of Science and Research (IJSR)
ISSN (Online): 2319-7064
Index Copernicus Value (2013): 6.14 | Impact Factor (2013): 4.438
input is obtained after image processing via matlab. All relay driving unit, motor driver unit, alarm systems, Display
related hardware is shown in figure1. units etc.

2.2 Hardware Elements 2.3 Software and library used

2.2.1 Processing block: AVR family atmega 168,its a 28 pin Software used
ic,16kb flash memory,8 bit processor, 14 digital Arduino compilercontroller program
IP/OP port, 6 analog IP/OP port, 16 MHz clock Dock light hardware manual testing
frequency, 1 UART, cp2102.. USB to UART driver

2.2.2 Basic circuit elements: power source, clock, reset, Library used:
timers, memory, glue circuit for the elements linking Servo.h
and interfaces LiquidCrystal.h

2.2.3 Keypad, LCD display matrix or touch screen Sorting Component:


Two axis servo mechanisms are designed.
2.2.4 IO communication elements: buses (serial and parallel), There is simple conveyor arrangement to place the object on
interfaces for network interface, ADC, DAC, pulse sorting mechanism.
dialer, modem, Bluetooth, 802.11, as per the
application Interfacing:
SERVO base---D8 of uC, Servo arm---D9 ofuC
2.2.5 Interrupt Handler 16x2 LCD -----D2,D3,D4,D5.D6,D7
RX-TX UART MODULE----D0,D1 of uC.
2.2.6 Output block: servomotors are used for sorting. They
give accurate angle movement, it receives pwm 2.4 Hardware Working
signal. It can move total 180 degree. From the base
position it can move either -90 or +90 degree. The +12V DC power is fed to the board. Arduino compiler
has been used using c, c++. Arduino compiler is easily
available, also all its library is free. Only thing which we
have to buy is its burning board. Process of transferring code
from personal computer to microcontroller is called burning
process. The controller checks the acknowledgment from the
MATLAB interface designed to check the various food
products on the basis of color, size and feature analysis. The
acknowledgement sent is the ASCII characters 1 2 3 on the
basis various detection. The USB to UART module is used to
make the controller compatible with PC. The means of
Figure 1: Embedded multisorting hardware communication is UART. The ASCII characters are received
by the controller. The controller is programmed in Arduino
Embedded system hardware basically consists of three main to check the received characters and give the signal to the
elements: servo motor to move for different position and place the
Input System: Input system is the basically used to interact object. Two axis servo mechanisms are designed. There is
with external environment or type of input the user want to simple conveyor arrangement to place the object on sorting
give. There can be various type of the input system mechanism.
depending upon the user or system need. Some of the
examples are sensor interfaces (IR, LDR etc.), UART 3. Hardware Testing
interface (for communication with PC), Wireless interfaces
for various type of wireless communication etc. These 1. Connect the black terminal of the Digital Multimeter to the
interfaces have also a good circuit design and should be ground of the supply source and turn the knob to 20V DC
properly designed so that it can easily interact with the next voltage.
unit. 2. Make sure the notch of all the ICs including
microcontroller is correct.
Processing Unit: The next unit is the processing unit that 3. Check the continuity and short circuit of the PCB's.
consist either analog circuit to process the input or to make 4. Provide supply of 12V to motor driver board from main
the system perform good and user dependant (as per board
program) uses the microcontroller interface circuit. The main 5. Check the voltages at pin o (output) of both 7805 and it
function of this unit is to take the input, process it and should be +5 volts on the boards
generate the desired output as per the program (done by user) 6. Check the voltage at pin 7 and 20 of the microcontroller it
to control the output unit. should be +5 volts.
Output unit: The output unit consists of the circuit interface 7. Check the voltage at pin 2 and pin 15 of the LCD, It should
to generate and control the desired output. For example the be +5V

Volume 4 Issue 6, June 2015


www.ijsr.net
Paper ID: SUB155362 1022
Licensed Under Creative Commons Attribution CC BY
International Journal of Science and Research (IJSR)
ISSN (Online): 2319-7064
Index Copernicus Value (2013): 6.14 | Impact Factor (2013): 4.438
8. LCD should display all these data.
9. If all the above parameters are met, then the testing part is
complete and we can run our Project.

Caution: Check the orientation of LCD and all IC.

Hardware testing using DOCKLIGHT


1. Install dock light and CP2102 driver
2. Power the board +12V DC Figure 2: Stages of machine vision
3. Insert the module in PC USB
4. Right click on the My computer---Manage-----Device 3. Extracting RGB data
manger-----Ports& COMS First RGB image is converted to grayscale image by
5. Check the COM name for Silicon Labs CP210 eliminating the hue and saturation information while
6. Open the dock light .Double click on COM icon on retaining the luminance by syntaxrgb2gyay.If the image is
uppermost right side. gray scaled image than from the grayscale image its required
7. Select the same Com as in step 5 from drop down menu to extract the red, green and blue components in the image by
8. Drop Set the baudrate 9600 from the drop down menu following syntax
and finally apply R = imsubtract(data(:,:,1), rgb2gray(data));
G = imsubtract(data(:,:,2), rgb2gray(data));
4. Material and method B= imsubtract (data (:,:,3), rgb2gray(data));
Here since we have taken red, green and yellow capsicum for
4.1 Machine Vision System our experiment, so extraction of yellow color is also required,
for that we have taken the snapshot of yellow colored
Computer vision system consists of five basic elements capsicum and in its matlab image via use of data curser we
camera, optics, illumination, and Image acquisition hardware found the nature of primary color R, G, B that they are of
and machine vision software. Mostly solid state cameras are increasing nature or decreasing nature.
used in machine vision applications. Type of solid state
camera used are 1.CCD (camera coupled device), 2. CID 4 Noise removal
(charge injected device) and 3. CPD (charge priming device). Because of atmospheric noise as well as due to motion on
CCD, CID, CPD are compared in Galbiati[5]. Illumination : conveyor belt some blurs effect comes in picture. So filtering
Illumination technique consideration include whether the is required here. We checked all the filters and found that
object is dull or reflective, flat or complex in shape, if median filter of 3X3 size is working best .its syntax is
through holes are to be deflected or to find if there is surface diff_im = medfilt2 (diff_im, [3 3]);
defect. Five categories of lighting can be distinguished for
machine vision 1.Front lighting, 2.Back Lighting, 3.Side 5. Image binarisation for boundary extractionGray image is
lighting, 4.Structured lighting, 5.Strobe lighting. They are converted to binary image by deciding a particular threshold
classified on the basis of position of light source relative to value. All pixels having value greater than decided threshold
the camera. Lighting technologies include incandescent value is grouped in one region and others to other region.
lamps, sodium vapor lamp and lasers. Corresponding syntax is
Machine vision stages are image acquisition, image diff_im = im2bw(diff_im, threshold value);
processing, image enhancement, image restoration, image Threshold value determination is tough job, however here we
segmentation, image analysis, model matching. Stages of have decided it by finding histogram plot.After binarisation,
machine vision are shown in figure 2. object of focus is extracted from boundary, after that some
morphological operations are applied. These operation
4.2 Matlab implementation in Machine Vision System increases the speed of detection as well as increase the
accuracy. There are some very small areas of pixels are
4.2.1 The basic steps are present which are of insignificant nature, so they are removed
1 Image acquisition by function bwareaopen () command.
An image of vegetable is captured by using a webcamera by Its syntax is
using matlab function getsnapshot. If the image is grayscale diff_im = bwareaopen(diff_im, p)
image than it is stored as MXN array. Else if its colored
image or RGB image than it is stored as an MXNX3 array. 6. Geometric feature selection
The syntax for getting an image is Here descriptions of image object which are suitable for
vid = videoinput ('winvideo', 2, 'YUY2_640x480'); further computer process are extracted. The function used for
data = getsnapshot(vid); extracting these features is regionprops in matlab. The
2 Than the serial communication by UART has been features which has been extracted are area, minor axis, major
acknowledged at the rate of 9600 baud rate. axis. The syntax is
ser=serial ('COM1','Baudrate',9600); Props = regionprops(bw, 'properties');

4.2.2 Sorting mechanism


1. Sorting Based On Color

Volume 4 Issue 6, June 2015


www.ijsr.net
Paper ID: SUB155362 1023
Licensed Under Creative Commons Attribution CC BY
International Journal of Science and Research (IJSR)
ISSN (Online): 2319-7064
Index Copernicus Value (2013): 6.14 | Impact Factor (2013): 4.438
If I=1 is selected then sorting will be done on basis of color and sorting of the vegetable of the same type. Basically this
In our experiment we have checked three colors red, green sorting is for quality evaluation purpose. Because fruits or
yellow. Because its a 3 conveyor belt sorting arrangement so vegetables which are spotted more than a particular threshold
it is permitted to take only three colors. Now by matlab they can be declared as rotten fruit or vegetable. In mode one
function area of all connected region are found, then out of the camera takes the continuous images using image
these area maximum area is found. After that a particular acquisition. The captured image is converted image is
threshold value is defined, if the area is greater than this subtracted from the R index (for red color), G index (for
threshold value than the objected is declared either red or green color) and RGB index for yellow color. The subtracted
green or yellow colored object. image is converted into B/W on the basis of thresholding.
The Image is noisy so we are using medfilt to filter the
2. Sorting based on size converted image. After conversion the vegetable part in the
If i=2 is selected then sorting will be done on basis of size image turns white else all is black. The area of the white part
Grading the vegetables on basis of size is very important is calculated. The MATLAB interface uses serial
criterion related to its market value as well as the packaging communication to send the flag values as ASCII to controller
factor. Vegetable are sorted either low sized or medium sized unit as ASCII characters. The controller interface is
or high sized vegetable. Descriptors area, minor axis as programmed to receive the characters and perform the sorting
well as major axis have been used for finding size. at three different locations

3. Sorting based on quality Now in mode 1 if area is positive for red then red flag turns 1
If i=3 is selected than sorting will be done on basis of quality else 0. Similar process occurs for green and yellow colored
Grading vegetables on basis of quality is very important vegetables. Snapshots of the processed images are shown in
factor, for health benefits .here we done our experiment on figure for color sorting original image and corresponding its
tomatoes. There are several factors which decide the quality binary image is shown in figure 3.
of tomatoes. We have checked quality on basis of whether its
spotted tomato or spotless.
For finding defects or spots we following steps were done
1. With the help of matlab function regionprop first
centroid and bounding box were found.
2. Then this bounding box was passed to overall binary
image and all pixel values were checked. Pixel location
where value found is zero is counted. This is done because
all the pixel location where there is any defect that will
appear as black.
3. Then particular threshold value is selected by user if the
counted value is greater than the threshold value than the
tomato will be declared as defected, otherwise its a good
tomato.
All algorithms for image processing were written in
MATLAB 7.12.0.635(R2011a). (The Math-works, inc,
USA). Figure 4 in next page showing flowchart sequence of
the work done in this research

5. Result and Analysis


In the MATLAB part we are using three toolboxes- Image Figure 3: Resultant image obtained in color based sorting
Acquisition, Image processing & serial communication. The
Proposed working of the MATLAB code is to work in three
different modes. The mode is to be selected by the user.
Mode 1 is color based sorting of the vegetable. Mode 2 is the
size based sorting of the vegetable. Mode 3 is spot detection

Volume 4 Issue 6, June 2015


www.ijsr.net
Paper ID: SUB155362 1024
Licensed Under Creative Commons Attribution CC BY
International Journal of Science and Research (IJSR)
ISSN (Online): 2319-7064
Index Copernicus Value (2013): 6.14 | Impact Factor (2013): 4.438

Figure 4: flowchart of complete work in this research

In mode2 the flag value turns 1, 2, and 3 as per the area


threshold of different values. Shape and size classification
are very important for packing purpose. Here we have taken
tomato for our analysis part. Size is estimated by calculating
the area covered by tomato. To capture area, first the tomato
is binarised to separate the tomato image from its
background. Then the numbers of white pixels are calculated
which gives us the estimation of area. Tomatoes are Figure 5: Resultant image obtained in shape and size based
classified in three categories according to the projected sorting
White areas as shown in fig 5. Table1 shows the range of
pixels value for considering big,, medium, and small tomato Table 1: showing projected white pixel area for classification
Similar is the case for green & yellow color part. based on size of tomato
Grading tomato no Min. Max. Average
(pixel) (pixel) ( pixel)
Small category 14 1000 80000 40500
Medium category 23 80000 170000 125000
Big category 55 170000 250000 210000

Mode 3 is spot detection. For spot detection we are creating a


bounding box across the white detected region. In that region
we are checking for number of zeros found. If the number of
zeros (black pixel) is greater than a threshold which is
decided by user than t red spot _flag or goes high else its
zero, thus good quality and bad quality fruits or vegetables
can be distinguished. Here while experiment we have taken
red colored tomato for spot detection, but we can choose any
colored vegetable, just we will have to do little calibration.
Snapshots of the processed images for spotted tomato i.e.

Volume 4 Issue 6, June 2015


www.ijsr.net
Paper ID: SUB155362 1025
Licensed Under Creative Commons Attribution CC BY
International Journal of Science and Research (IJSR)
ISSN (Online): 2319-7064
Index Copernicus Value (2013): 6.14 | Impact Factor (2013): 4.438
defected tomato original image and corresponding its binary Pune. Currently he is Asst. Professor at Department of Mechanical
image is shown in figure 6. and Automation Engineering, Indira Gandhi Delhi Technical
University for Women (IGDTUW), Delhi, India.

Figure 6: Resultant image obtained in quality based sorting

References
[1] Shapiro, Ll.G.And Stockman, G.C, "Computer Vision",
prentice hall, upper sadle river, nj, 2001.
[2] Sonka, M., Hlavac, V. Boyle, R.: "Image Processing,
Analysis, And Machine Vision" - 2nd Ed., Pws, Pacific
Grove, Ca, 800 P., 1998.
[3] Md. Rokunuzzaman1, H. P.W. Jayasuriya2, "
Development Of A Low Cost Machine Vision System For
Sorting Of Tomatoes, " Agric Eng Int: Cigr Journal, Vol.
15, No.1 173, March, 2013.
[4] Amer Eissa A.H., A.H. Gomaa; G.R. Gamea; E. Elsaiedy;
Y. F. Sharobeem; A.A. Ibrahim "Machine Vision
Simulation For Sorting Orange Fruits" Journal Of
Applied Sciences Research, 8(7): 3211-3224, 2012 Issn
1819-544x
[5] S. Nashat A. Abdullah ,S. Aramvith,M.Z.Abdullah
Support Vector Machine Approach To Real-Time
Inspection Of Biscuits On Moving Conveyor Belt
,Computers And Electronics In Agriculture Volume 75,
Issue 1, Pages 147158, , January 2011
[6] Majid Dowlati, Seyed Saeid Mohtasebi, Mahmoud Omid,
Seyed Hadi Razavi, Mansour Jamzad, Miguel De La
Guardia,Freshness Assessment Of Gilthead Sea Bream
(Sparus Aurata) By Machine Vision Based On Gill And
Eye Color Changes",Journal Of Food Engineering,
Volume 119, Issue 2, Pages 277-287, November 2013.
[7] Yousef Al Ohali; Computer Vision Based Date Fruit
Grading System: Designand Implementation; Journal Of
King Saud University Computer And Information
Sciences 23, 2936, 2011
[8] Paul H. Heinemann, Niranjan P. Pathare, Charles T.
Morrow;An Automated Inspection Station For Machine-
Vision Grading Of Potatoes; Machine Vision And
Applications" 1996, Volume 9, Issue 1, Pp 14-19.

Author Profile
Archana Kumari received the B.tech. Degree in
electronics and Electrical Engineering from kalinga
Institute of Industrial Technology, BBSR and
currently pursuing her M-tech from IGDTUW in
robotics and automation branch.

Vivek chawla completed his mtech from DITE Delhi,


his area of specialization are tool design and
manufacturing, CAD/CAM application and operation
management. He completed his MBA from symbiosis
Volume 4 Issue 6, June 2015
www.ijsr.net
Paper ID: SUB155362 1026
Licensed Under Creative Commons Attribution CC BY

You might also like