A Computer Vision Based Diseases Detection and Classification in Apple Fruits

DOI : 10.17577/IJERTV6IS100073

Download Full-Text PDF Cite this Publication

Text Only Version

A Computer Vision Based Diseases Detection and Classification in Apple Fruits

  1. Ramya 1, S. Menaga3 1Assistant Professor, Department of ECE,

    Jay Shriram Group of Institutions, India

    S. Dinesh 2,

    2 Department of ECE, Kongu Engineering College, India

    Abstract: – India ranks second in the production of fruit. Consistently huge amount of apples are delivered and reaped all through world. Agriculture is a significant sector of Indian economy because it contributes around 17 percent of Indias total Gross Domestic Product (GDP) and provides the employment to over 60 percent population. To deliver good quality of product it is important to discover infections in a fruit. The traditional methodology for diseases detection due to infection and identification of fruit depends on the exposed eye perception by the specialists, counseling specialists are expensive and complex because of the remote areas of their availability. Aim to automatically identify fruit diseases and manifestations of disease are crucial. Sicknesses of apple organic products showing up at reaping can bring about noteworthy misfortunes in yield and quality appeared in harvesting.

    Diseases in fruit in particular apple, cause devastating problem in economic losses and production in agricultural industry worldwide. In this project, a solution for the detection and classification of apple fruit diseases is proposed and experimentally validated by simulation. The image processing based proposed approach is composed of the following main steps: in the first step K-Means clustering technique is used for the image segmentation, the second step to as texture feature were extracted using GLCM algorithm, the third step Particle Swarm Optimization algorithm is used for feature selection, and finally images are classified into one of the classes by using a Multi-class Support Vector Machine. Our analyzed results intimate that the proposed solution can significantly support accurate detection and automatic classification of apple fruit diseases. The classification accuracy for the proposed solution is achieved up to 93% as compared with other benchmark algorithm.

    Keyword: Clustering; Support Vector Machine; Feature extraction; Texture; Neural Network


      The traditional approach for detection and identification of fruit diseases is based on the uncovered eye observation by the experts. In few developing countries, consulting experts are exorbitant and too much time due to the distant locations of their availability. Continuous detection of fruit diseases is essential to detect the indication of diseases as early as they appear on the growing fruits. Diseases of apple fruits appearing at harvesting can cause significant losses in yield and quality. To know what control factors to take next year to avoid losses, it is crucial to recognize what is being observed. Some common diseases of apple fruits are apple scab, apple rot, and apple blotch,

      Visual inspection of apples is already automated in the industry by machine vision with respect to size and color. However, detection of defects is still problematic due to natural variability of skin color in different types of apple, high variance of defect types, and presence of stem/calyx.


The Apple images are first preprocessed to remove the unwanted noise from the image.

Then preprocessed output images are given into the segmentation process for detect defected region of apple fruit images. The features are extracted from the images using GLCM algorithm. The features are extracted for all the images in the database and saved as training image features. The features are extracted for the test image and they are saved as test image features. The Training image features and the test image features are passed into the classifier. The Neural Network classifies the image into disease affected or normal image. If the given image is abnormal means the images are segmented using k-means segmentation algorithm. By using feature selection algorithm features are extracted. To dimonsiality reduction Particle Swarm Optimization algorithm is used. Then the type of the disease in the image is identified using Multi SVM Classifier. Finally the accuracy of the classifier is calculated. The accuracy of the classifier shows that the accuracy of the proposed method is 93% compared to the previous algorithms used. The features extracted using GLCM algorithm is more efficient and more reliable which helps the classifier to produce better results.

Fig 2.1 Block Diagram

The block diagram of the proposed method for apple diseases identification is shown in Fig 2.1

    1. Preprocessing

      In preprocessing the noises in the images are removed. A noise in the image represents the unwanted pixels. The Wiener Filter is applied to remove noises from the image. This will smooth the image and make all the pixels in the image clearer. In Preprocessing, wiener filter is used to remove Gaussian noise present in the images. Images are reconstructed and shadows are removed. PSNR value also computed to know filtering accuracy.

    2. Segmentation

      The main aim of segmentation is to separate and/or change the representation of an image into something that is more meaningful and easier to analyze. If the images are classified as abnormal images the infected region is segmented K-means algorithm is used to segment the images. The input color image of the fruit is transformed from RGB to L*a*b* Color Space. The defected regions are grouped into a single cluster. The image is segmented into clusters based on the pixel value changes in the image

      Algorithm Steps for K- means clustering

      Let S = {w1,w2,w3,..,wn} be the set of data points and V = {u1,u2,.,uc} be the set of centers.

      1. Randomly select c cluster centers.

      2. Calculate the distance between each data point and cluster centers.

      3. Assign the data point to the cluster center whose distance from the cluster center is minimum of all the cluster centers..

      4. Recalculate the new cluster center using:

        Where, ci represents the number of data points in ith cluster.

      5. Recalculate the distance between each data point and new obtained cluster centers.

      6. If no data point was reassigned then stop, otherwise repeat from step 3).

    3. Feature Extraction

      Feature extraction gives reducing amount of resources required to analysis a large set of data very accurately. For Feature extraction GLCM algorithm is used. Also referred as co-occurrence distribution. It is the most classical second-order statistical method for texture analysis. The GLCM functions gives the texture of an image by computing how often pairs of pixel with specific values and in a specified spatial relationship occur in an image, creating a GLCM, and then extracting statistical measures from this matrix [10]. Texture feature calculations use the contents of the GLCM to give a measure of the variation in intensity at the pixel of interest. GLCM texture feature operator produces a virtual variable which represents a specified

      texture calculation on a single beam echogram. Following 23 properties are measured.

      Computed Features are,

      1. Autocorrelation

      2. Contrast

      3. Correlation: matlab

      4. Correlation

      5. Cluster Prominence:

      6. Cluster Shade

      7. Dissimilarity

      8. Energy: matlab

      9. Entropy

      10. Homogeneity: matlab

      11. Homogeneiy

      12. Maximum probability

      13. Sum of squares: Variance

      14. Sum average

      15. Sum variance

      16. Sum entropy

      17. Difference variance

      18. Difference entropy

      19. Information measure of correlation1

      20. Information measure of correlation2

      21. Inverse difference (INV) is homom

      22. Inverse difference normalized (INN)

      23. Inverse difference moment normalized

    4. Feature Selection

      Feature selection gives the best features for classification. Dimensionality of the features is also reduced. It can significantly improve a learning algorithms performance. Particle Swarm Optimization (PSO) algorithm is used which chooses best features and eliminate irrelevant, noisy and redundant features in the calculated subset of features. For diseases classification in fruit, out of 23 features only 14 features are selected by PSO [5]. And these features are very accurate and important.

    5. Classification

Classifier performs classification of remotely sensed data, which is used to assign corresponding levels with respect to groups with homogeneous characteristics, with the aim of discriminating multiple objects from each other within the image [6]. In this proposed work the Support Vector Machine (SVM) Classifier can be used to disease affected apple fruit.


        1. Data set preparation

          To show the performance of the proposed method, we have collect a data set of healthy apple and Unhealthy apple fruits, which contains four different categories: Apple Blotch , Apple rot, Apple scab, and Healthy Apple: totalizing 237 apple fruit images. Fig. 6 represents the classes of the data set. Collected dataset apple fruit images are more realistic and captured in real-time.

          Figure 3.1 Sample Images from different data set

          The figure 3.1 shows the sample images from data set of type (A) Healthy apple,(B) Apple Rot,(C) Apple Scab,(D) Apple Blotch

          Category-A repsents healthy apple Category-B repsents apple rot Category-C repsents apple Scap Category-D repsents apple Blotch

        2. GLCM Features for category-A













          Cluster Prominence



          Cluster Shade















          Maximum Probability



          Sum of squres




          Sum variance



          Sum averge



          Sum Entropy



          Difference Variance



          Diference Entropy



          Information measure of correlation



          Inverse difference normalized



          Inverse difference moment normalized



          Table 3.2 shows the maximum to minimum GLCM features of all four Category images. Grey co-matrix creates a GLCM by calculating how often a pixel with grey level value (i) occurs horizontally adjacent to a pixel with value (j).

          Each element (i, j) in GLCM specifies the number of times that the pixel with value i occurred horizontally adjacent to a pixel with value j. The Table 3.2 shows the GLCM features values for the different disease affected apple.

        3. Recognition Results

          Figure 3.3 shows the for the given apple images are identified as apple rot

          Figure 3.3 Recognition Results for Category B

        4. Performance Analysis

          Results Comparisons of all Four Category Apple Images PSO Optimized SVM


          Total images









          1mins 03secs









          1mins 14secs


          Table 3.4 Performance comparison of results optimized PSO-SVM

        5. Results Comparisons of all Four Category Apple Images PSO-SVM














          1mins 00secs








          1mins 09secs


          Table 3.5 Performance comparison of results PSO-SVM

        6. Result Discussions

      With feature selection, the PSO-SVM approach yields a higher classification accuracy compared with those without feature selection. The features selected by PSO are able to classify more accurately than direct SVM classifier. The overall classification accuracy of direct SVM is 90.86

      %. And the overall accuracy of the PSO-SVM is 91.7525.

      This means that not all features are needed to achieve total classification accuracy. The computation time used in PSO is less than in GAs. The parameters used in PSO are also fewer. However, if the proper parameter values are set, the results can easily be optimized.


      The presented algorithm that segments the apple images to identify the defected region and classifies the given image using the features extracted. In the preprocessing stage the noise in the images are removed. The color channels of the images are separated and color histogram is applied to each color channels. The GLCM algorithms were used to extract the features the apple images are converted into L*a*b color format. Using the extracted features and the true label the SVM classifier identified the defects in the apple such as apple scab, apple rot, apple Bloch. It is find that by using direct classification of SVM requires more time to take execution and accuracy is 91.1%. Here all GLCM features are extracted and classified. By using SVM with PSO optimized features gives improved accuracy about 93% and less execution compared than direct SVM classification. The proposed solution can significantly support automatic detection and classification of apple fruit diseases. Future work includes the simulated results to be implemented in hardware for automatic sorting defeated fruit using conveyor belt or robotic arm.


  1. Ahonen.T, Hadid.A, and Pietikäinen.M, Face recognition with Local Binary Patterns: application to face recognition, IEEE Trans. on Pattern Analysis and Machine Intelligence, vol. 28, no. 12, pp. 2037- 2041, 2006.

  2. Ayan Sea Feature Selection using Particle Swarm Optimization for Thermal Face Recognition R. Chaki et al. (eds.), Applied Computation and Security Systems, Advances in Intelligent systems and Computing 304

  3. Anand Singh Jalal Detection and Classification of Apple Fruit Diseases Using Complete Local Binary Patterns IEEE Trans. On Image Processing, vol. 9, no. 7, pp. 1657-1663, 2012

  4. Bhavini J. Samajpati and et al A Survey on Apple Fruit Diseases Detection and Classification Computers and Electronics in Agriculture, vol. 36, pp. 215223, Nov. 2015

  5. Bilal M. Zahran Texture Feature Selection Using Particle Swarm Optimization Word Applied Sciences Journal 7 (Special Issue of Computer & IT): 69-74, 2009 ISSN 1818-4952

  6. Chung-Jui Tu and et al Feature Selection Using PSO-SVM IAENG International Journal of Computer Science, 33:1, IJCS_33_1_18 ,2007

  7. Dana Elena Ilea et al Color Image Segmentation Using A Spatial K- Means Clustering Algorithm Computers and Electronics in Agriculture, Elsevier; vol. 70, pp. 96-104, 2015

  8. Guo.Z, Zhang.L, and Zhang.D, A completed modeling of local binary pattern operator for texture classification, IEEE Trans. On Image Processing, vol. 19, no. 6, pp. 1657-1663, 2010

  9. Gonzalez.R, R. Woods, Digital Image Processing, 3rd ed., Prentice-

    Hall, 2007

  10. Harsha vardhan.M and et al GLCM Architecture For Image Extraction International Journal of Advanced Research in Electronics and Communication Engineering Volume 3, Issue 1,

    January 2014

  11. Hartman.J, Apple Fruit Diseases Appearing at Harvest, Plant Pathology Fact Sheet, College of Agriculture, University of Kentucky, December 2011

  12. Huang.X, Li.X.S, and Wang.Y, Shape localization based on statistical method using extended local binary pattern, in Proc. International Conference on Image and Graphics, 2004, pp.184-187

  13. Kleynen.O, Leemans.V, and Destain.M.F, Development of a multi- spectral vision system for the detection of defects on apples, Journal of Food Engineering, vol. 69, pp. 4149, 2005

  14. Kim.M.S, Lefcourt.A. M., Chen Y. R., and Tao.Y, Automated detection of fecal contamination of apples based on multispectral fluorescence image fusion, Journal of food engineering, vol. 71, pp. 8591, 2005

  15. Li.Q, Wang.M, and Gu.W, Computer vision based system for apple surface defect detection, Computers and Electronics in Agriculture, vol. 36, pp. 215223, Nov. 2002

  16. Swati Dewliya and et al Detection and classification for apple fruit diseases using support vector machine and chain code International Journal of Scientific and Research Publications, Volume 2, Issue 3, May 2015 1 ISSN 2250-3153.

Leave a Reply