Prototype of Melon Fruit Quality Sorter Based on Skin Texture Using Local Binary Pattern Histogram

(Cucumis Melo L) is one of the popular fruits in Indonesia. The numerous benefits and various contents of melon make it highly valuable for human health. Determining the quality of melon is crucial, considering its numerous benefits and contents. The quality of melon is determined by the presence of net-like patterns on the surface of the fruit's skin when it is ripe for harvest. Currently, conventional methods that rely on direct visual observation are still commonly used to sort the quality of melons. Therefore, a prototype system was developed to sort the quality of melons based on the texture of their skin. The purpose of this system is to reduce errors caused by eye fatigue and variations in accuracy during the sorting process. In this research, the feature extraction method of the local binary pattern (LBP) was employed, along with the K-Nearest Neighbor (KNN) method for classification. The classification was divided into two grades: Grade A and Grade B melons. The testing phase involved 200 data samples, with each grade consisting of 100 data samples. The results of the testing phase showed a success rate of 96% for the system. Based on the percentage, it can be concluded that the system has successfully performed well in sorting the quality of melons based on the texture of their skin.


INTRODUCTION
Melon (Cucumis Melo L) is a highly popular fruit in Indonesia, particularly in the region of East Java.Its delightful taste and refreshing qualities make it a favorite among the locals.However, melons offer more than just great flavor; they also come with numerous health benefits.One notable component found in melons is adenosine, a substance that plays a crucial role in preventing the aggregation of blood platelets in the body [1,2].This property makes melons beneficial for cardiovascular health and may help reduce the risk of blood clots.
In Indonesia, the Sky Rocket cultivar is widely cultivated and favored for its desirable characteristics.When the melons of this variety are ready for harvest, they exhibit a distinct net-like texture on the surface of their skin.Farmers and consumers often use this feature to assess the quality of the melons.The presence of a rougher net texture indicates a higher-quality fruit.Currently, the process of sorting melon quality relies on conventional methods, primarily visual observation, which has its limitations.One major drawback is the variation in accuracy among different observers.Additionally, the reliance on visual inspection can lead to eye fatigue, which can impact the effectiveness of this conventional approach [2].
To address these issues, a prototype system for sorting melon quality based on the texture of the fruit's skin has been developed.This system utilizes a webcam camera to capture images of the melons, which are then processed to detect and analyze the net texture on the skin surface.The Local Binary Pattern (LBP) method is employed to extract relevant features from the captured images.LBP is a widely used technique in pattern recognition applications due to its effectiveness in capturing texture information [3,4].
Furthermore, the K-Nearest Neighbor (k-NN) method is employed for the classification process, distinguishing between melons of good quality (Grade A) and those of poor quality (Grade B).The k-NN algorithm is a suitable choice for classification when previous template data is available.By comparing the extracted features of the melons with the known templates, the system can accurately classify the melons into their respective quality grades [5].
The main goal of this prototype system is to provide an efficient and reliable solution for differentiating melon quality based on the thickness of the net texture on the melon's skin surface.Automating the sorting process, eliminates the subjective nature of human observation and reduces the potential for errors or inconsistencies.The output of this system is expected to aid farmers, distributors, and consumers in selecting melons of the desired quality, ensuring a better overall experience and value for everyone involved.

RESEARCH METHOD
This research began with a study on the texture of melon skin and its correlation with ripeness and quality levels.In this stage, several sample images of melon skin were collected and grouped according to their quality.This resulted in a collection of images representing good and bad melon skins.Subsequently, a sorting system was developed, consisting of a conveyor belt and a sorting mechanism using a servo motor.Before the melons enter the sorting system, they pass through an IR proximity sensor and a camera sensor connected to a Latte Panda mini-PC.The LBP algorithm and KNN are implemented on the Latte Panda mini-PC through a program.The proposed block diagram can be seen in Figure 1.

Melon Skin Texture
Melon (Cucumis Melo L) is one of the most popular fruits in Indonesia, including in the region of East Java.Melons have beneficial nutritional content for humans, and the fiber content in melons can aid in weight loss.The fruit contains various nutrients such as vitamin C, minerals, and beta-carotene.The type of sugar found in melons is sucrose, and the adenosine content in melons acts as an anticoagulant that prevents blood clotting.Among the melon cultivars, Sky Rocket is the most widely cultivated variety by farmers in Indonesia, suitable for the country's climate.Sky Rocket melons have a round shape with thick skin, and there are net-like patterns on the surface of the fruit.These melons have a sweet taste and thick flesh.One of the indicators of ripeness in Sky Rocket melons is the thickness and density of the net-like patterns on the fruit's skin [1].The thicker the net pattern, the better the level of ripeness, and vice versa.This is illustrated in Figure 2.

Sorting Mechanism Design
The mechanical sorting system is composed of several components that work together to efficiently sort melon fruits.It starts with a conveyor belt, which is powered by a DC motor, responsible for moving the melons along the sorting process.Adjacent to the conveyor belt, there is a proximity sensor strategically placed to detect the presence of melons as they pass by.Once a melon is detected by the proximity sensor, a camera positioned above the sensor captures an image of the fruit.This image is then processed to determine the quality of the melon based on predetermined criteria.If the melon meets the requirements for the "good" classification, the sorting arm directs it toward the designated "good" container.On the other hand, if the melon doesn't meet the criteria, the sorting arm diverts it to the appropriate container for lower-quality melons.The mechanical device itself is designed to accommodate the sorting process effectively.It consists of a conveyor with specific dimensions, measuring 135 cm in length, 32 cm in width, and 50 cm in height.These dimensions are optimized to ensure the smooth movement of the melons and provide enough space for the sorting arm to operate efficiently.The design and realization of the mechanical sorting system can be observed and understood through Figure 3, which illustrates the various components and their arrangement within the system.The figure serves as a visual representation to aid in comprehending the overall structure and functioning of the mechanical sorting system.

Local Binary Pattern
Image processing refers to the manipulation and improvement of digital images captured by cameras that may have initially produced suboptimal results.This is achieved through the use of specialized software and specific techniques.The primary goal of image processing is to enhance the overall quality of the image by making it visually more appealing, easier to interpret, or suitable for further analysis [6].One particular method used in image processing is known as Local Binary Pattern (LBP).This technique was initially introduced by Ojala et al. and is considered an effective approach for measuring texture in grayscale images.What sets LBP apart is its ability to maintain its effectiveness even in the presence of varying illumination conditions.It achieves this by representing textures in a way that is insensitive to changes in lighting.The Local Binary Pattern (LBP) method provides a reliable representation of textures within an image.It can accurately capture subtle variations in grayscale values, allowing for the discrimination of different image features.This makes it a valuable tool in various applications, such as image classification, object recognition, and image retrieval.In summary, image processing involves the use of software and techniques to enhance digital images.Among these methods, Local Binary Pattern (LBP) stands out as an effective approach for measuring texture in grayscale images, offering robustness against varying illumination conditions and accurate discrimination of image features [7].LBP is supported by micro-patterns that can be described by an operator.The operator works by assigning labels (P, R), where P indicates the number of neighboring pixels and R indicates the radius between the center point and the neighboring pixel and assigns a binary value to the result.If the neighboring pixel value is less than the center point, it is assigned a binary value of 0, whereas if the neighboring pixel value is greater than the center point, it is assigned a binary value of 1.This illustration can be seen in Figure 4.
The mathematical equation for Local Binary Pattern (LBP) is as follows: Where p is the number of neighboring pixels, ILPB is the LBP image, Igc is the gray image at the center of LBP, Igp is the gray image at the neighboring pixels, x represents the image location in Cartesian coordinates on the x-axis, and y represents the image location in Cartesian coordinates on the y-axis.To incorporate micro patterns, the image will be divided into several equal regions before the extraction process.LBP extraction will be performed on each region.The result of LBP extraction in each region will form a region histogram, which will then be transformed into a feature histogram.This feature histogram represents the local texture or global shape of the image.
The local binary pattern (LBP) method is capable of describing texture formation at the pixel level.Each pixel is assigned a label with a texture code that corresponds to the local environment of the pixel.Primitive textures detected with local binary patterns include spot texture, flat area, edge, line end, and corner [8].The following represents the primitive texture representation of a local binary pattern, where a white circle indicates a binary value of one, while a black circle indicates a binary value of zero.Based on the pattern shown in Figure 5, primitive features from spot to corner can be represented in decimal form from 0 to 255, where spot has a value of 0 and flat has a value of 255.This conversion process is performed using (1) and (2).

K-Nearest Neighbor
K-Nearest Neighbor (KNN) is an algorithm for classifying new objects based on their closest distance to the training data.The working principle of KNN is to find the nearest distance between the test data and the K nearest neighbors from the training data.The training data is divided into several dimensions, where each dimension represents the features of the test data [9].The algorithm for the KNN classification process [10]is performed in several steps.
The first step is to determine the value of the parameter for the number of neighbors, K. Next, the distance between the test data and the training data is calculated using the Euclidean Distance.After calculating the distances, the group of Euclidean distance values is sorted.The next step is to perform the categorization (classification) based on the K-nearest neighbors.To measure the distance between the test data and the training data, the Euclidean Distance is used with the equation (3).
Where eucd (m, t) represents the Euclidean distance between the measurement result (m) and the template or reference (r).The variable data is denoted by i, while n represents the data dimension.

Software Design
The system flowchart is explained as follows: when the switch is activated, the conveyor will be activated.Then, a sensor detects the presence of a watermelon, causing the conveyor to pause temporarily.When the conveyor stops, the webcam is activated to capture an image, which is then processed to generate sorting data.Afterward, the conveyor resumes operation, and the sorting motor is activated based on the image processing and classification results.The image processing flowchart starts with capturing an image using a webcam, which is then converted to a grayscale.After obtaining the grayscale image, feature extraction using Local Binary Patterns (LBP) is performed, followed by converting the LBP image into a histogram.Next, the LBP image histogram is classified using K-Nearest Neighbor (KNN) to determine whether fruit belongs to grade A. If it does, the system sends the serial data for grade A to activate the sorting motor.This process is illustrated in the flowchart in Figure 7.If grade A is not detected, the fruit is classified as grade B, and the system sends the serial data for grade B.

RESULTS AND DISCUSSION
Before conducting tests on the melon sorting process, it is necessary to perform a sampling process to extract template histograms from local binary pattern images of grade A and grade B melon skins.These sample templates serve as training data for classifying melons during the testing phase.By using the sample template data, we can classify the test data obtained from subsequent melon testing.

Figure 1 .
Figure 1.Block Diagram of Proposed Method

Volume 10 ,Figure 2 .
Figure 2. (a) Skin Texture of Good Grade Melon; (b) Skin Texture of Bad Grade Melon

Figure 4 .
Figure 4. Ilustration of RGB to LBP Image Conversion

Figure 6 Figure 6 .Figure 7 .
Figure 6.Proposed Flowchart of the Sorting System

Figure 8
illustrates the histogram values derived from the sample data.The histogram represents the frequency distribution of pixel intensities in the melon skin images.It provides valuable information about the texture and pattern characteristics of the melon skins.These histogram values capture the unique features of both grade A and grade B melon skins, enabling us to distinguish between them accurately.(a) (b) DOI: 10.33019/jurnalecotipe.v10i2.4476