Abstract
To address the low accuracy of traditional freshness detection/grading and poor adaptability to different shell colors in the duck egg industry, this study developed a non-destructive detection model and an integrated device for duck egg freshness based on machine vision combined with eggshell optical property analysis. A four-sided yolk transmission imaging system was designed, and accurate yolk region segmentation was achieved via grayscale conversion, a weighted improved Otsu algorithm for whole-egg segmentation, histogram equalization enhancement, and K-means clustering in the LAB color space. A relational model between the average four-angle yolk projected area ratio and Haugh Units (HU) freshness grades was constructed, with grading thresholds determined by constrained optimization combined with the Youden index to balance food safety and grading accuracy. Experimental results showed the model achieved an overall freshness grade discrimination accuracy of 91.3%, with a sensitivity of 97.1% and specificity of 98.9% for inedible Grade B (HU < 60) duck eggs and below. An automated testing device was further developed, adopting a roller-rotating motor collaborative mechanism for automatic flipping and imaging, and equipped with a 10 W/5500 K LED cool white light source to solve the problem of poor adaptability to different shell colors. The device achieved an overall discrimination accuracy of 88.5% with a detection time of ≤5 s per egg, and its host computer can real-time output the yolk area ratio, predicted HU value, and freshness level. This study provides a high-precision and low-cost technical solution for the refined grading of the poultry egg industry.