Mobile e-detection of Banyuwangi’s citrus fruit maturity using k-nearest neighbor

Banyuwangi is the largest oranges-producing city in East Java, and the orange produced is Siamese citrus fruit. Siamese is Banyuwangi local citrus fruit often found at the harvest time and has a sweet taste. To determine the citrus fruit level, people can detect it from the color and texture. In this modern era, people can use an application to determine the citrus fruits' maturity level. From the elements of color and texture, this research will add the citrus fruit's contours, namely the pore size of the citrus fruit and the distance between the curve of the tip of the orange. Taking pictures of citrus fruits will be following the application stages that will be used as the image of inputting the data. The detection is then conducted using the K-NN method based on several criteria based on the input image after the feature extraction process. The feature extraction stages are segmentation, normalization, thresholding, and thinning, which will be produced in several criteria: the maximum RGB value, the minimum RGB value, pore size, and the distance between the tip's curve of the orange. The research results that have been carried out are based on the research stages to get a similarity percentage following the inputted data. The E-Detection application can provide information to citrus farmers, especially beginner citrus farmers, to know the level of fruit maturity oranges to be harvested.


I. Introduction
In the previous research, by testing the detection of 10 (ten) tangerines, it was known that the level of maturity at ripe conditions was 2 (two) tangerines with a suitability value between 72.94% to 82.68%. For the condition of Mengkal, as many as 4 (four) tangerines with a suitability value between 59.09% to 81.20% [1]. The raw conditions have four tangerines with a suitability value between 69.02% to 77.60%. For improving system performance in the form of an Android-based application of tangerine fruit ripeness detection, further research is suggested to add other intelligent functions, such as a function that can recognize the shape of an object its texture [2].
Citrus fruit is a non-climacteric fruit obtained from the trees only or cannot be ripened after harvesting. So it is essential to pick or harvest citrus fruits when they are ripe. After harvesting, the fruit with a sour taste will not be sweet because there is no ripening process after harvesting [3]. Color is one of the attributes that could be used to identify specific objects. It is not included in the extraction of information about the object's surface's spectral properties and seeking information from a set of known descriptions to carry out recognition [4]. Recognition of the image objects can use the basic color differences of RGB (Red, Green, Blue) [5], [6].
There are various ways to extract color from an image. The simplest method which is often used is the color histogram [7] and color moment [8]. Both methods can be evaluated using several different color spaces, namely RGB, HSV, YUV, LAB, and YCrCb [9], [10]. The color histogram represents the distribution of colors in an image. The advantage of using color histograms in image analysis is its reliability on rotation, scaling, and relatively fast computation times. On the other hand, the disadvantage of color histograms is that they tend to lose spatial information and high sensitivity to noise disturbance [11]s, such as changes in luminance intensity and quantization errors [12]- [14].
The classification is a critical process to distinguish one thing from another, and it could be in the form of animals, plants, or humans [15], [16]. This identification could be taken by focusing on the A BS T RA C T Banyuwangi is the largest oranges-producing city in East Java, and the orange produced is Siamese citrus fruit. Siamese is Banyuwangi local citrus fruit often found at the harvest time and has a sweet taste. To determine the citrus fruit level, people can detect it from the color and texture. In this modern era, people can use an application to determine the citrus fruits' maturity level. From the elements of color and texture, this research will add the citrus fruit's contours, namely the pore size of the citrus fruit and the distance between the curve of the tip of the orange. Taking pictures of citrus fruits will be following the application stages that will be used as the image of inputting the data. The detection is then conducted using the K-NN method based on several criteria based on the input image after the feature extraction process. The feature extraction stages are segmentation, normalization, thresholding, and thinning, which will be produced in several criteria: the maximum RGB value, the minimum RGB value, pore size, and the distance between the tip's curve of the orange. The research results that have been carried out are based on the research stages to get a similarity percentage following the inputted data. The E-Detection application can provide information to citrus farmers, especially beginner citrus farmers, to know the level of fruit maturity oranges to be harvested.
Keywords: E-Detection Citrus Fruit Maturity K-NN RGB Value characteristics of something. One way to classify the citrus fruit is using the naive Bayes method in an image-based way [17], [18]. Their texture and color could recognize citrus fruit. Citrus fruit has identical colors; they are green and yellow. In some cases, people sometimes have difficulty in classifying orange and mandarin oranges [19].
In this study, the k-nearest neighbor (K-NN) method was used to detect citrus fruits' ripeness with several criteria for color, contour, and texture. This study was contributed to the model development of the soft computing approach applied to the mobile application.

II. Method
Before processing the input image, the image data (direct image captured by gadgets such as a mobile phone or tablet) are sent to the server. The types of file compression supported in this study are limited to several types, namely jpg, bmp, gif. There are several provisions or rules in shooting fruit, including: a. The fruit picture is taken in an upright position. b. Besides, ensure that there is no cut-off part of the fruit, and the limitation for the left, right, top, and bottom shootings are right at the border of the leaf fruit. c. There will only be one fruit in the image. d. The fruit pictures could be detected when it is lighter than the background color. e. The system has a minimum and maximum limit for the image resolution. f. The largest size of the image is limited to 1300 x 1300 pixels, and the lowest is 80 x 80 pixels.
After taking the image, the resizing process is carried out in 150 x 150 pixels. For speeding up the recognition process, an example of resizing can be seen in Fig. 1. A. Algorithm Design The first step of Algorithm design in this study is processing the input image to be processed in a different process, known as preprocessing. The preprocessing process starts from browsing the file name; then, the filtering process is carried out. Then, in the image segmentation, the thresholding process is conducted after separating the image from the background.
The second process calculates the minimum and maximum points for each red, green and blue color component. This calculation will be used as the criteria that use the k-nearest neighbor (K-NN) method [20]. The preprocessing process is used to find the curve points to the centroid. The data will be used in the recognition process using the K-NN method. The next stage is to calculate the K-NN method using 8 (eight) criteria, including the minimum and maximum Red, Green, and Bluepoints, the minimum distance of the curve point to the centroid, and the curve points maximum distance to the centroid.
The final result is a percentage value of the closeness between the input image and the database's image (data training). In the K-NN method, the citrus fruit data matches the 8 (eight) criteria for each citrus fruit. Last, the information about the citrus fruit maturity will be shown in the final result. The block diagram is shown in Fig. 2

B. Software Development Design
The system architecture created explains the relationship between an admin, user, and database in an application. After the detection process, the system architecture flow's resizing process could be seen in Fig. 3.

Filtering Process
The filtering process has a function to smooth the image in the image by using the linear filtering method with the low pass filter method by taking low frequencies, removing high frequencies and carrying out blur effects, and noise the reduction.

Edge Detection
Edge detection is an image that produces the edges of image objects. The purpose of doing edge detection is to mark the part that becomes the detail of the image and improve the blurred image's detail. This study's edge detection process is from the segmentation process results using the Sobel method applied to the respective RGB values with gray-level values between 0-255.

Thinning
The thinning process was first carried out at the coordinate point (x, y), namely the coordinates (0.75) of the pixels at the center point of the coordinate axis on the 150x150 pixel image. The search is carried out if the first point is found and will be continued at the next point by tracing clockwise based on calculating the 8-connected component approach.

C. System Analysis
In this study, the system's preparation was made in 2 stages: system analysis and system design. For the system analysis, the author uses the Unified Modeling Language (UML), and the author describes the form design of the application.

Business Process
The business process describes the flow of the application for admins and operators. During an admin using the application, he logs in first to use the application; then, he could input the testing's orange data. After the orange data has been entered into the database, the operator can operate the application. Without the login step, the operator can use the application by taking photos of oranges and citrus data. Then, based on the orange data that has been inputted by the operator using the citrus data collection process and the existing methods, the application can provide the information about the citrus fruit maturity for the operator.

Use Case Diagram
Admins and operators use the E-detection application following the access rights that exist in the application. An admin can access all applications, including inputting, processing, and editing both user data and orange data, by logging in to access them. Meanwhile, the operator can only use the application to detect citrus fruit's maturity by inputting the required data about citrus fruits. The use case image can be seen in Fig. 5.

III. Results and Discussion
The detection process was previously carried out; several steps needed to be conducted, including inputting photos of oranges to be detected, the cropping process, and inputting texture data, including the size, texture, and pores. After inputting the photos, the next step is the cropping process according to the specified size. It is 150 X 150 as for the cropping process image in Fig. 6. After that, the color image-taking process includes filtering, segmentation and thresholding, and edge detection. The filtering process is carried out after the cropping process takes place on the Mobile Android application, then the segmentation process is carried out, as shown in Fig. 7. The thresholding process and edge detection are carried out. However, because the contour only yields one and the sweetness level does not affect, the curve point's minimum and maximum distance to the centroid is not included in the citrus fruit maturity detection criteria. Next, input the texture data, including size, texture, and new pores, press the process button to determine the oranges' level of maturity. Before providing information regarding citrus fruit maturity, some of the resulting criteria are calculated using the K-NN method. The resulting data can be seen in Fig. 8. The detection results show that the similarity of the data tested with master data has similarity until 98.53%, and the information on the maturity level is 75%. This application is easy to use and can provide online information on the citrus fruits' maturity level that citrus farmers can use before harvesting. The other testing data could be shown in Table 1.

IV. Conclusion
Based on the research, an Android-based application is easy-to-use and can help citrus farmers detect the citrus fruits' maturity. This study uses the K-Means Clustering method by using the difference between the euclidean distance in the citrus fruit criteria used as a reference to help determine the maturity of oranges. This research can produce an application that can help novice farmers determine the level of maturity of citrus fruits. Citrus farmers will use this application before harvesting as a reference to determine the level of citrus fruit maturity.