Crack Detection of Eggshell using Image Processing and Computer Vision

This article presents an eggshell crack inspection using image processing techniques. This approach uses the concept of industrial 4.0 to reduce manual coordination in the egg industry’s manufacturing process. The method started with receiving images from a webcam camera. Then, we rescaled the image to 1147 x 633 for faster computation. Next, divide the image into the red and green channels. The red channel image was converted to grayscale using a Gaussian blur filter with a kernel filter 11 x 11 to reduce noise, followed by turning the image to binary. After that, multiply the binary image with the grayscale of the green channel to remove the background. By that time, a morphological operation was used to enhance the quality of the image. Finally, use the contour matrix to find the area of the object and then build the condition to detect the crack in the eggshell. These techniques of image processing are used to inspect the eggshell crack with a high accuracy of more than 98% as well as the high performance of computing.


Introduction
It is very important to check the quality of eggs after the manufacturing process. Egg surface inspection is one of the annual procedures. Normally, the egg farm uses man to inspect cracks on the egg surface, and sometimes an error occurred. However, in order to have more accuracy, comfortable. Many techniques like Computer vision as well as Image processing were provided. Isoon Kanjanasurat et al. [1] proposed a combination of image processing and Internet of things (IoT) to count the number of eggs that are transported on the conveyor belt. Then the counting results will display on a website. The solution is effective with a count of 100% of the eggs. Burin Narin et al. [2] provided a method of crack on eggshell detection system based on image processing technique. The author explained on matching templates technique to find the matched crack on eggshells and the result of this is up to 90% accurate. Wang Fang, Wen Youxian [3] presented a detecting preserved eggshell crack using machine vision. The author talked about examining the cracks of the eggs while maintaining the original quality of the eggs. This paper analyzed the various methods of image processing. There is a conclusion that it will be used morphological, which is the best for detecting ›cracks in eggshells. The eggshell crack detection percentage was 88% and the eggshell integrity was 87%. Weixing Wang et al. [4] conducted a method of Rock fracture tracing based on image processing and SVM. The method is shown a crack detection IOP Publishing doi:10.1088/1742-6596/2261/1/012021 2 of rock and classification by using a support vector machine (SVM) together with the area of the stone surface. Meysam Siyah Mansoory [5] proposed an automatic crack detection in eggshell based on Susan edge detector using fuzzy thresholding. The author demonstrated a non-destructive testing system based on digital image processing. These algorithms are based on Fuzzy thresholding and SUSAN edge detector. The main advantage of this method in comparison with other methods is less sensitivity to noise because no derivative operator was used. this algorithm had the best binarization on the main image in comparison with algorithm Otsu and power law, also the results showed that with adding Gaussian noise to the main input image with variable variance between 0.002 and 0.01; the accuracy of detection for the proposed algorithm was 97% and 82%, also this algorithm had least value of error function (number of error pixel) on the gray level image toward other algorithms. Arun Mohan et al. [6] introduced Crack detection using image processing. This paper presented the various research issues which can be useful for the researchers to accomplish further research on crack detection. We can see from many authors used several techniques like Artificial Intelligence [7], Image Processing, Machine learning [8] or Deep learning [10] to find the cracking on the surface. However, similar works were done [9] by Elster et. al. the system was able to correctly analyse an egg for the presence of a crack 96% of the time Consequently, this article provides a different method of image processing to inspect the eggshell crack with high accuracy of more than 98% as well as the high performance of computing.

Methodology
This section explains how to detect egg crack using image processing techniques. The main majority of these begin with image acquisition in a controlled environment. Then, enhance the received image to make it more suitable for this experiment. After that, create the condition for detecting the crack on eggshells. Figure 1 depicts a detailed description of the above three algorithms mentioned above.

Image Acquisition
The image of a cracked eggshell was acquired using a webcam camera connect to a personal computer. The environment was controlled by shooting in the dark box with a flashlight for shining eggs. The resolution of an image is 1912 x 1056 pixels. Then, rescale image to 1147 x 633 for faster computation and suitable for a 3 x 3 kernel. Figure 2 has shown a simulate of a dark box, flashlight, and camera were connected to a computer.

Figure 2.
A simulation of the dark box, flashlight, and camera has been connected to a computer

Image Enhancement
This section explains how to improve image quality. Image Enhancement is a process that includes several steps to make an image ready to detect cracks on eggshells. First, an original image from a webcam camera was captured and rescaled. as shown in Figure 3. Second, split the image into red, blue, and green channels and then turn to grayscale as shown in Figure 2(a)(b). However, we use only the red and green channels, regardless of the blue channel. Third, add Gaussian blur (11 x 11 kernel size) to Figure 4(a) to reduce noise and the result as shown in Figure 5  Next, convert Figure 5(a) to a binary image (the image that has only black and white color) as shown in Figure 5(b) and then multiply the binary image with a grayscale of green channel or Figure 4(b) to remove the background, as shown in Figure 5 The morphological closing is erosion and then dilation was followed. Figure 5(e) was created by using kernel E in operations.

Crack Detection
A contour matrix is used to find the area of the object as shown in Figure 7(a) and then built some conditions for detecting crack of eggshell as shown in Figure 7

Results
The detection of a crack in the eggshell is indicated by the green line. It was almost identical to the egg line as well as fast computation (less than 1 secs). However, the processing time depends on the area of the egg and the shooting distance in closed environments is fixed. As a result, we modify the algorithm to be more suitable for this experiment. Nevertheless, the preparation of input images has more effect on a method because of a controlled environment. The result of the detection is shown in Table 1. In this experiment, 50 eggs were used, 16 of which were cracked and 34 of which were normal eggs. We measured the accuracy using a confusion matrix. Table 2. Shown the confusion matrix of this method. True positive is 16, True negative is 33, False positive is 1 and False Negative is 0. The accuracy is 0.98 or 98%.

Discussion
From table 1, the input image is obtained and analyzed. This is due to the preparation of an environment suitable for the detection of cracks in eggshells. However, the obtained images still require a human to inspect or scan for cracks. Therefore, the proposed method can detect cracks more precisely than humans as well as faster processing time. For example, the method can classify whether it's crack or non-crack. Vice versa, The detection of a crack in the eggshell is indicated by the green line. It was almost identical to the egg line. As a result, the author believes that this research can be further developed into automatic crack egg detection. Not only to inspect the crack cracks in eggshell, but also to improve quality assurance in the manufacturing process. This can also combine with artificial intelligence by using a IOP Publishing doi:10.1088/1742-6596/2261/1/012021 8 deep learning model to analyze the health of the chicken from the eggshells, such as the color of the shell, defects, or even the pattern of cracks. Or integrating with the Internet of things to control, monitoring, reporting the system performance of the egg industry in the future.