Classification of Overlapping Eggs Based on Image Processing

This paper presents a method for classifying the overlapped eggs and counting the number of eggs on the conveyor belt using image processing techniques. The image was acquired by a webcam camera that connected to the computer and then rescaled. The image was then converted to grayscale and noise was reduced using a Gaussian blur filter. Otsu’s Binarization is used to convert the image to binary. The binary image is then subjected to morphological operations. Following that, using the Watershed Algorithm, separate the egg’s overlapped area. Finally, the prepared image is ready to be counted using the contour matrix method. This method independently classifies each egg segmentation and can count up to 18 eggs per frame with a processing time of less than 1 second.


Introduction
According to Thailand's Department of Livestock Development, chicken eggs can produce 42 million eggs per day, and in the large-scale egg farm segment, a conveyor system transports eggs produced at a rate of approximately 400,000 eggs per day, or approximately 18 eggs per second, from the chicken coop. Counting eggs transported at a high rate of eggs per second on a conveyor belt is extremely difficult and has always encountered overlapping issues. During the transportation process, this image processing technique is capable of counting eggs on the conveyor and separating overlapping eggs. Numerous strategies can be used to address these issues. Isoon Kanjanasurat et al. [1] proposed an egg counting method that utilizes a morphological operation and provides real-time results via a website. The author described an image processing technique for removing a conveyor belt background and provided real-time information about the egg count via a website. Sahar Zafari et al. [2] developed a method that relies on silhouette images and only requires the foreground (objects) and background to be distinguishable. The author discussed a method for segmenting overlapping objects that outperforms two state-of-the-art approaches currently available. Yane Duan et al. [3] demonstrated an algorithm for segmenting microscopic images of live fish eggs automatically. The proposed method accurately recognized, segmented, and counted objects in all 96 test cases when compared to manual observation. Cedric Okinda et al. [4] invented the technique of determining the volume of an egg using image processing and computer vision. The author examined a system for estimating the volume of chicken eggs using depth images. The study's findings indicate that the system can be used in a production line system as an accurate, consistent, fast, and non-destructive in-line chicken egg sorting technique. Tong  [5] demonstrated the recognition of overlapping elliptical objects in a binary image. The method is intended for use in regions that have complex shapes and appear to be composed of one or more overlapping objects. However, experiments using a synthetic data set, two different types of cell images, and bloodstain patterns demonstrate that our method outperforms other methods for ellipse recognition in terms of accuracy and flexibility. Additionally, it is not necessary to separate overlapping images with large objects; nanoparticles can be used in the same manner. Chiwoo Park et al. [6] demonstrated a method for segmenting, inferring, and classifying nanoparticles that are partially overlapping. The authors compared the proposed method to seven existing techniques and discovered that the proposed method is significantly superior in terms of particle recognition rate. The overlapping classification system is applicable to a variety of other industries, including Youyi Song [7] described a method for diagnosing bacterial vaginosis automatically through segmentation, splitting, and classification of overlapping bacteria in microscope images. These experiments demonstrate that the proposed method is highly accurate and efficient in diagnosing BV. Gady Agam et al. [8] described a method for geometric separation of partially overlapping nonrigid objects that can be used to classify chromosomes automatically. The proposed strategy approaches the separation problem as an identification problem, successfully segregating overlapping chromosomes. The authors explained that this approach is applicable to other situations in which touching and overlapping nonrigid objects must be distinguished. Petros S. Karvelis et al. [9] demonstrated a method for classifying multispectral chromosome images based on watershed segmentation. The proposed technique outperforms existing techniques while consuming significantly fewer computational resources. Our article describes a method for classifying overlapping eggs and counting the number of eggs on a conveyor belt using image processing and artificial intelligence techniques [10]. This paper proposes a method for classifying the overlapped eggs and counting the number of eggs on the conveyor belt using image processing techniques. A pre-processing and watershed algorithm is applied to process in real-time and compared with traditional method.

Methodology
This section discusses the image processing techniques used in our method for counting eggs. A detailed explanation of each method is illustrated in Figure 1. This method consists of four steps. To begin, image acquisition is the process by which a camera captures an egg on a conveyor belt. The following step is pre-processing, which converts the color image to a binary image and eliminates noise from the image. Following that, the Watershed algorithm is used to separate the eggs. Segmentation and counting eggs in an image are the final steps.

Image acquisition
The image of the eggs on the conveyor belt was taken with a webcam connected to a computer. The environment was controlled by shooting in the box and attaching a flashlight for stable illumination, and a conveyor belt was simulated to make the eggs image more realistic, similar to the image of an egg on IOP Publishing doi:10.1088/1742-6596/2261/1/012023 3 a real conveyor belt. The resolution is 1060 x 720 pixels, and the image was then rescaled to 530 x 360 pixels, or 50% of the original, for faster computation. The model of image acquisition is shown in Figure  2.

Preprocessing
Pre-processing is the procedure for preparing an image of eggs for counting. To begin, as illustrated in Figure 3(a), convert the original image to grayscale (we used the red channel to highlight the egg's color), as illustrated in Figure 3(b). Second, as shown in Figure 3, reduce noise by applying Gaussian blur (15 x 15 kernel size) to the image (c). Third, as illustrated in Figure 3(d), convert the grayscale blurred image to a binary image using Otsu's Binarization, and then use morphological to obtain the desired image (e). The morphological are erosion and then dilation was followed for eliminate small white object unwanted. Figure.  It actually finds a value of t which lies in between two peaks such that variances to both classes are minimal. Figure 4 Shows the histogram of Figure.

Watershed algorithm
Watershed algorithm is an algorithm that we are using for separate eggs. First, find distance transform from Figure. 3(e), as shown in Figure. 6(a). Second, convert the distance transform image to the binary image and then use some morphological to get the desired image, as shown in Figure. 6(b) Third, drawn background of the maker, as shown in Figure. 6(c). The last is fill colors to the eggs image for separate, as shown in Figure. 6(d).

Results
In the process of egg counting by image processing and computer vision, it is divided into two cases:  Table 1. counting with the Watershed algorithm more accurate than counting without the Watershed algorithm but in the other hand the processing time of counting without the Watershed algorithm faster than counting with the Watershed algorithm. It's reasonable because counting with the Watershed algorithm have a lot of process to make Watershed algorithm but It's no problem because processing time still less than 1 minute. The result of counting image as shown in Figure 8.

Conclusion
Using image processing techniques, this article proposed a method for classifying overlapped eggs and counting the number of eggs on the conveyer belt. We compare the Watershed algorithm to a straightforward technique. The experiments demonstrated that the Watershed algorithm is more accurate and error-free than the simple algorithm. However, while the simple algorithm takes less time to process than the Watershed algorithm, it has a lower accuracy and a higher rate of error. Thus, it can be developed in the future using the factory system.