Abstract:
Pomegranates are one of the economic fruits in China. The timely detection of pomegranate diseases and the corresponding preventive measures are important to increase crop yields and reduce economic losses. To tackle the issues that traditional edge detection operators usually resulted in low accuracy of the detection of pomegranate diseases and its contour, low anti-noise capability, and created false edges, this study presented an improved Prewitt operator with an adaptive threshold. Firstly, in the image pre-processing stage, the pending image was enhanced by high-frequency emphasize filter, and the high-frequency component, which represented to the details of the pomegranate sample in the image, was increased by the filter. On the contrary, the low-frequency component, which represented to the background of the pomegranate sample, was attenuated to facilitate the following image processing. Since the most original images contained the Gaussian noise, bilateral filtering was used to process the noise present in the image. The weighted average of the brightness values of adjacent pixels was used to represent the intensity of a pixel. The weighted average method was used based on Gaussian distribution. The weight calculation took into account both the Euclidean distance between the pixels and the radiation difference in the pixel range domain to better maintain edge feature information. Secondly, a fifth-order convolutional mask was proposed. The weights of the elements in the mask were set according to the properties of the Gaussian noise probability distribution to reduce the effect of noise on the algorithm. The weight of the central element of the convolutional mask was increased so that the edge information of the image had higher contrast. In terms of gradient calculation, eight direction templates were used to perform the convolutional operation of the image, then the gradient values of each direction were calculated. After that, the corresponding gradient values were obtained, and the gradient values of eight directions were combined into eight groups according to the rule of orthogonality. As a result, there was 90 degrees difference between each group of gradients. Then calculated the L2 norm of each set of gradients, and used the largest value of L2 norm as the gradient of the current pixel. It was shown that it was only necessary to calculate the convolutions in half the direction due to the convolutional results in opposite directions were inverse to each other. The gradients of the rest of the direction could be obtained by its symmetric property. The adaptive threshold was implemented through the minimum error method to decrease the probability of false detection and prune irrelevant details. The mean and variance of the target and background were calculated, meanwhile, the minimum error objective function was obtained according to the principle of the minimum error classification. The value that minimizes the objective function was taken as the optimal threshold. To demonstrate the effectiveness of the method in this paper, 607 test images were manually collected as samples in the natural environment from different angles and different illumination conditions. To further reduce the interference of light changes and suppress background noise, the pending images were converted into grayscale images. Therefore, the algorithm was tested using the converted grayscale images. The experimental results showed that the algorithm proposed in this study achieved a better definition at the edge of the lesion. Compared with the traditional edge detection operator, it achieved a higher recognition accuracy and lower running time. The peak signal to noise ratio of the obtained image was higher, and the obtained edge was complete and accurate. The algorithm proposed in this paper could quickly and accurately detect the area of pomegranate lesions, providing a fundamental reference for the future prevention of pomegranate diseases.