Method and system for detecting surface micro-cracks of eggs based on machine vision
Patent Information
- Application Number
- CN202610195954.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-02-11
- Publication Date
- 2026-09-08
- Estimated Expiration
- 2046-02-11
AI Technical Summary
[0006]本发明的目的在于提出基于机器视觉的鸡蛋表面微裂纹检测方法及系统,用以解决现有技术难以从复杂的非线性光场中精准提取并识别微细裂纹信号的技术问题
[0017]有益效果:本方案利用指数函数对局部灰度梯度进行非线性映射,能够有效压制蛋壳表面固有的纹理噪声;同时,将几何敏感度权重引入抑制项的分母中,使得在边缘高权重区域的抑制力度减弱,从而对边缘处的微弱裂纹信号起到保护作用;本方案采用动态调节机制平衡了中心区域的噪声抑制与边缘区域的信号保持,防止了微细裂纹在图像处理过程中被误消除。
Smart Images

Figure CN122042669B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image processing technology, specifically relating to a machine vision-based method and system for detecting microcracks on the surface of eggs. Background Technology
[0002] In the modern poultry egg processing and sorting industry, the integrity testing of egg surface is a crucial step in ensuring food safety, extending shelf life, and improving product quality. As a fragile biological product, eggs are highly susceptible to physical impacts during production, collection, cleaning, and transportation, resulting in micro-cracks. These cracks not only cause leakage of egg liquid and economic losses but also break down the original sterile protective barrier of the eggshell, making it highly susceptible to the invasion and proliferation of microorganisms such as Salmonella, seriously threatening consumer health and safety. Therefore, efficient and accurate automated detection of egg surface cracks has become an urgent need in the field of agricultural and livestock product processing.
[0003] With the popularization of industrial automation technology, machine vision-based non-destructive testing technology has gradually replaced the traditional manual illumination method and become the mainstream configuration on poultry and egg production lines. Current mainstream inspection solutions typically employ the principle of backlit transmission imaging, using a high-intensity light source to penetrate the eggshell. When there is physical damage to the eggshell surface, the transmittance of the cracked area is significantly higher than that of the surrounding intact shell tissue, thus appearing as high-brightness linear features in the acquired image. By capturing these transmission images with an industrial camera and combining them with image processing algorithms, the automatic identification and removal of crack defects can be achieved.
[0004] However, in practical industrial applications, existing visual inspection technologies face multiple complex physical and optical challenges, making it difficult to further improve the detection accuracy of microcracks. First, as a naturally occurring biological organism, the physical structure of an eggshell exhibits high randomness and non-uniformity. The uneven distribution of calcium deposition leads to significant local variations in shell thickness. These thickness differences create irregular bright and dark patches in the transmission image, whose grayscale characteristics are extremely similar to real microcrack signals, easily causing algorithmic misjudgments. Second, eggs have complex three-dimensional curved surface geometry, especially with significant curvature changes at both ends. This causes severe refraction, scattering, and attenuation of transmitted light as it passes through the edge regions, resulting in severe brightness reduction and nonlinear optical field distortion at the image edges. This optical noise often masks weak crack signals.
[0005] Traditional image processing methods often employ global thresholding or basic edge detection operators. These methods tend to assume a uniform image background and lack in-depth modeling of the geometric features of the eggshell surface and the laws governing light propagation. When faced with background noise caused by illumination attenuation in high-curvature edge regions or abrupt changes in eggshell thickness, traditional algorithms struggle to effectively distinguish between physical defects and structural artifacts. This leads to frequent instances on production lines where cracks in high-curvature areas are missed or normal textures are falsely reported as cracks. Summary of the Invention
[0006] The purpose of this invention is to propose a machine vision-based method and system for detecting microcracks on the surface of eggs, in order to solve the technical problem that existing technologies are unable to accurately extract and identify microcrack signals from complex nonlinear light fields.
[0007] To address the above problems, the technical solution of the machine vision-based method for detecting microcracks on the surface of eggs proposed in this invention is as follows: A machine vision-based method for detecting microcracks on the surface of eggs includes: Acquire a transmission image of the egg and perform spatial calibration to determine the geometric center and major axis scale of the egg region, and establish the polar coordinate mapping relationship of each pixel. The geometric sensitivity weight of each pixel is evaluated based on the straight-line distance from each pixel to the geometric center and the angle relative to the major axis, which is used to characterize the degree of optical path distortion in the high curvature region at the edge. The contrast base energy of pixels is extracted using a local spatial window, and the local gray-level gradient is nonlinearly evolved by combining the geometric sensitivity weights to obtain the adaptive contrast energy evolution result. The local background variance is coupled with the geometric sensitivity weight to calculate the crack recognition confidence of each pixel, and the recognition decision of microcracks on the egg surface is made based on the crack recognition confidence.
[0008] Beneficial Effects: This invention establishes the correspondence between the physical geometric features of an egg and image pixels through spatial calibration and polar coordinate mapping, overcoming the limitations of traditional methods that rely solely on grayscale information. Furthermore, this invention utilizes geometric sensitivity weights to characterize the degree of optical path distortion in different regions and performs adaptive contrast energy evolution accordingly. This effectively preserves weak crack signals in high-curvature edge regions while suppressing background artifacts caused by uneven eggshell thickness. Simultaneously, this invention achieves precise decoupling of defect signals from background noise by coupling local background variance with geometric weights to calculate recognition confidence, thus improving the accuracy and robustness of detecting micro-cracks on egg surfaces under complex lighting conditions.
[0009] Furthermore, establishing the polar coordinate mapping relationship for each pixel includes: The outline of an egg in the transmission image is located using a circular operator based on edge accumulation; The geometric center of the egg region is calculated using the image moment method, and the geometric center is set as the origin of the local spatial coordinate system. The length of the major axis of the egg is obtained using the minimum bounding rectangle method; Assign each pixel in the transmitted image an Euclidean distance relative to the origin and an angle relative to the major axis direction.
[0010] Furthermore, the formula for calculating the geometric sensitivity weight is as follows:
[0011] In the formula, Representing coordinates The geometric sensitivity weighting index of each pixel. Representing coordinates The straight-line distance from the pixel to the geometric center of the egg. This represents the length of the egg's major axis in pixels. Representing coordinates The angle between the pixel and the major axis, with constant 2 being the anti-singularity smoothing factor.
[0012] Beneficial effects: This formula integrates the distance from the pixel to the geometric center of the egg and the angle relative to the major axis. It uses the cosine term to reflect the anisotropic characteristics of the egg surface and can assign different gain weights according to the positional differences of the pixels on the ellipse, thereby achieving adaptive compensation in subsequent processing and solving the problem of uneven detection caused by changes in angle and distance.
[0013] Furthermore, the extraction of the fundamental contrast energy of pixels using a local spatial window includes: Define a local spatial window centered on the current pixel; Calculate the absolute value of the grayscale difference between each neighboring pixel in the local spatial window and the current pixel; The absolute values of the grayscale differences are summed to obtain the basic contrast energy.
[0014] Beneficial effects: By extracting the basic energy of contrast through a local spatial window and accumulating the absolute values of gray-level differences, local abrupt changes in the image can be quickly captured. This step, as the basis of signal extraction, can initially separate all potential high-frequency information such as cracks, spots, and textures from the smooth background, providing raw data support for subsequent nonlinear evolution.
[0015] Furthermore, the formula for calculating the adaptive contrast energy evolution result is as follows:
[0016] In the formula, Representing coordinates The adaptive contrast energy evolution results of the pixel. Represents a local spatial window. Representing coordinates The original grayscale value of the pixel. Represents the number of pixels within a local spatial window. grayscale value, Representing coordinates The local grayscale gradient magnitude of the pixel. Representing coordinates Geometric sensitivity weights of pixels Represented by natural constant An exponential function with base 0.
[0017] Beneficial effects: This scheme uses an exponential function to perform nonlinear mapping of local gray-level gradients, which can effectively suppress the inherent texture noise on the eggshell surface. At the same time, the geometric sensitivity weight is introduced into the denominator of the suppression term, which weakens the suppression strength in the high-weight region at the edge, thereby protecting the weak crack signal at the edge. This scheme adopts a dynamic adjustment mechanism to balance the noise suppression in the central region and the signal preservation in the edge region, preventing the micro-cracks from being mistakenly eliminated during image processing.
[0018] Furthermore, the local gray-level gradient magnitude is obtained by convolving the image in the horizontal and vertical directions using the Sobel gradient operator to obtain horizontal gradient components and vertical gradient components, and then performing square root operations on the horizontal gradient components and the vertical gradient components.
[0019] Furthermore, the formula for calculating the crack identification confidence level is as follows:
[0020] In the formula, Represents the final determined coordinates Confidence level for crack recognition at a given pixel. Representing coordinates The adaptive contrast energy evolution results of the pixel. Representing coordinates The background grayscale variance within a preset range around a pixel. Representing coordinates The geometric sensitivity weight of the pixel is given by a constant of 5, which represents the physical damping factor.
[0021] Beneficial effects: This formula employs a signal-to-noise ratio (SNR) structure, comparing the evolved energy with the background grayscale variance and geometric weights. When the background is cluttered or located in a region with high edge distortion, the product of the background variance and geometric weights increases the denominator, thus reducing the confidence output. This means that only when the intensity of the crack signal is significantly higher than the background interference will it be identified as a crack, thereby greatly reducing the false detection rate caused by eggshell spots or edge halos. Furthermore, the introduction of a physical damping factor ensures the numerical stability of the calculation process.
[0022] Furthermore, the decision-making process for identifying microcracks on the egg surface based on the crack identification confidence level includes: A confidence index map is generated based on the crack identification confidence level; The connected components are extracted from the confidence index graph using a dual threshold segmentation method. Determine whether the aspect ratio and average crack identification confidence of the connected region meet preset conditions. If they do, the crack is identified as a microcrack.
[0023] Furthermore, it also includes: converting the identification decision results into control commands to drive the diversion mechanism to remove eggs with microcracks.
[0024] The technical solution of the machine vision-based egg surface microcrack detection system proposed in this invention is as follows: The machine vision-based egg surface microcrack detection system includes a processor and a memory. The memory stores computer program instructions. When the computer program instructions are executed by the processor, the machine vision-based egg surface microcrack detection method described in any of the above technical solutions is implemented.
[0025] The beneficial effects of this invention are as follows: This invention solves the detection bottleneck caused by the uneven natural thickness of eggshells and the optical path distortion due to the high curvature of the edges, and achieves accurate decoupling of defect signals and background artifacts; This invention can capture extremely fine crack signals in complex light field environments, reduce the false detection rate in edge areas, and suppress the regular background noise caused by differences in the physical structure of eggshells, thereby ensuring the reliability of crack identification confidence, eliminating detection blind spots, improving the accuracy and stability of automated sorting, and achieving accurate detection of micro-cracks on the surface of eggs. Attached Figure Description
[0026] Figure 1 This is a flowchart illustrating the steps of a machine vision-based method for detecting microcracks on the surface of an egg, according to an embodiment of the present invention. Figure 2 This is a global light field energy response distribution map of an egg generated based on the adaptive contrast energy evolution algorithm according to an embodiment of the present invention. Figure 3This is a planar diagram of eggshell curvature sensitivity weighting obtained from egg geometry modeling in an embodiment of the present invention. Figure 4 This is a scatter plot showing the performance distribution of the present invention in the crack identification confidence dimension. Detailed Implementation
[0027] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
[0028] Specific embodiments of the machine vision-based method for detecting microcracks on the surface of eggs proposed in this invention: like Figure 1 As shown, the machine vision-based method for detecting microcracks on the surface of eggs includes the following steps: S1. Acquire the transmission image of the egg and perform spatial calibration to determine the geometric center and major axis scale of the egg region, and establish the polar coordinate mapping relationship of each pixel.
[0029] On an industrial automated production line, eggs to be inspected are smoothly fed into a well-shielded dark chamber via conveyor rollers. In this embodiment, a near-infrared LED backlight with a center wavelength of 850nm is used as the illumination device. This light source is positioned directly below the egg's transport path and controlled by a constant current drive circuit to maintain stable luminous intensity. The 850nm wavelength is chosen because this band has excellent penetration properties through calcium carbonate-rich eggshells, effectively suppressing pigment deposition interference on the eggshell surface and clearly revealing the internal physical structure. Simultaneously, a high-resolution industrial camera is vertically mounted above the egg, forming a transmission imaging optical path with the bottom light source to synchronously acquire high-quality transmission grayscale images of the egg.
[0030] After image acquisition, the processing system first preprocesses the original image to extract the region of interest. The system uses a circular operator based on edge accumulation to scan the image, quickly locating the edge position of the egg's outer contour by detecting and accumulating radial changes in the grayscale gradient. Based on this contour information, the system generates a mask and removes interference signals from the background, such as conveyor rollers, dust, and other non-target areas, thus obtaining a clean image of the egg.
[0031] Subsequently, the system uses the image moment method to geometrically model the egg target region. By calculating the zeroth and first moments of the binarized image, the geometric center coordinates of the egg region are determined, and this geometric center is set as the origin of the local spatial coordinate system. Based on this, the system further uses the minimum bounding rectangle method to fit the egg contour, calculating the length of the long side of the rectangle, which is defined as the length of the egg's major axis. This value will serve as the basic physical scale for all subsequent geometric normalization calculations, used to eliminate the influence of differences in the size of different eggs on the detection results.
[0032] After establishing the spatial reference, the system establishes a polar coordinate mapping relationship for each pixel in the image. For any pixel in the image coordinate system, the system uses the Euclidean distance formula to calculate the straight-line distance from that pixel to the origin, and calculates the angle between the pixel's position vector and its major axis, thus obtaining the polar angle. Through this process, each discrete pixel in the image is assigned a spatial coordinate attribute with clear physical meaning. This precise spatial mapping initialization step can transform a planar pixel matrix into a vector field with geometric structure information, providing an objective and quantitative reference benchmark for subsequent evaluation of optical path distortion and adaptive geometric compensation.
[0033] S2. Evaluate the geometric sensitivity weight of each pixel based on the straight-line distance from each pixel to the geometric center and the angle relative to the major axis direction, which is used to characterize the degree of optical path distortion in the high curvature region of the edge.
[0034] As a biological organism with a complex curved surface structure, the physical morphology of an egg directly determines the spatial distribution characteristics of its transmitted light field. In the flat central region of the egg, light emitted from the backlight penetrates the shell and membrane approximately perpendicularly, resulting in the shortest optical path and minimal change in interface refractive index. Therefore, this region produces clear images with high brightness. However, as the line of sight moves towards the edge of the egg, the curvature of the shell surface increases significantly, causing a drastic change in the angle between the incident light and the shell's cross-section. The light undergoes complex multiple refraction and scattering effects as it passes through the shell, leading to a significant attenuation of the transmitted signal in the edge region, accompanied by severe nonlinear distortion. To accurately reflect the degree of light field degradation caused by this geometric difference, this step introduces a geometric sensitivity weight as an evaluation metric. This metric is not a simple linear gain but, based on the polar coordinate system established in the previous step, constructs a spatially weighted model that dynamically reflects the light path transmission efficiency on the eggshell surface by coupling the Euclidean distance from the pixel to the geometric center of the egg and the angular position of the pixel on the ellipsoid.
[0035] In this model, the system calculates the geometric sensitivity weight of each pixel based on its spatial location. The specific calculation formula is as follows:
[0036] In the formula, Representing coordinates The geometric sensitivity weight index of a pixel.
[0037] Representing coordinates The straight-line distance from the pixel to the geometric center of the egg is used as the main variable in the numerator. A non-linear function that monotonically increases with distance is constructed through the square root operation. This is intended to give greater basic weight to the edge region far from the center in order to compensate for the natural brightness decay caused by the increase in optical path.
[0038] The length of the egg's semi-major axis in pixels is used as a normalized scale factor in the calculation, ensuring that the weight calculation is adaptable to eggs of different sizes.
[0039] Representing coordinates The angle between the pixel and the major axis. This represents a cosine trigonometric function. The cosine term in the denominator reflects the anisotropic characteristics of the egg's surface curvature, distinguishing the different rates of curvature change at the blunt end, acute end, and equator of the egg. The constant 2 is a smoothing factor to prevent singularities.
[0040] The weight matrix calculated by this formula can achieve automatic gain allocation for high curvature edge regions, effectively compensating for the weakening effect of edge optical path distortion on the detection signal.
[0041] S3. Extract the basic contrast energy of the pixel using a local spatial window, and perform nonlinear evolution calculation on the local gray-level gradient in combination with the geometric sensitivity weight to obtain the adaptive contrast energy evolution result.
[0042] After completing the geometric spatial calibration and weight calculation, the core task of this step is to accurately separate the weak crack signal from the complex background texture. First, a sliding window is used to traverse the entire image, constructing a local spatial window centered on each pixel. This local spatial window typically selects a rectangular area of 5×5 or 7×7 pixels as its neighborhood. Within each local spatial window, the system calculates the absolute value of the gray-level difference between each neighboring pixel and the center pixel, and then sums these absolute values. This summation reflects the degree of gray-level abrupt change of the center pixel relative to its surrounding environment, constituting the basic contrast energy at that location.
[0043] To further distinguish between real crack abrupt changes and background noise caused by gradual changes in eggshell thickness, a variable of local grayscale gradient amplitude is introduced and nonlinearly coupled with the geometric sensitivity weight obtained in the previous step. The decay characteristics of the exponential function are used to dynamically modulate and evolve the contrast base energy.
[0044] In this embodiment, the specific calculation formula for the adaptive contrast energy evolution result is as follows:
[0045] In the formula, Representing coordinates The adaptive contrast energy evolution results of the pixel; This represents a local spatial window; the summation symbol indicates summing over all pixels within the local spatial window. Representing coordinates The original grayscale value of the pixel at that location; Represents the number of pixels within a local spatial window. The grayscale value. Representing coordinates The local grayscale gradient magnitude of a pixel is obtained by convolving the image in the horizontal and vertical directions using the Sobel gradient operator to obtain the horizontal gradient component and the vertical gradient component, and then performing square root operations on the horizontal gradient component and the vertical gradient component. Representing coordinates Geometric sensitivity weights of pixels Represented by natural constant An exponential function with base 0.
[0046] The principle behind this formula lies in spatially adjusting the nonlinear suppression term using geometric sensitivity weights. The exponential term in the formula acts as an attenuation filter, with its numerator representing the local gray-level gradient magnitude. This indicates that the algorithm applies suppression in regions with gentle gradient changes or in complex, non-cracked areas. The denominator introduces geometric sensitivity weights. Because the geometric sensitivity weights are larger in high-curvature regions like the edges, the absolute value of the exponential function's power decreases, causing the exponential function's value to approach 1. In areas prone to optical path distortion and signal attenuation, such as the egg's edge, the algorithm automatically reduces its suppression of gradient noise, allowing more energy to pass through, thus protecting the gain of weak crack signals at the edges. Conversely, in the center of the egg, due to the smaller geometric sensitivity weights, the algorithm maintains strong background suppression capabilities. This design not only significantly suppresses regular background artifacts caused by uneven eggshell thickness but also significantly enhances the discernibility of real crack signals under complex lighting conditions.
[0047] S4. Couple the local background variance with the geometric sensitivity weight, calculate the crack recognition confidence of each pixel, and make a decision on the recognition of microcracks on the egg surface based on the crack recognition confidence.
[0048] To transform the adaptive contrast energy evolution results obtained in the previous steps into a decision-making basis with clear probabilistic significance, this step constructs an evaluation system based on a signal-to-noise ratio (SNR) mechanism. First, the background gray-level variance within a preset range around each pixel in the image is calculated. This variance reflects the roughness of the local eggshell texture and the discrete characteristics of background clutter. Then, this background gray-level variance is product-coupled with the geometric sensitivity weight obtained in step S2, serving as a suppression term to correct the adaptive contrast energy. The core logic of this process is that for edge regions with high geometric sensitivity weights or spot regions with large background variance, the algorithm requires pixels to have extremely high contrast energy to be identified as cracks, thus greatly reducing the risk of misjudgment caused by uneven lighting or eggshell spots. Finally, the system generates a confidence distribution map of the entire image based on the calculated confidence index and accurately locates microcracks through subsequent morphological analysis.
[0049] The specific formula for calculating the confidence level of crack identification is as follows:
[0050] In the formula, Represents the final determined coordinates The confidence score for crack identification at a pixel is normalized to a range of 0 to 1. The closer the value is to 1, the higher the probability that there is a microcrack at that point. This represents the coordinates calculated in step S3. The adaptive contrast energy evolution result of the pixel is expressed in the formula using its squared term. This is to nonlinearly stretch the difference between the high-energy region and the low-energy region, making the characteristic crack signal more prominent in the confidence spectrum. Representing coordinates The background grayscale variance within a preset range around a pixel is used to characterize the noise level of the local background. This represents the coordinates calculated in step S2. The geometric sensitivity weight of the pixel is used here as a gain coefficient for the penalty term when the pixel is located at a high curvature edge. A larger value leads to an increase in the denominator, thereby reducing the confidence output at the same energy level and achieving strict control over false edge detections. The constant 5 represents the physical damping factor, which is introduced into the denominator of the formula to prevent extremely pure image backgrounds from causing false edge detections. and When all integers approach 0, numerical instability or division by zero errors occur, ensuring the stability of the algorithm under various extreme conditions.
[0051] After obtaining the crack identification confidence index map, the system uses a dual-threshold segmentation method to extract high-confidence connected components from the image. This method sets two thresholds: a high threshold and a low threshold. Only pixels with a crack identification confidence score higher than the high threshold are identified as crack cores, while pixels connected to the core and with a crack identification confidence score higher than the low threshold are considered crack edges, thus ensuring the integrity of the crack morphology. Subsequently, the system calculates the aspect ratio and average crack identification confidence score of the extracted connected components. If the aspect ratio of a connected component exceeds a preset morphological threshold and the average crack identification confidence score meets the requirements, the region is determined to be a real microcrack.
[0052] Finally, the detection system converts the identification decision results into electrical control commands and transmits them to the PLC controller. When it is determined that the egg being inspected has micro-cracks, the PLC controller drives the pneumatic suction head or diverter lever under precise timing control to automatically remove the unqualified egg from the production line, thereby achieving automated and high-precision egg quality sorting.
[0053] The following combination Figures 2 to 4 The effects of the present invention will be further explained.
[0054] Figure 2 This image illustrates the global light field energy response distribution of an egg after processing with the adaptive contrast energy evolution algorithm of this invention. In this distribution image, the vast majority of areas representing the normal eggshell surface exhibit a dark, low-response state, indicating that background noise caused by uneven eggshell thickness or texture differences has been effectively suppressed. In stark contrast, a significant high-brightness response band exists in the image, precisely corresponding to the location of micro-cracks on the egg surface. This confirms that this invention, by combining geometric sensitivity weights and local gray-level gradients for nonlinear evolution, successfully enhances weak crack signals and filters out complex background artifacts, resulting in highly discriminative defect features in the energy domain.
[0055] Figure 3 The figure illustrates the planar distribution of eggshell curvature sensitivity weights calculated based on the distance between pixels and the geometric center and the angle relative to the major axis. The figure shows the weight variation trend from the center of the egg to the surrounding edges. The weight value is lower in the geometric center region, gradually increasing as the position extends towards the major axis at both ends, particularly forming significant high-weight distribution bands at the sharp and blunt ends of the top and bottom of the egg. This distribution characteristic is consistent with the high curvature compensation mechanism of this invention, indicating that the algorithm can automatically assign higher sensitivity weights to high-curvature edge regions with severe optical path distortion and drastic illumination attenuation, thereby achieving adaptive gain compensation for the detection signal at the physical level.
[0056] Figure 4This figure shows a scatter plot comparing the performance of the method of this invention in the crack recognition confidence dimension. The horizontal axis represents the spatial projection coordinates of pixels on the egg surface, and the vertical axis represents the calculated crack recognition confidence score. The dense cluster of scatter points at the bottom of the figure represents background thickness interference sample points, whose crack recognition confidence scores are strongly suppressed by the algorithm to an extremely low range. The concentrated cluster of scatter points at the top of the figure represents target crack feature sample points, whose crack recognition confidence scores are significantly higher than background noise. A clear and effective decision threshold exists between the two, achieving perfect separation between background interference and real defects. This demonstrates that the confidence evaluation model constructed by coupling local background variance and geometric sensitivity weights in this invention has excellent linear separability and stability when facing complex samples, ensuring a very low false alarm rate while preserving real cracks.
[0057] Specific embodiments of the machine vision-based egg surface microcrack detection system proposed in this invention are as follows: The machine vision-based egg surface microcrack detection system includes a processor and a memory. The memory stores computer program instructions. When the computer program instructions are executed by the processor, the machine vision-based egg surface microcrack detection method according to the above embodiments is implemented.
[0058] The machine vision-based egg surface microcrack detection system also includes other components well known to those skilled in the art, such as communication buses and communication interfaces. Their setup and functions are known in the art and will not be described in detail here.
[0059] While various embodiments of the invention have been shown and described in this specification, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Many modifications, alterations, and alternatives will occur to those skilled in the art without departing from the spirit and essence of the invention.
Claims
1. A machine vision-based method for detecting microcracks on the surface of eggs, characterized in that, include: Acquire a transmission image of the egg and perform spatial calibration to determine the geometric center and major axis scale of the egg region, and establish the polar coordinate mapping relationship of each pixel. The geometric sensitivity weight of each pixel is evaluated based on the straight-line distance from each pixel to the geometric center and the angle relative to the major axis, which is used to characterize the degree of optical path distortion in the high curvature region at the edge. The contrast base energy of pixels is extracted using a local spatial window, and the local gray-level gradient is nonlinearly evolved by combining geometric sensitivity weights to obtain adaptive contrast energy evolution results. The local background variance and geometric sensitivity weight are coupled to calculate the crack recognition confidence of each pixel, and the recognition decision of microcracks on the egg surface is made based on the crack recognition confidence. The formula for calculating the geometric sensitivity weight is: In the formula, Representing coordinates The geometric sensitivity weighting index of each pixel. Representing coordinates The straight-line distance from the pixel to the geometric center of the egg. This represents the length of the egg's major axis in pixels. Representing coordinates The angle between the pixel and the major axis, with constant 2 being the anti-singularity smoothing factor; Extracting the fundamental contrast energy of pixels using a local spatial window includes: Define a local spatial window centered on the current pixel; Calculate the absolute value of the grayscale difference between each neighboring pixel within the local spatial window and the current pixel; The absolute values of the grayscale differences are summed to obtain the basic contrast energy. The formula for calculating the adaptive contrast energy evolution result is as follows: In the formula, Representing coordinates The adaptive contrast energy evolution results of the pixel. Represents a local spatial window. Representing coordinates The original grayscale value of the pixel. Represents the number of pixels within a local space window. grayscale value, Representing coordinates The local grayscale gradient magnitude of the pixel. Representing coordinates Geometric sensitivity weights of pixels Represented by natural constant An exponential function with base 0; The formula for calculating the crack identification confidence level is as follows: In the formula, Represents the final determined coordinates Confidence level for crack recognition at a given pixel. Representing coordinates The adaptive contrast energy evolution results of the pixel. Representing coordinates The background grayscale variance within a preset range around a pixel. Representing coordinates The geometric sensitivity weight of the pixel is given by a constant of 5, which represents the physical damping factor.
2. The method for detecting microcracks on the surface of eggs based on machine vision according to claim 1, characterized in that, The process of establishing the polar coordinate mapping relationship for each pixel includes: The outline of an egg in the transmission image is located using a circular operator based on edge accumulation; The geometric center of the egg region is calculated using the image moment method, and the geometric center is set as the origin of the local spatial coordinate system. The length of the major axis of the egg is obtained using the minimum bounding rectangle method; Assign each pixel in the transmitted image an Euclidean distance relative to the origin and an angle relative to the major axis direction.
3. The method for detecting microcracks on the surface of eggs based on machine vision according to claim 1, characterized in that, The local gray-level gradient magnitude is obtained by convolving the image in the horizontal and vertical directions using the Sobel gradient operator to obtain horizontal and vertical gradient components, and then performing square root operations on the horizontal and vertical gradient components.
4. The method for detecting microcracks on the surface of eggs based on machine vision according to claim 1, characterized in that, The decision-making process for identifying microcracks on the egg surface based on the crack identification confidence level includes: A confidence index map is generated based on the crack identification confidence level; Connected components are extracted from the confidence index graph using a dual threshold segmentation method; Determine whether the aspect ratio and average crack identification confidence of the connected region meet the preset conditions. If they do, it is determined to be a microcrack.
5. The method for detecting microcracks on the surface of an egg based on machine vision according to claim 1, characterized in that, Also includes: The identification decision results are converted into control commands, which drive the diversion mechanism to remove eggs with micro-cracks.
6. A machine vision-based system for detecting microcracks on the surface of eggs, characterized in that, It includes a processor and a memory, the memory storing computer program instructions, which, when executed by the processor, implement the machine vision-based method for detecting microcracks on the surface of eggs as described in any one of claims 1-5.
Citation Information
Patent Citations
Poultry egg detection method and device, electronic equipment and storage medium
CN110927167A
Egg quality identification method and device based on optical spectrum and computer
CN120043975A