A fruit surface defect detection method based on image marking includes the following steps that firstly, a surface picture of a to-be-detected fruit is taken and saved, and an original image is obtained; secondly; the original picture is uploaded to a
server to be analyzed and processed;
processing of the
server includes the steps that a, the obtained original image is converted into a space where the
visual system of human beings is applied, and an H component and an I component are extracted; b, dynamic threshold segmentation is performed on the H component; c, gray
histogram statistics is performed on the I component, segmentation is performed through a fixed threshold method, and a threshold is selected between two wave peaks; d, the H value segmentation result and the I value segmentation result are operated, and a
binary image with defect areas is obtained; denoising is performed on the obtained
binary image; f, the
binary image is enhanced, hole
noise may exist in the defect areas, and filling is performed on the
noise; g, the obtained binary image is marked, and the number and the area of defects are calculated; a detection result is output; labor intensity of workers is reduced, and production efficiency is improved.