# DevelopmentofAnnBasedEfficientFruitRecognitionTechnique # Strictly as per the compliance and regulations of: Abstract-Use of Image processing technique is increasing day by day in all fields and including the agriculture to classify fruits. Shape, color and texture are the image features which help in classification of fruits. This paper proposes an algorithm for fruits classification based on the shape, color and texture. For shape based classification of fruit area, perimeter, major axis length and minor axis length is calculated. Shape features are calculated by segmenting the object with the background using edge detection techniques. Mean and standard deviation is calculated for the color space like HSI, HSV which can be used for color base classification. Texture features is also calculated to enhance the classification process. Gray Level Co-occurrence Matrix (GLCM) is used to calculate texture features. Artificial neural network is used for classification of fruits. Artificial neural network classifies the fruits by comparing shape, color and texture feature provided at the time of training. MATLAB/ SIMULINK software is used to obtain result. Results obtained are better over the previous techniques and gives the accuracy upto 96%. # Introduction n Earlier time's fruits were sorted manually and it was very time consuming and laborious task. Human sorted the fruits on the basis of shape, size and color. Time taken by human to sort the fruits is very large therefore to reduce the time and to increase the accuracy, an automatic classification of fruits comes into existence. The automatic technique incorporate processing of images captured from the test fruits. The features that can be extracted from an image of any fruit are its size, shape, color and texture. These features help the user to classify the fruits in different categories. There are several techniques which can be used to extract the morphological features from an image. For size/ shape, five edge detection techniques are used (Kyaw, Ahmed, & Sharrif, 2009). Intensity (HSI) (Feng & Qixin, 2004) and L*a*b (Gejima, Zhang, & Nagata, 2003) techniques using suitable For color detection in fruits we have to calculate RGB parameters and then convert it into Hue Saturation and algorithms. These techniques are also available with MATLAB toolbox for conversion from RGB into HSI, HSV and L*a*b. Texture is an important feature for characterizing images (Osman & Hitam, 2013). It refers to a change of pixel gray level and color. There are two ways for texture analysis. One is statistical texture analysis the other is structure of texture analysis. The former is the most conventional. Statistical texture analysis methods include spatial autocorrelation method, Fourier power spectrum method, cooccurrence matrix method (Partio, Cramariuc, Gabbouj, & Visa, 2002), gray level difference statistics method and trip length statistics method. a) Fruit classification based on shape Shape modeling is the foundation for object recognition under change of pose, deformation, and varying lighting conditions (Rao & Renganathan, 2002. Shape based classification of fruits takes care of various features like area, perimeter, major axis length and minor axis length. The image generally consists of pixels which includes RGB (Red, Green and blue) components. For calculating these shape features RGB image is converted into gray scale image. (Riyadi, Rahni, Mustafa, & Hussain, 2007) When the image is converted into gray scale image then it represents a different intensity value. There is a difference in intensity value of an object to be classified and the background. A threshold value is decided to separate an object from its background. With the help of this threshold value a gray scale image is converted into binary image in which the value greater than the threshold is 1 and the value lower than the threshold is 0. With the help of this binary image different shape features are calculate. The most common shape features calculated from the image are area, perimeter, major axis length and minor axis length. # b) Fruit classification based on color An image generally consist of RGB components (red, green and blue) which(Buzera, Groza, Prostean, & Prostean, 2008) represents three planes M*N*3. Fruits classified on color bases consist of these three color space RGB. RGB color space is converted into another color space such as HIS, HSV etc (Gonzalez et al., 2004) and for all these converted color space mean and standard deviation is calculated. Each fruit image gives different i. HSV-Color Space HSI stand for hue, saturation and intensity. Pure color attribute of image is described by hue and the amount by which pure color image is diluted by white color is described by saturation. The RGB components are separated from the original image, and the Hue (H), Saturation (S) and Intensity (I) components are extracted from RGB components (Feng & Qixin, 2004). Equations ( 1), ( 2) and (3) are used to evaluate Hue, Saturation and Intensity of the image samples. The mean and variance for all these 6 components(Kay & de Jager, 1992) are calculated and color features are stored suitably for later usage in training ANN. ?? = ? ?? ?? ? ?? 360 ? ?? ?? ? ??(1)?? = ?????? ?1 ? 1 2 ? ?(?? ? ??) + (?? ? ??)? ?(?? ? ??) 2 + (?? ? ??)??? ? ??? ?? The saturation component is given by ( ) [ ] B G R B G R S , , min 3 1 ? ? ? ? ? ? + + ? = (2) Intensity component is given by ( ) B G R I + + = 3 1(3) # c) Fruit classification based on texture Texture is calculated by the outer part of an object which measures the roughness, coarseness and smoothness. Texture is classified by the spatial distribution of gray levels in a neighborhood. It also helps in surface determination and shape determination. Gray level co-occurrence matrix is used to calculate different texture features.(Keller, Chen, & Crownover, 1989) There are two method that can be used to calculate the texture feature of image. One is statistical texture analysis; the other is structure of texture analysis. The former is the most conventional. Statistical texture analysis methods include spatial autocorrelation method, Fourier power spectrum method, cooccurrence matrix method, gray level difference statistics method and trip length statistics method. Texture is using various fields such as in rock. This paper proposes a new technique for region-based skin color classification using texture information. (Clausi, 2002). Color mapping co-occurrence matrix (CMCM) is used to extract the texture information from skin image. Gray level co-occurrence matrix (GLCM) is used to extract texture features in an image. The Grey Level Co-occurrence Matrix, GLCM is also called as Grey Tone Spatial Dependency Matrix (Clausi, 2002) Step 3: determine the threshold to differentiate between object and background using Otsu thresholding. Step 4: convert a gray scale image into binary image. Step 5: calculate area, perimeter, major axis length and minor axis length. Stop ii. Color feature calculation Image captured using digital camera is a colored image which consist of RGB (red, green and blue) component. For color feature extraction RGB is converted into some other color space such as HSI, HSV. HSI stands for hue, saturation and intensity. HSI can be calculated from RGB using equation ( 2), ( 3) and (4). For above color space mean and variance is calculated and these calculated values are stored in the artificial neural network. Steps for color features extraction are given in Algorithm 2. ?? = ? ?? ?? ? ?? 360 ? ?? ?? ? ?? (2) ?? = ?????? ?1 ? 1 2 ? ?(?? ? ??) + (?? ? ??)? ?(?? ? ??) 2 + (?? ? ??)??? ? ??? ?? The saturation component is given by ( ) [ ] B G R B G R S , , min 3 1 ? ? ? ? ? ? + + ? = (3) Intensity component is given by ( ) B G R I + + = 3 1 (4) Algorithm 2: color features extraction Input: image Output: 16 color feature # Start Step 1: Read a RGB image. Step 2: Convert a RGB image into HIS, HSV, L*A*B and YbCbCr. Step3: calculate mean and standard deviation for each color space. Stop iii. Texture feature extraction Texture is calculated by the outer part of an object which measures the roughness, coarseness and smoothness of an image. Texture is classified by the spatial distribution of gray levels in a neighborhood. It also helps in surface determination and shape determination. Gray level co-occurrence matrix is used to calculate different texture features (Clausi, 2002). Gray level co-occurrence matrix (GLCM) is used to extract texture features of an image. The Grey Level Cooccurrence Matrix, GLCM is also called as Grey Tone Spatial Dependency Matrix. It represents the image in the form of tabulation which contains different combinations of pixel brightness value (gray levels) that occurs in an image. To calculate different texture feature like entropy, energy, homogeneity and dissimilarity a gray level co-occurrence matrix is created. It represents the relation between the two pixels at a time, called the reference and the neighboring pixel. The Grey Level Cooccurrence Matrix, GLCM can be analyzed in four different directions are Horizontal (00), Vertical Step 2: Derive Gray level co-occurrence matrixes from the gray scale image for 4 different directions 00,450,900 and 1350. Step 3: Gray level co-occurrence matrix is calculated using equation (5). Step4: Gray level co-occurrence matrix help in calculating contrast, dissimilarity, angular second moment, energy and entropy using equation ( 6) to (10). Stop. # III. Recognition and Classification of Fruits In this section neural network, training and testing is explained. # a) Artificial Neural Network Neural network is used as a classifier which recognizes fruits and classifies them to the class to which they belong (Cochocki & Unbehauen, 1993). Input layer of neural network depends upon number of input. It has a hidden layer, which consist of neuron which process the information and generate the output. It has five output layers because fruits are classified in five different classes. Neural network perform the classification on shape, color, texture and both color and texture. Result is compared on all these methods and checked which will give the best result. # Result and Discussion Table 1 show the result of classification. Column first of the table gives the image of different fruits. Remaining column gives the percentage of fruits that are classified accurately on shape, color, texture and both color and texture. 100 images of each fruit is taken out of which 50 images is used during the training time and remaining 50 image is used for testing. Percentage means how much testing image of each fruits is accurately identified. # a) Discussion Table1 show the comparison between the classification on the basis of shape, color and texture. First the fruits are classified on the basis of shape. For shape classification four parameters are calculated which are area, perimeter, major axis length and minor axis length. It gives good result when different shape fruit are to be classified. By looking into the table it finds that only 72 % of apples are accurately classified. This occurs because most of the time shape of an apple resembles to the shape of Orange and pomegranate. This is the main drawback of shape basis classification. To overcome this drawback a new feature is used that is color .In Table 1 third Column shows the classification percentage on color basis. As the classification accuracy is improved to 94% for apple because apple and orange have different color. But colour basis classification also faces problem when two fruits have same color. Many a times apple and pomegranate have same red color so this will affect the classification and Texture features is also included to perform the classification but it also does not improve the classification because most of the fruits have smooth surface. But the classification accuracy is efficiently improved when color and texture feature are amalgamated. Classification accuracy is improved for all fruits and 96 % pomegranates are accurately classified. V. # Conclusion This paper proposes that when color and texture features are amalgamated, it gives better result over the all other previous method such as shape, color and texture. From the result we can find that shape based classification gives 83.2% accuracy, Color basis gives 90%, Texture basis give 89.60% and results are improved to 96 % when the color and texture features are amalgamated. Hence it can be concluded that color and texture together give better result. This result can further be improved by considering the shape also along with color and texture but it may lead to increasing degree of complexity and computation. ![Global Journal of Computer Science and TechnologyVolume XIV Issue V Version I and standard deviation which helps in its classification.](image-2.png "I") ![. It represents the form of tabulation which contains different combinations of pixel brightness value (gray levels) that occurs in an image. To calculate different texture feature like entropy, energy, homogeneity and dissimilarity a gray level co-occurrence matrix is created. It represents the relation between the two pixels at a time, called the reference and the neighboring pixel. The Grey Level Co-occurrence Matrix, GLCM can be analyzed in four different directions which are Horizontal (00), Vertical (900) and Diagonal: Bottom left to top right (-450) Top left to bottom right (-1350) Denoted as P0, P45, P90, & P135 Respectively as shown in Fig 1.](image-3.png "") 1![Figure 1 : Different direction of gray level co-occurrence matrix](image-4.png "Figure 1 :") ![and most important part to start the project is to capture the images of different fruits. For this a black box setup is created in which constant light source is provided. Digital Camera (Nikon) is placed at a height of 1 foot to capture the image of fruit. To capture the image of fruit from all different direction, fruits are rotated manually to get image of all its side. Different fruits image is captured using digital camera as shown in Fig 2.](image-5.png "First") 234![Figure 2 : Image of different fruit such as pomegranate And apple](image-6.png "Figure 2 :Figure 3 Figure 4 :") 51![Figure 5 : Flow diagram for the methodology Represented by P(x,y)=0. Step for color features extraction calculation are given in Algorithm 2.( )](image-7.png "Figure 5 :Algorithm 1 :") 3![(900) and Diagonal: Bottom left to top right (-450) Top left to bottom right (-1350) Denoted as P0, P45, P90, & P135 respectively as shown in fig 1. . First step is to extract texture features are given in Algorithm3. Global Journal of Computer Science and Technology Volume XIV Issue V Version I Texture feature extraction Input: RGB image Output: 22 texture feature StartStep1: convert a RGB image into gray scale image.](image-8.png "Algorithm 3 :") ![b) Training And Testing In training time, neural network is trained to identify the type of fruit image. All the data generated during the training time are stored in the data base of Neural network. When a new image is encountered during testing time, features are extracted from the new image which is compared with data stored in neural network and it classifies the fruit in suitable class based on bases of their knowledge gained during training time. Training and Testing model of neural network is shown in Fig.6. This model consists of input layer, hidden layer and output layer. In the input layer (38) color and texture features are calculated. Hidden layer (10) consist of neurons which generate output. Output layer (5) represents the five different fruits that are classified.](image-9.png "") 6![Figure 6 : Training and Testing Model IV.](image-10.png "Figure 6 :") ![of pomegranates are accurately classified.](image-11.png "") 1Image of fruitsAccuracy based on (%)ShapeColorTextureColor+TextureAppleTraining=5072948096Testing=50BananaTraining=5098969698Testing=50OrangeTraining=5090909498Testing=50MangoTraining=5086869092Testing=50PomegrTraining=5070848896anateTesting=50 © 2014 Global Journals Inc. (US)Development of Ann Based Efficient Fruit Recognition Technique * Techniques of analysing the colour of produces for automatic classification MBuzera VGroza GProstean OProstean 2008 * An analysis of co-occurrence texture statistics as a function of grey level quantization DAClausi Canadian Journal of remote sensing 28 1 2002 * Neural networks for optimization and signal processing ACochocki RUnbehauen 1993 John Wiley & Sons, Inc * Study on color image processing based intelligent fruit sorting system GFeng CQixin 2004 * Judgment on level of maturity for tomato quality using L* a* b* color image processing YGejima HZhang MNagata 2003 * RCGonzalez REWoods SLEddins Digital image processing using MATLAB Pearson Education India 2004 * Review Paper (AE-Automation and Emerging Technologies): Multi-layer Neural Networks for Image Analysis of Agricultural Products DSJayas JPaliwal NSVisen Journal of Agricultural Engineering Research 2 77 2000 * A versatile colour system capable of fruit sorting and accurate Object classification GKay GJager 1992 * Texture description and segmentation through fractal geometry JMKeller SChen RMCrownover Computer Vision, Graphics, and Image Processing 1989 45 * Shape-based sorting of agricultural produce using support vector machines in a MATLAB/ SIMULINK environment MMKyaw SKAhmed ZA MSharrif 2009 * Skin colour classification using linear discriminant analysis and colour mapping co-occurrence matrix GOsman MSHitam 2013 * Rock texture retrieval using gray level cooccurrence matrix MPartio BCramariuc MGabbouj AVisa 2002 * New approaches for size determination of apple fruits for automatic sorting and grading PSRao SRenganathan Iranian Journal of Electrical and computer engineering 2 1 2002 * Shape characteristics analysis for papaya size classification SRiyadi AA ARahni MMMustafa AHussain 2007 * Fuzzy and neural approaches in engineering LHTsoukalas REUhrig 1996 John Wiley & Sons, Inc