P. 1


|Views: 173|Likes:
Published by Uttapawn Awutpetch

More info:

Published by: Uttapawn Awutpetch on May 29, 2012
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less





Image Processing of an Agriculture Produce: Determination of Size and Ripeness of a Banana

Nur Badariah Ahmad Mustafa, Nurashikin Ahmad Fuad, Syed Khaleel Ahmed, Aidil Azwin Zainul Abidin, Zaipatimah Ali, Wong Bing Yit, and Zainul Abidin Md Sharrif Department of Electronics and Communication Engineering, College of Engineering, Universiti Tenaga Nasional {Nbadariah, NAShikin, syedkhaleel, AidilAzwin, Zaipatimah, Zainul}@uniten.edu.my, ardy_wong@msn.com Abstract
Over the last several decades, customers’ lifestyles and needs have gone through tremendous changes. These changes are new challenges for the farmers whose produce has to meet the customers’ demands. The ability to classify agriculture produce based on size and quality is not only going to help the farmer but also the customer. This will help the farmer to grade the fruit, the seller to price it optimally and the customer value for money. Bananas are classified according to sizes, shapes, textures, colors and taste. The process of getting the size and ripeness of a banana is done from its image using the Image Processing Toolbox in MATLAB. These features are important to determine the optimal size and ripeness. From the size, the grade and type of the banana can be determined. The percentage of ripeness can be determined by evaluating the individual pixels of the image. The types of bananas are specified according to the variation in their sizes and texture. In terms of size a banana can be classified as extra large (XL), large (L), medium (M) and small (S)[1]. The first type of banana ‘Mas,’ is very sensitive to the environment. It has thin skin and the flesh is yellow and easily bruised. It has a pleasant aroma and very sweet flesh. The second type of banana ‘Berangan,’ has big bunches. The skin is thick and it has yellowish orange, pleasant aroma and sweet flesh. The third type of banana, ‘Cavendish (Embun),’ has a thick and smooth skin. It has white, fine textured, pleasant aroma and sweet flesh with a large size finger [10]. The quality of banana is determined by extracting several features from its image. This paper is divided into 4 sections. Feature selection is discussed in section 2. Six methodologies of edge detection are discussed, tested and compared in order to get the best method of edge detection. In this section, the area, perimeter, length and thickness of a banana are determined using MATLAB. In section 3, the discussion is focused on ripeness percentage. The ripeness percentage is done based on the color changes. When ripe, the fruit turns yellow. Section 4, is the conclusion of this paper.

1. Introduction
Over the last several decades, customers’ lifestyles and needs have gone through tremendous changes. These present new challenges for the farmers whose produce has to meet the customers’ demands. The ability to classify agriculture produce based on size and quality will benefit both farmers and consumers. This will help the farmer to grade the fruit, the seller to price it optimally and the customer value for money. In Malaysia, banana is the second cultivated plant after durian. It is grown all over the states and is available throughout the year. This paper focuses on Cavendish (Embun), Mas and Berangan which are classified according to its size, shape, texture, color and taste.

2. Feature Selection
Feature detection is a low level image processing operation where it is usually performed as the first operation on an image. A feature can be defined as the “interest” part of an image. The name feature is often used in the pattern recognition literature to denote a descriptor [8]. The desirable property for a feature detector is repeatability; i.e., whether or not the same feature will be detected in different images of the same

978-1-4244-2328-6/08/$25.00 © 2008 IEEE

Edge detection extracts edges of objects from an image. The degree of blurring the image is controlled by the standard deviation. Taking derivative on each and every pixel of the image consumes a lot of computer resources and hence it is not that practical. where it returns the edges at those points where the gradient of the image intensity is at maximum.00 © 2008 IEEE . an operation called kernel operation is carried out.scenes. The only difference between them is the approximation of the first derivative. Zero crossing method is preferable because of their noise reduction capabilities and potential for rugged performance [9]. These are either gradient based or zero crossing based. To solve this. The computational speed for this detector is fast and produces finer lines than other edge detection methods (see Figure 4). lines and junctions usually convey the most relevant information of an image. a Gaussian filter is being used to filter out the image. to the corresponding image matrix elements and their sum is put at the target pixel. hence it is important to detect them in a reliable way. The Prewitt method is simpler to implement computationally than the Sobel method. formulas are applied on each pixel in the image and two kernels are obtained. The Zero-Cross detector (see Figure 6) works similar to the LoG detector. In gradient based edge detection. The function edge in MATLAB can be used to find edges in a grayscale image (see Figure 1). a gradient of consecutive pixels is taken in x and y directions. Step edges. termed zero crossing. It is the most common approach for detecting meaningful discontinuities in grayscale images [9]. Prewitts and Roberts) use the approximation of the first derivative of the intensity function. The purpose of the Gaussian filter is to smooth the image before the Laplacian operator provides the image with zero crossings in order to establish the location of the edges. Roberts’ method in edge detecting is one of the earliest techniques. where the edge in the image is only marked once and image noise does not create false edge. the algorithm takes the first or second derivative on each pixel in the image. A very large number of features detectors have been developed. In Sobel edge detection technique. There are a number of algorithms for edge detection. there is a rapid change of intensity. Figure 2: Edge Detection using Sobel Method Figure 3: Edge Detection using Prewitt Method Figure 1: Grayscale Image of a medal The first three of the edge detection methods (Sobel. While in derivative based edge detection. which are multiplied. The zero crossing property of the second derivative is quite useful for locating the centers of thick edges[9]. By referring to Figure 2 until Figure 7. The resultant matrix is then obtained by taking the square root of the sum on the squares of those two kernels. This detector is considerably 978-1-4244-2328-6/08/$25. In case of first derivative at the edge of the image. The Prewitt and Sobel operators are among the most used in practice for computing digital gradients[6. A kernel is a small matrix sliding over the image matrix-containing coefficients. we can see that Canny’s method (see Figure 7) has good detection and localization with minimal response. However. Edge detection has been extensively analyzed in computer vision during the last 20 years but it has not yet been entirely solved [7]. except that it allows the user to specify the filter used for filtering the image. but tends to produce noisier results. The In Laplacian of Gaussian (LoG) method (see Figure 5). The Sobel detector provides a smoothing effect and it reduces the noise content in the image.9]. While in case of second derivative there is zero pixel value. There are six methods available for edge determination using MATLAB [6]. the performance of this detector is quite poor with significant noise.

The ‘weak’ edges are included if they are connected to the strong edges.a Bunch of Bananas Figure 4: Edge Detection using Roberts Method Figure 5: Edge Detection using LoG Method Figure 9: Edge Detection of a Banana Bunch using Canny’s Method 2. Figure 9 was produced by using the edge function in MATLAB. the dark patches on the banana itself will result in a pixel count that is less than the true pixel count of the selected region.1 Determination of area. length and thickness The function regionprops in MATLAB can be used to measure properties of a selected region of an image in pixel count. Canny’s method determines the edges by locating the local maxima and minima of the gradient of the intensity function [6].strong due to its ability to detect weak edges. the raw image is convolved with a Gaussian filter. Figure 8 shows the grayscale image of a bunch of bananas. These dark patches can be inside the image or lying at the Figure 6: edge detection using zerocross method Figure 7: edge detection using Canny method 978-1-4244-2328-6/08/$25. high and low. the actual image needs to be converted into a binary image. However. Before applying the function regionprops.00 © 2008 IEEE . The edges are smooth and well defined considering the shadow of the image. which result in a slightly blurred image. The high threshold is applied first where it marks out the edges that are fairly ‘obvious’ and strong. The local gradient and the edge direction can be determined by taking the first derivate of the intensity function. is used to trace the boundary of a selected region in an image. Figure 8: Grayscale Image . these dark patches need to be identified and compensated before getting the boundary and selecting the region. perimeter. The edges are traced through the image using two thresholds values. Therefore. To begin with. A function called bwboundaries. This labeled region will be represented in a twodimensional array of non-negative integers.

Hence. 2⎠ 2 ⎠ ⎝ ⎝ The pixel count of the coin from the image is 22137.013 = 12. Figure 12 shows the black and white image with ‘holes’ while Figure 13 shows the image after filtering out ‘small holes’ in Figure 12.014cm 164 In order to determine the perimeter. which is acceptable.22cm 1 pixel ⎛d ⎞ 2π ⎜ ⎟ ⎝ 2 ⎠ = 7. properties such as area. The calculation of area is inaccurate as the bottom of an image is unfiltered.0129 = 29. perimeter. In this study. Hence Thickness = 301 × 0. The pixel count of the perimeter for the coin is 558. The area is the actual number of pixels in the labeled region. The major axis length of the banana is the length (in pixels) of the major axis of the ellipse that has the same normalized second central moments as the regions.3 = 0. while the minor axis length is the minor axis of the ellipse [2]. Hence 1 pixel = 2 .2cm Physical measurement estimates an area of 36. The pixel count of the major axis length for the coin and banana are 172 and 901 respectively.boundary of the image.155 = 1. The dark patches present at the boundary may be part of the object (banana) or the background.155cm . the pixel count less than 2500 connected to the main object are assumed to be part of the object and can be removed using the MATLAB function bwareopen.0129cm = 558 558 perimeter = 2255 × 0. the small region of dark patches at the bottom of the banana is removed after using this function. Below is the calculation to determine the actual perimeter of the banana.013cm 172 Length = 901 × 0.8776 × 10 − 4 cm 2 . Those present inside the image are ‘holes’ that can be easily identified and ‘filled’. The major and minor axis length can represent the actual length and thickness of a banana. However. In extension. the type of banana also can be verified from this dimension. Figure 10: Original Image of a Single Banana with a 20-cent Coin as Reference Area = 198541 × 1. the perimeter of the 20-cent coin is used as a reference.3cm 2 .226 = 0. the filtered black texture near the edge of banana is excluded in area calculation. the pixel count of the area is 198541 pixels. For this paper. length and thickness. Hence 2 2 1 pixel = 4. The pixel count for the perimeter is 2255 (see Figure 14). the larger the pixel counts.03cm The pixel count of the minor axis length for the coin and banana are 164 and 301 respectively.8776 × 10 −4 = 37. The pixel count for the length and thickness are 901 and 301 respectively (see Figure 14). diameter and perimeter are known. A reference object is needed to be able to translate the pixel count to area. ⎛d⎞ ⎛ 2.75cm2. perimeter. regionprops computes the perimeter by calculating the distance between each adjoining pair of pixels around the border of the labeled region [2]. the property of major and minor axis length are only supported for a 2-D image input. The pixel count of the processed image (see Figure 14) depends on the distance between the camera and the object when the picture is taken. The smaller the distance. 978-1-4244-2328-6/08/$25.3cm ⎞ 2 Acoin = π ⎜ ⎟ = π ⎜ ⎟ = 4. The reference object is an object whose area. The physical measurement yields a value less than the experimental result because from the experiment. After getting the boundary of the selected region. The MATLAB function imfill is used to fill any holes so that regionprops can be used to estimate percentage area enclosed by each of the boundaries [2]. 22137 For banana.014 = 4. In Figure 13. a 20-cent coin is chosen whose area is: In order to determine the length and thickness.00 © 2008 IEEE . Therefore 1 pixel = 2. This measurement determines the size of a banana. we use the diameter of the 20-cent coin as a reference.3 = 0. major and minor axis length can be determined.

The range of L-axis is from 0 for all black to 100 for all white. Black color is determined by zero intensity.5]. The unripe fruit is indicated by the irregular green color with lighter spots and has starchy pulp [3].30 pixels Major Axis= 12. almost ripe. The first step to determine the ripeness or yellow percentage is by recognizing the color parameter.27 pixels Major Axis= 2. 978-1-4244-2328-6/08/$25.03 cm Area=198748. Figure 12: Black and White Image. It is done based merely on observation and through experience.40 pixels Minor Axis= 4. There are six stages of the ripeness percentage.30 cm Perimeter= 557. pre-mature. The Yellow color is the equal composition of Red and Green intensities with zero Blue intensity.45 cm Minor Axis= 163. The a-axis is ranges from red to green.00 pixels 2 Area= 37. Figure 13: The 'small holes' in Figure 12 is filled. the color parameters are Yellow. L-axis represents lightness or brightness of the image [4]. Yellow color is determined by the difference between Red and Green intensities. Ripeness Percentage There is no specific method for farmers to determine when to pluck the fruits. The range of a-axis is from 128 (green) to 127(red). For bananas. The difference is set to be less than 20%.62 pixels Minor Axis= 2.11 cm Minor Axis= 301. the ripeness is dependent on the types of bananas and is based on its color changes.16 cm Figure 11: Converting the Color Image to Grey Image.The number of pixels for each object Perimeter= 2255.02 cm Major Axis= 901.77 pixels Perimeter= 7.30 cm Area=22137.00 © 2008 IEEE . The harvesting period starts 8 – 13 months after planting when the fruit is still green. ripe and too ripe. Figure 14: Number of Pixels and Actual Dimensions 3. The color-based segmentation by using the L*a*b* color space is used to categorize colors by analyzing L*a*b* color space [2]. The range of b-axis is from -128(blue) to 127(yellow)[4.26 pixels Perimeter= 30. In this paper. The b-axis is ranges from yellow to blue. almost mature.00 pixels 2 Area= 4.18 cm Major Axis= 172. For banana. There are unripe. L*a*b* color space illustrate colors by positioning them along 3-axes in 3dimensional color space. It is a measurement of the white to black content of any color. Black and Green.

” in The Image Processing Handbook. B. Info Pengguna.Russ. in determining the quality of the banana itself based on the size and ripeness. the image intensity will be converted to a binary image by using the im2bw function [2].org/. Ahmed. 2002. Figure 15: Total of Yellow and Green Pixels based on Figure 10. Zainul Abidin. Based on the calculation. Pellegrino. A. MA: The Mathworks. K. “Image Processing of a Banana: Area Determination via Edge Detection Using MATLAB. June 2004. A. Upper Saddler River. Third Edition. Total _ of _ white _ pixels From Figure 15 and 16. Conclusions In this paper we used the image processing toolbox in MATLAB in order to determine the size and ripeness of a banana from its image. Color Management Topic. Vanzella and V. The graythresh function is specifically used to compute a global threshold. Y.00 © 2008 IEEE . Torre. “Object recognition. Ali. Second Edition. Shariff. it shows that the banana is ripe and ready to eat.34. CRC Press LLC and SpringerVerlag GmbH & Co.” 4th International Colloqium on Signal Processing and its Applications. “How L*a*b* works”. Woods. 2007. Spesifikasi Piawaian dan Gred. http://www.” in Digital Image Processing. Pisang. With this function. pp50-51 [6] S.Types of Bananas. January 1998. Percentage = 16795 = 86 . the number of yellow color pixel is 16795 pixels and total pixel of white color is 19352 pixels. In order to estimate the total pixels. Man and Cybernetics – PART B: Cybernetics. Image Processing Toolbox User’s Guide Version 2.79 percent . L*a*b* and ICC Profiles. 2000-2006 [4] Wasatch Computer Technology. the white color is assumed as the total pixels and it is set as yellow color. Md.com/. pp. pp 1-2 [2] The Mathworks. Online Cooking Classes. Products. Inc.1. 25 March 2008 [5] John C. 978-1-4244-2328-6/08/$25.15001518. Z. C. W. the MATLAB function graythresh is used. “Edge Detection Revisited.The total number of pixels is estimated by converting the image to black and white image. 19352 5. [7] F. [8] R. March 2008. Wong and Z. Figure 16: Total Pixels of white color and the Ripeness Percentage.” IEEE Transaction on Systems. References [1] FAMA Xchange. http://www. A. “Color Spaces. [3] Chef Eric. Based on black and white image. “Types of Bananas and Conditioning”. NJ: Prentice Hall Inc. Banana . Future work will involve implementing artificial intelligence methods such as fuzzy logic and/or neural networks. Gonzalez and R. Therefore. Vol.wasatch. http://www.. the ripeness percentage is: Acknowledgement This project is funded by MOSTI under science project number 01-02-03-SF0094. Number _ of _ yellow _ pixels × 100 %. The ripeness percentage can be determined by: 4.911cheferic. A.com/ Learning Library. 327 – 330. KG. pp. The key idea is the edge detection and the color changes that help us in determining the quality of the banana. 1998. “Siri Panduan Kualiti Pisang”. Food Articles.famaxchange. E.

Varieties. 25 March 2008. Malaysian Varieties. E.” in Digital Image Processing.[9] R. M-N. 2002.com/ . NJ: Prentice Hall Inc. Upper Saddler River. http://webebananas. C.00 © 2008 IEEE . “Encanto Farms”. Woods. “Image Segmentation. 978-1-4244-2328-6/08/$25. Gonzalez and R. [10] We Be Bananas in San Diego. Second Edition.

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->