Arecanut Grade Analysis using Image Processing Techniques

Download Full-Text PDF Cite this Publication

Text Only Version

Arecanut Grade Analysis using Image Processing Techniques

Pushparani M.K SAP,Dept E&C, MITE,Moodabidri Mangalore, India.

Dr. D Vinod Kumar Professor, Dept E&C VMKVEC,

Salem.TN, India.

Dr. Abdulla Gubbi Professor, Dept E&C BIT,

Mangalore, India.

AbstractThis paper aim is at developing a computer vision based efficient grading system for boiled Arecanuts. Grading of Arecanut is a tedious process in Arecanut marketing. It requires lot of man power and time consuming process. Presently we are implementing the software part of the computer vision system. Economies of scale are derived by functions of pooling and transportation of a graded produce. Grading of Arecanut is a commodity specific function. In this proposed system to categorize Arecanuts into different grades we use MATLAB Toolbox. In this paper we have attempted to find a way to sort Arecanuts using computer vision approach. The Arecanuts differ from one grade to another based on colour, size, and texture. So, the features selected for classification are colour and texture. To extract colour information the image is converted to HSV colour space and quantized to create an 8x2x2 histogram summarizing the colour characteristic of the arecanut. The texture information is extracted using the Gabor transform and the average amplitude and mean squared energy values. This information is fed to a SVM classifier designed using a radial basis function for training. The resulting SVM model is used to run the SVM classifier for classification of the arecanut.

KeywordsHistogram;HSV;SVM;MATLAB;Gabor transformation;


    In this paper the Grading of Arecanut is a pivotal function in marketing. It enables the produce to be classified into different homogeneous categories by various dimensions. By this, it facilitates the producer to discover prices commensurate with the quality of the produce. Grading as a language is an effective communication medium to transfer consumer needs into action either by producer or traders or both. Areca, (Areca catechu L.) is a common masticator nut, consumed by all sections of the population, cutting across caste, class, region, religion, age and gender in India. Arecanut forms an essential requisite for several religious and social ceremonies and its use dates back to Vedic period with high antiquities. India is the largest Arecanut producing country and Karnataka is the major producing state in India. Being a high valued commercial crop, its contribution in terms of livelihood, employment and income to the National Economy is significantArecanut Grading system can be used by farmers to pre-sort the arecanuts before selling it to the wholesale dealers, thereby ensuring better return on their investments.

    The grading machine can also be used by the arecanut distributors who manage large amount of arecanut stock.

    With minor modifications we can use the same techniques to sort blueberries, and fruits. So, in a place where sorting is required then same machine can be used to sort multiple items and reduce operating costs. In this proposed system to categorize Arecanuts into different grades we use MATLAB Toolbox. Here utilize supervised machine learning technique to separate into different grades. This technique consists of two phase, one is training and other is testing phase. The training phase needs database creation using sample images. The training data consist of a set of training examples. The testing phase includes extracting feature of a single image called Query image and matching it with the database. In supervised learning, each example is a pair consisting of an input object and a desired output value (also called the supervisory signal). A supervised learning algorithm analyses the training data and produces an inferred function, which can be used for mapping new examples.

    For creating database need to extract different features, extract colour feature and texture. To extract colour feature use HSV Histogram colour transform. It can effective extract colour features of each image which is one of the parameter for Arecanut classification. For the texture recognition use Gabor filter and Gabor wavelet transforms. Gabor filter (or Gabor wavelet) has been widely adopted to analyse texture features for image retrieval and its efficiency has already been proven. Basically, Gabor filters are a group of two- dimensional wavelets and each wavelet captures energy at a specific frequency and a specific direction. Expanding a signal using this basis gives a localized frequency description, hence it can capture local features or energy of the signal. After applying these wavelets, texture features can then be extracted according to the resulting energy distributions. The scale (or frequency) and orientation tuneable property of Gabor filter makes it especially useful for texture analysis. Using these features need to classify the Arecanuts into different grades. This paper used Support Vector Machine as classifier. In machine learning, support vector machines are supervised learning models with associated learning algorithms that analyse data and recognize patterns, used for classification and regression analysis.

    The basic SVM takes a set of input data and predicts, for each given input, which of two possible classes forms the output, making it a non-probabilistic binary linear classifier. Given a set of training examples, each marked as belonging to one of

    two categories, an SVM training algorithm builds a model that assigns new examples into one category or the other. An SVM model is a representation of the examples as points in space, mapped so that the examples of the separate categories are divided by a clear gapthat is as wide as possible. New examples are then mapped into that same space and predicted to belong to a category based on which side of the gap they fall on. In addition to performing linear classification, SVMs can efficiently perform a non-linear classification using what is called the kernel trick, implicitly mapping their inputs into high-dimensional feature spaces.

    According to the survey conducted by National Horticulture Board, GOI, the total area under cultivation is 4,00,110 hectares and the annual production estimated at 4,78,110 metric tons, with Karnataka and Kerala accounting for nearly 72% of total production . Over 6 million people are engaged in Arecanut cultivation, processing and trade. More than 85% of the area under cultivation is made up of small and marginal holdings. In Arecanut processing major time consuming step is grading it into market standards. As per the guidelines of Central Arecanut and Cocoa Marketing and Processing Cooperative Ltd. (CAMPCO) in boiled Arecanuts there are different grades based on the region. In Shivamogga and Chikkamagaluru region there are four different grades, which are referred by local names Hasa or Saraku, Bette, Idi or Rashi-Idi and Gorabalu. In Sirsi region there are three grades Aapi, Rashi-Idi and Gorabalu. There is no generalized standard for any of these Arecanut grades. Divided the boiled Arecanuts into four different grades, since we are considering Shivamogga and Chikkamagalur region Arecanut samples for our. We separated collected sample of Arecanuts into four different grades as suggested by 5 different persons, who were well experienced in grading the Arecanuts manually. We have used these Arecanuts for Database Creation. Fig.1.1 shows the four different grades of Arecanut which we used for our project.

    The first grade Arecanut is the tender Arecanut which has irregular shape and texture and usually darker in appearace compared to other grades it has both half-cut Arecanut and full Arecanut. The grade-2 Arecanut is only a half-cut Arecanut and it has regular shape, texture and brownish in colour.

    Grade-1 Grade-2

    Grade-3 Grade-4

    Fig.1 Four different grades of boiled Arecanut.

    The grade-3 Arecanut appearance is similar to grade-2 but it is full Arecanut and has regular texture. The grade-4 Arecanut is fully ripen Arecanut it maybe full or half-cut Arecanut. During dehusking process some of the outer cover is left in the Arecanut which forms a thread like structure on the Arecanut and it is brownish in colour.

    Support Vector Machine (SVM) is a novel technique for pattern recognition because of its high performance in tackling small sample size, nonlinear, high dimensional and a very good machine learning method. The basic idea of SVM is to map the linear non separable input vectors into some higher dimensional space such that a more suitable hyper plane can be found with minimal classification errors.


      1. HSV Histogram

        HSV colour histogram is the acronym of Hue, Saturation and Value; this colour histogram is the closest perception of the human eye. The human eye perceives colours by the excitation of two cells of the eye, which are rods and cones. Excitation of the cone cells leads to perception of colour, while rod cells help in perception of various shades of gray. The HSV colour histogram separates the luminance component (Intensity) of a pixel colour form its chrominance components (Hue and saturation). This representation works as the human eye because it works like the separation of the rods and cones.

        The value V is represented by the main axis orthogonal of the plane. The angle represents the Hue value, while radius represents the level of Saturation. RGB defines colour in terms of a combination of primary colours, whereas, HSV describes colour using more familiar comparisons such as colour, vibrancy and brightness. Mathematical formula used to convert from RGB to HSV colour space are given as follows.

        Fig: 2.2 Representation of a HSV colour descriptor.

      2. RGB to HSV conversion formula

        The R,G,B values are divided by 255 to change the range from 0..255 to 0..1:

        R' = R/255 G' = G/255

        B' = B/255

        Cmax = max(R', G', B')

        Cmin = min(R', G', B') = Cmax – Cmin Hue calculation:

        Saturation calculation:

        Value calculation:V = Cmax

        The histogram is computed and quantized to 8x2x2 dataset for H, S, V values producing 32 values per image. The Hue value is quantized to 8 levels and the Saturation and Intensity values are quantized to only two values. This is so because the important feature being extracted here is the colour which is defined predominantly by the hue value.

        Fig 2.3 HSV components of a sample arecanut

        The script does very basic processing to achieve this. First the image is converted into HSV colour space from the default RGB colour space, the components of the unconverted image is then extracted and stored in different variables. The maximum values of the individual colour components are also taken. The colour matrix is first divided by the maximum value and then multiplied by the allowed bins to obtain the quantized histogram. The histogram is then finally normalized by dividing it with its highest value. The resulting 8x2x2 histogram becomes the first part of the feature set used to train and test the SVM model.

      3. Gabor Wavelet Transform

        Among all kinds of window functions, the Gabor function is proved to achieve the lower bound and performs the best analytical resolution in the joint domain. This function is a Gaussian modulated by a sinusoidal signal and shown below:

        where determines the sharpness and 0 the is modulated

        center frequency of , and is its Fourier transform.

        Fig.1 shows the example of with three different 0 but the same and their time-frequency analysis by Gabor transform. These three distributions have the same area but dont meet the multi-resolution requirement, the window size should depend on the center frequency. To achieve this requirement, we substitute with 0/, where a self-defined

        constant is and make the time duration of dependent on the central frequency 0. The generalized with normalization of the maximum response in frequency domain is now defined as:

        the example of this new-defined with three different 0 but the same and their time-frequency analysis by Gabor transform. The Fig 3.2.1 shows example of with three different 0 =0, 0.5 and 1 but the same =0.5 and their time- frequency analysis by Gabor transform, where (a)-(c) show the real part of and (d)-(f) show the magnitude of the Gabor transform of . This 1-D Gabor function could be extended into 2-D form and also achieve the lower bound of uncertainty principle.

        xr = cos + y sin, yr = -x sin + y cos

        1. (b) (c)

    (d) (e) (f)

    where f is the frequency of the modulating sinusoidal plane wave and is the orientation of the major axis of the elliptical Gaussian. The 2-D Fourier transform of is shown below:

    =+, = +

    The generalized with three different 0 =0.5, 1 and 2 but the same =1 and their time-frequency analysis by Gabor transform, where (a)-(c) show the real part of and (d)-(f) show the magnitude of the Gabor transform of .

    We know that a set of 1-D wavelets is defined as:

    where () is the mother wavelet and a and b determines temporal shifting and scaling of this function.

    (a) (b) (c)

    (d) (e) (f)

    Figure 2.5 Magnitude and real part of Gabor transform with constant

    This definition could be further extended into 2-D wavelet transform as:where (,) is the 2-D mother wavelet, with

    and the scaling parameters, 0 and 0 the spatial

    shifting, and the orientation parameter. The 2-D Gabor

    function defined in 5meets this form and could be seen as a set of self-similar Gabor wavelets. The spatial shifting terms are missing while these could be compensated by the convolution operation between this equation and the input image. To make

    as a set of continuous wavelets, we should make sure

    that obeys the five constraints compact support, real, even symmetric or odd symmetric, vanishing moments, and admissibility criterion. The former three constraints are achieved by setting a magnitude threshold to and separate it into real and imaginary part, while the later two need the DC-free modification to make this wavelet transform reversible and with at least one vanishing moment. This modified Gabor wavelet is defined as:

    where K is an offset parameter dependent on and .

    Linearly Separable Data

    You can use a Support Vector Machine (SVM) when your data has exactly two classes. An SVM classifies data by finding the best hyper-plane that separates all data points of one class from those of the other class. The best hyper-plane for an SVM means the one with the largest margin between the two classes. Margin means the maximal width of the slab parallel to the hyper-plane that has no interior data points. The support vectors are the data points that are closest to the separating hyper-plane; these points are on the boundary of the slab. The following figure illustrates these definitions, with

    +indicating data points of type 1, and 0-indicating data points of type-1.

    Fig 2.6 Optimal Hyper Plane for linearly separable data

    Non linearly Separable Data

    The data might not allow for a separating hyper-plane. In that case, SVM can use a soft margin, meaning a hyper plane that separates many, but not all data points. Some binary classification problems do not have a simple hyper-plane as a useful separating criterion. For those problems, there is a variant of the mathematical approach that retains nearly all the simplicity of an SVM eparating hyper-plane.

    The mathematical approach using kernels relies on the computational method of hyper-planes. All the calculations for hyper-plane classification use nothing more than dot products. Therefore, nonlinear kernels can use identical calculations and solution algorithms, and obtain classifiers that are nonlinear.

    Fig 3.8 Separating data in a higher dimensional space Building SVM for Pattern Recognition

    The rationale for each of these two operations is: operation 1 is performed in accordance with Covers theorem on the separability of patterns which states that a multidimensional space may be transformed into a new feature space where the patterns are linearly separable with high probability, provided two conditions are satisfied. First, the transformation is linear. Second, the dimensionality of the feature space is high enough. Operation 2 exploits the idea of building an optimal separating hyper-plane in accordance with the theory explained in the previous section, but with a few fundamental difference; the separating hyper-plane is now defined as a linear function of vectors drawn from feature space rather than

    -the original input space.


    The applications main GUI is built using the MATLABs own UI building tool called GUIDE. The GUI has three major sections Testing control in the bottom left, Training Controls on the bottom right, and a plotting area in the middle to show output images.

    Fig 3.1 GUI of the Application


processing based arecanut grading application is a novel approach to sort Arecanuts based on their colour and texture. A real-time sorting unit running this application can help the farmer sort the arecanut fast and with higher accuracy than a human performing the same task. Since arecanut is a major cash crop grown in Karnataka, this system would be of great use to farmers who struggle to get the right money for their produce. By selling the sorted nuts at their right prices the farmer would be able to earn more compared to selling it unsorted. The labour charges incurred while sorting is also saved.

  1. T. Brosnan and D.-W. Sun, "Improving quality inspection of food products by computer vision–a review," Journal of Food Engineering, vol. 61, pp. 3-16, 2004.

  2. K. C. Swain, Q. U. Zaman, A. W. Schumann, D. C. Percival, and D. D. Bochtis, "Computer vision system for wild blueberry fruit yield mapping," Biosystems Engineering, vol. 106, pp. 389-394, 2010.

  3. J. Xing, V. Van Linden, M. Vanzeebroeck, and J. De Baerdemaeker, "Bruise detection on Jonagold apples by visible and near-infrared spectroscopy," Food Control, vol. 16, pp. 357-361, 2005.

  4. M. T. Ibrahim, T. Bashir, and L. Guan, "Robust Fingerprint Image Enhancement: An Improvement to Directional Analysis of Fingerprint Image Using Directional Gaussian Filtering and Non-subsampled Contourlet Transform," in Multimedia, 2008. ISM 2008. Tenth IEEE International Symposium on, 2008, pp. 280-285.

  5. A Danthi ,Arecanut grading using 3-sigma RGB colour features using SVM2012

  6. Narendra and Hareesh Computer Vision System to Estimate Cashew Kernel (White Wholes)Grade Colour and Geometric Parameters J Food Process Technol 2014, 5:6

  7. L. Shen and L. Bai, A review of Gabor wavelets for face recognition, Patt. Anal. Appl. 9: 273-292, 2006.


  1. V. Kruger and G. Sommer, Gabor wavelet networks for efficient head pose estimation, Image and Vision Computing, 20(9-10), 665- 672, 2002.

  2. F. Smeraldi and J. Bigun, Facial feature detection by saccadic exploration of the Gabor decomposition, Proc. Intl Conf. Image Processing,

  3. Sanchez-Avila and R. Sanchez-Reillo, Two different approaches for iris recognition using Gabor filters and multiscale zero-crossing representation, Pattern recognition letters, 38(2): 231-2440, 2005

  4. A. K. Jain, R. P. W. Duin, and M. Jianchang, "Statistical pattern recognition: a review," Pattern Analysis and Machine Intelligence, IEEE Transactions on, vol. 22, pp. 4-37, 2000.

  5. C. Bishop, Pattern Recognition and Machine Learning (Information Science and Statistics): Springer, 2007.

  6. W. Zhang, K. Chen, B. Zhang, C. Sun, C. Cai, C. Zhou, W. Xu, W. Zhang, and I. B. Ferguson, "Postharvest responses of Chinese bayberry fruit," Postharvest Biology and Technology, vol. 37, pp. 241-251, 2005.

Leave a Reply

Your email address will not be published. Required fields are marked *