Image Segmentation and Recognition Using MATLAB
Image Segmentation and Recognition Using MATLAB
In this research, a new vision system to characterize the recognition of vegetables in images has
been developed. It is always related to image processing, which can control the classification,
qualification and segmentation of images. It is a recognition system for super market and
grocery stores. From the captured images multiple recognition clues such as colour, shape, size,
texture and weight are extracted and analysed to classify and recognize the vegetables. The
results show that it has good robustness and a very high success. An important characteristic of
the proposed algorithm is that it is able to work with several elements inside the camera field
of view. This adds flexibility to the application in order to work in the country or in a
greenhouse, where the elements are very close to each other and the location of all them must
be obtained in real time. This approach is less complex and relatively very faster than other
approach. If the system can identify uniquely, the checkout process at superstores will be fast
and efficient.
Image segmentation is to partition an image into meaningful regions with respect to a
particular application. Object recognition is the task of finding a given object in an image or
video sequence.
Page | 1
CONTENTS
List of figures 3
1)Topic 1: Introduction 4
1.1:Definations 4
2.1:Motivation 6
3)Topic 3:Working 6
4)Topic 4:Applications 8
5)Topic 5:Methodology 9
5.1:Flow Chart 9
5.2:Matlab Coding 9
6)Topic 6:Conclusion 12
7)Topic 7:References 13
Page | 2
List of figures
Page | 3
1.Introduction
We present automatic recognition system (vegetable vision) to facilitate the checkout process
of a supermarket or grocery stores. Vegetable vision is done with the image processing and
image analyzing. Image processing is done by MATLAB. This system consists of an integrated
measurement and imaging technology with a user friendly interface. When we bring a
vegetable at checkout point, an image is taken, a variety of features such as color, shape, size,
density, texture etc are then extracted. These features are compared to stored data. Depending
on the certainty of the classification and recognition, the final decision is made by the system.
Vegetable quality is frequently referred to size, shape, mass, firmness, color and bruises from
which fruits can be classified and sorted. The classification technique is used to recognize the
vegetables shape, size, color and texture at a unique glance. Digital image classification uses
the spectral information represented by the digital numbers in one or more spectral bands, and
attempts to classify each individual pixel based on this spectral information.
Image segmentation is the foundation of object recognition and computer vision. And there is
some specifically given work (such as region extraction and image marking) to do after the main
operation of image segmentation for the sake of getting better visual effect. Two major
computer vision problems, image segmentation and object recognition, have been traditionally
dealt with using a strict, bottom-up ordering. Implementation between Segmentation and
Object recognition using the said techniques is studied.
1.1 Definitions
The following are the definitions relevant to this project:
Page | 4
1.1.2 Detection:
Many points in an image have a nonzero value for the gradient, and not all of these points are
edges for a particular application. Thresholding is used for the detection of edge points.
2.Problem Statement
The task here is to automatically detect and classify the vegetables image acquired from
Matlab. Assuming that the different images are present and some are overlapped on one
another.The task is to separate the images overlapped and recognize them .In this, we have use
vegetables image present in Matlab.
Page | 5
2.1 Motivation
The classification technique is used to recognize the vegetables shape, size, color and texture
at a unique glance. Digital image classification uses the spectral information represented by the
digital numbers in one or more spectral bands, and attempts to classify each individual pixel
based on this spectral information. Two major computer vision problems, image segmentation
and object recognition, have been traditionally dealt with using a strict, bottom-up ordering.
3.Working :
The steps of the process are illustrated here with some discussions of each step.
The speed of the object can be determined by using Matlab function. There are various steps
involve in this process which are as given :
Page | 6
Fig3.2: Reference image
c)Convert the image to Black and white
The image is converted to black and white by using the function im2bw, which converts an
image to binary image. Each pixel takes a value that is a normalized intensity value that lies in
the range [0, 1].
d)Morphological Operation:
Strel( ) function creates a flat, disk-shaped structuring element, where R specifies the radius. R
must be a nonnegative integer. N must be 0, 4, 6 or 8. When N is greater than 0, the disk-
shaped structuring element is approximated by a sequence of N periodic-line structuring
elements. When N equals 0, no approximation is used, and the structuring element members
consist of all pixels whose centers are no greater than R away from the origin. If N is not
specified, the default value is4.
Page | 7
f)Calculating pixel value and circularity:
After constructing the bounding box and as per the value of centroid, we have calculated the
pixel value by using impixel inbuilt command and with the help of circularity we have
distinguish different images by using imcrop to crop the desired image.
4.Applications :
This technique of using matlab code can be use in various purpose which are given below .
Locate tumors and other pathologies
Measure tissue volumes
Surgery planning
Face recognition
Fingerprint recognition
Iris recognition and many more.
Page | 8
5. METHODOLOGY:
This section presents the technology inputs and processing steps needed in the vegetables
identification and recognization .The key stages in the vehicle identification and tracking
process. Each of these steps is described in detail below.
5.1FLOW CHART:
Fig5.1:Flow Chart
Page | 9
s=regionprops(L,'Area','Centroid','BoundingBox','Perimeter');
imshow(b)
for i=1:n
C=s(i,1).Centroid;
BB=s(i,1).BoundingBox;
P=s(i,1).Perimeter;
A=s(i,1).Area;
xcorner=BB(1);
ycorner=BB(2);
xwidth=BB(3);
ywidth=BB(4);
Centroidx=C(1);
Centroidy=C(2);
rect=[xcorner ycorner xwidth ywidth];
rectangle('Position',[xcorner ycorner xwidth
ywidth],'Edgecolor','r');
hold on
plot(Centroidx,Centroidy,'b*');
hold off
Pi=impixel(b,Centroidx,Centroidy);
Cir=P^2/(4*pi*A);
if((235<Pi(1))&&(Pi(1)<239)&&(25<Pi(2))&&(Pi(2)<29)&&(34<Pi(3))&&(Pi(3
)<38)&&(1.0<Cir)&&(Cir<1.2))
p=imcrop(b,rect);
figure,imshow(p)
title('TOMATO');
elseif((188<Pi(1))&&(Pi(1)<191)&&(36<Pi(2))&&(Pi(2)<40)&&(44<Pi(3))&&(
Pi(3)<46)&&(2.6<Cir)&&(Cir<2.8))
p=imcrop(b,rect);
figure,imshow(p)
title('CHILLY');
elseif((119<Pi(1))&&(Pi(1)<123)&&(34<Pi(2))&&(Pi(2)<38)&&(74<Pi(3))&&(
Pi(3)<76)&&(1.3<Cir)&&(Cir<1.4))
p=imcrop(b,rect);
figure,imshow(p)
title('BRINJAL');
elseif((249<Pi(1))&&(Pi(1)<253)&&(180<Pi(2))&&(Pi(2)<184)&&(111<Pi(3))
&&(Pi(3)<115)&&(1.6<Cir)&&(Cir<1.8))
p=imcrop(b,rect);
figure,imshow(p)
title('POTATO');
elseif((140<Pi(1))&&(Pi(1)<144)&&(180<Pi(2))&&(Pi(2)<184)&&(98<Pi(3))&
&(Pi(3)<102)&&(1.96<Cir)&&(Cir<2.0))
p=imcrop(b,rect);
figure,imshow(p)
title('PEAS');
Page | 10
elseif((0<Pi(1))&&(Pi(1)<2)&&(95<Pi(2))&&(Pi(2)<99)&&(49<Pi(3))&&(Pi(3
)<52)&&(1.4<Cir)&&(Cir<1.5))
p=imcrop(b,rect);
figure,imshow(p)
title('BITTERGUARD');
elseif((215<Pi(1))&&(Pi(1)<219)&&(84<Pi(2))&&(Pi(2)<88)&&(40<Pi(3))&&(
Pi(3)<44)&&(1.2<Cir)&&(Cir<1.3))
p=imcrop(b,rect);
figure,imshow(p)
title('PUMPKIN');
elseif((241<Pi(1))&&(Pi(1)<245)&&(111<Pi(2))&&(Pi(2)<115)&&(36<Pi(3))&
&(Pi(3)<40)&&(2.0<Cir)&&(Cir<2.1))
p=imcrop(b,rect);
figure,imshow(p)
title('CARROT');
elseif((62<Pi(1))&&(Pi(1)<66)&&(98<Pi(2))&&(Pi(2)<102)&&(34<Pi(3))&&(P
i(3)<38)&&(1.4<Cir)&&(Cir<1.5))
p=imcrop(b,rect);
figure,imshow(p)
title('BRONCHI');
elseif((65<Pi(1))&&(Pi(1)<69)&&(46<Pi(2))&&(Pi(2)<50)&&(Pi(3)<2)&&(1.8
<Cir)&&(Cir<1.9))
p=imcrop(b,rect);
figure,imshow(p)
title('MAIZE');
elseif((235<Pi(1))&&(Pi(1)<239)&&(25<Pi(2))&&(Pi(2)<29)&&(34<Pi(3))&&(
Pi(3)<38)&&(1.2<Cir)&&(Cir<1.3))
p=imcrop(b,rect);
figure,imshow(p)
title('CAPSICUM');
elseif((251<Pi(1))&&(Pi(1)<255)&&(184<Pi(2))&&(Pi(2)<188)&&(71<Pi(3))&
&(Pi(3)<75)&&(1.4<Cir)&&(Cir<1.5))
p=imcrop(b,rect);
figure,imshow(p)
title('ONION');
end
end
Page | 11
Conclusion
Page | 12
References
W. Seng, S. Mirisaee, (2009), "A New Method for Fruits Recognition System", Electrical
Engineering and informatics, 2009. ICEEI '09. International Conference on., pp. 130-134.
Rocha, A., Hauagge, D., Wainer, J., Goldenstein, S. ,(2010), Automatic fruit and
vegetable classification from images, Elsevier, pp. 1-11.
http://sic.ppu.edu/abstracts/090172_681636469_Fruit/vegetableRecognition
(paper).pdf
Luis Gracia, Carlos Perez-Vidal, Carlos Gracia, Computer Vision Applied to Flower, Fruit
and Vegetable processing, http://www.waset.org/journals/waset/v54/v54-86.pdf
Page | 13
Page | 14