Egg quality recognition method based on image processing

Principal component analysis was used to decompose the optical interference from the eggshell, and a compensation factor map was generated to compensate for the brightness of the internal transmission image of the egg. This solved the problem of insufficient detection accuracy caused by eggshell interference and improved the accuracy and universality of egg quality detection.

CN121033842BActive Publication Date: 2026-02-17EGG NO 1 FOOD CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511555258.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-29
Publication Date
2026-02-17
Estimated Expiration
2045-10-29

AI Technical Summary

Technical Problem

In existing egg quality inspection technologies, the high rates of false positives and false negatives are due to optical interference from the eggshell, making it difficult to accurately identify internal defects such as blood spots and meat spots.

Method used

Principal component analysis (PCA) was used to decompose the light attenuation of the eggshell into two dimensions: substrate attenuation and local texture response. A compensation factor map was generated by weighted fusion to compensate for the brightness of the internal transmission image, thereby eliminating the influence of individual differences in eggshell color and spots and stains, and enhancing the visibility of internal defects.

Benefits of technology

It improves the accuracy and robustness of internal quality testing of eggs, enhances the universality of testing for different batches of eggs, and reduces false positives and false negatives.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121033842B_ABST
    Figure CN121033842B_ABST
Patent Text Reader

Abstract

The present application belongs to the technical field of image processing, and particularly relates to an egg quality identification method based on image processing, which comprises the following steps: obtaining an RGB image of an egg and converting the same into an internal transmission image; calculating a base attenuation index reflecting the base color of the eggshell and a local spot response index reflecting the surface spot texture, respectively; performing dynamic weighted fusion on the two indexes through principal component analysis to generate a comprehensive fusion attenuation index, and constructing a nonlinear compensation factor based on the index; performing brightness compensation on the internal transmission image by using the factor to generate a corrected image capable of clearly reflecting the internal condition; and combining the original RGB image for comprehensive detection, so that defects such as blood spots, meat spots and cracks can be accurately identified. The present application improves the accuracy and reliability of nondestructive detection of egg quality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology. More specifically, this invention relates to an egg quality recognition method based on image processing. Background Technology

[0002] In the modern poultry and egg industry, the use of machine vision technology for automated grading and quality inspection of eggs is a key step in improving production efficiency and ensuring product quality. By acquiring images of eggs under transmitted light, it is possible to analyze whether there are defects such as blood spots or meat spots inside. For example, Chinese patent document CN114342838B discloses an egg dark spot detection and automatic grading system based on deep learning or image recognition. This system uses a module to collect the number of dark spots and compares them with pre-stored grading values ​​to classify eggs. By setting up a grading device, eggs are automatically classified so that they are placed in the corresponding areas of the sorting tray.

[0003] However, when using transmission images for internal quality inspection, the eggshell is not a uniformly transparent medium. Variations in its base color and surface textures such as spots and stains significantly attenuate the transmitted light. This brightness attenuation caused by the eggshell is similar to the dark areas formed by actual defects inside the egg, such as blood spots, in the image, severely interfering with accurate defect identification. If the influence of the eggshell itself cannot be effectively separated and compensated for, it will lead to extremely high false positive and false negative rates.

[0004] To address this issue, existing technologies typically attempt to model and compensate for optical interference from eggshells. A common approach is to use the Laplacian of Gaussian (LoG) operator to identify and quantify the speckled texture on the eggshell surface. As a classic speckle detector, the LoG operator can strongly respond to speckled structures at specific scales in an image. However, the performance of this algorithm is highly dependent on the choice of scale parameters. Since the speckles on eggshell surfaces vary in size and shape, a single fixed-scale LoG operator cannot universally capture all texture features, leading to inaccurate assessments of eggshell interference. Summary of the Invention

[0005] To address the aforementioned technical problem of insufficient accuracy in egg quality detection, this invention provides an image processing-based egg quality identification method, comprising:

[0006] The process involves: acquiring an RGB image of the egg to be tested; converting the RGB image to a grayscale image to obtain an internal transmission image; obtaining a base attenuation index based on the grayscale values ​​of the internal transmission image; obtaining a local speckle response index based on the local grayscale differences in the internal transmission image; weighted fusing the base attenuation index and the local speckle response index to obtain a fusion attenuation index; the weights for the weighted fusing are obtained by principal component analysis of the base attenuation index and the local speckle response index of all pixels of each egg to be tested; generating a compensation factor map based on the fusion attenuation index of each egg to be tested, wherein the compensation factor map contains a compensation modulation factor corresponding to each pixel, and the compensation modulation factor is positively correlated with the magnitude of the corresponding fusion attenuation index; performing brightness compensation on the internal transmission image based on the compensation factor map to obtain a corrected internal transmission image; the brightness compensation includes multiplying the grayscale value of each pixel by an exponential function of the corresponding compensation modulation factor; and performing quality inspection on the egg to be tested based on the corrected internal transmission image and the RGB image.

[0007] This invention decomposes the light attenuation of eggshell into two dimensions: base attenuation reflecting overall color and spot response reflecting local texture. It innovatively uses principal component analysis (PCA) to dynamically calculate the optimal fusion weights for these two dimensions for each egg, thereby generating a fusion attenuation index that accurately reflects the individual interference characteristics of the egg. Based on this fusion attenuation index, the invention further generates a compensation factor to perform nonlinear brightness compensation on the internal transmission image. This adaptive compensation method can eliminate the influence caused by individual differences in eggshell color depth, spots, and stains, enhancing the image contrast and visibility of minor defects such as blood spots and meat spots inside the egg. This improves the accuracy of automated non-destructive testing and its universality across different batches of eggs.

[0008] Preferably, the substrate attenuation index satisfies the expression:

[0009] ;

[0010] In the formula, Indicates the first The first internal transmission image of the test egg The substrate attenuation index of each pixel; This represents the maximum grayscale value of a pixel; Indicates the first The first internal transmission image of the test egg The grayscale value of each pixel; It is a local minimum value, used to prevent the denominator from being 0.

[0011] This invention is based on the Beer-Lambert law of physics, which enables the substrate attenuation index to more realistically and accurately reflect the absorption effect of the eggshell substrate color on light, providing a more physically meaningful basis for subsequent modeling and compensation for eggshell interference.

[0012] Preferably, obtaining the local speckle response index includes: applying a Laplacian Gaussian operator to the internal transmission image; and taking the absolute value of the calculation result of the Laplacian Gaussian operator at the corresponding pixel coordinates as the local speckle response index.

[0013] This invention uses the Laplace of Gaussian (LoG) operator to obtain the local speckle response index. As a classic speckle detector, the LoG operator has extremely high sensitivity to areas in the image where the local grayscale changes drastically due to spots, stains, etc. on the eggshell surface. It can effectively separate and quantize such high-frequency texture interference from the image, thereby achieving accurate identification of speckle interference and avoiding confusion with internal defect signals.

[0014] Preferably, the Gaussian Laplacian operator includes a scaling parameter, the value of which ranges from 2.5 to 3.5.

[0015] Preferably, the fusion attenuation index satisfies the following expression:

[0016] ;

[0017] In the formula, Indicates the first The first internal transmission image of the test egg The fusion attenuation index of each pixel; Indicates the first The first internal transmission image of the test egg The substrate attenuation index of each pixel; Indicates the first The first internal transmission image of the test egg Local spot response index of each pixel; , They are the first The optimal fusion weights for the base attenuation index and local spot response index of all pixels of the egg under test.

[0018] Instead of using fixed weights, this invention uses dynamic weights derived from principal component analysis. This adaptive weighting method ensures that for eggs with dark color but smooth surface, the base attenuation dominates, while for eggs with light color but many spots, the spot response dominates. This allows the final fusion attenuation index to reflect the most significant source of interference in the current egg, achieving personalized and optimized feature fusion.

[0019] Preferably, the acquisition of the compensation modulation factor includes: performing Z-score normalization on the fusion attenuation index of each egg to be tested to obtain a normalized fusion attenuation index; and substituting the normalized fusion attenuation index into the Sigmoid function to obtain the compensation modulation factor.

[0020] Preferably, the compensation modulation factor satisfies the following expression:

[0021] ;

[0022] In the formula, Indicates the first The first internal transmission image of the test egg Compensation modulation factor for each pixel; Indicates the first Gain slope parameters for each egg under test; Indicates the first The compensated activation threshold for each egg to be tested; Indicates the first The first internal transmission image of the test egg The standardized fusion attenuation index for each pixel.

[0023] This invention achieves intelligent compensation by dynamically correlating the parameters of the Sigmoid function—gain slope and activation threshold—with the kurtosis and skewness of the decay exponent distribution. This means the compensation curve automatically adjusts according to the statistical distribution characteristics of the egg's interference index. For example, for eggs with concentrated interference distributions, the compensation response can be steeper. This allows the compensation logic to match the personalized data characteristics of the eggs.

[0024] Preferably, the gain slope parameter is inversely correlated with the kurtosis of the fusion decay index of the corresponding egg under test; and the compensation activation threshold is positively correlated with the skewness of the fusion decay index of the corresponding egg under test.

[0025] Preferably, the grayscale value of the corrected internal transmission image satisfies the following expression:

[0026] ;

[0027] In the formula, Indicates the first The corrected internal transmission image of the first test egg Corrected grayscale value of each pixel; Indicates the first The first internal transmission image of the test egg The grayscale value of each pixel; This represents the maximum gain control parameter; Indicates the first The first internal transmission image of the test egg Compensation modulation factor for each pixel; This represents the amplitude limiting function.

[0028] Preferably, the quality inspection of the egg to be tested includes: detecting whether there are blood spots or flesh spots on the calibrated internal transmission image; detecting whether there are cracks on the RGB image; and determining that the egg to be tested is a defective product when at least one of blood spots, flesh spots or cracks is detected.

[0029] The beneficial effects of this invention are as follows: By separating and extracting the two interference sources, eggshell base color and surface spots, this invention uses principal component analysis to dynamically determine the optimal fusion weight for each egg, and combines a nonlinear compensation model based on data statistical characteristics for adaptive adjustment, it accurately restores the brightness of the internal transmission image, thereby improving the accuracy, robustness, and personalization of non-destructive testing of egg internal quality. Attached Figure Description

[0030] Figure 1 This is a flowchart illustrating the image processing-based egg quality identification method of the present invention;

[0031] Figure 2 This is a schematic diagram showing the RGB image of the egg to be tested;

[0032] Figure 3 It is a thermogram schematically showing the internal transmission image of the egg under test;

[0033] Figure 4 It is a schematic thermal map showing the corrected internal transmission image of the egg under test. Detailed Implementation

[0034] This invention discloses an egg quality recognition method based on image processing, referring to... Figure 1 This includes steps S1-S6:

[0035] S1: Acquire multiple image pairs of eggs to be tested. Each image pair consists of an RGB image and an internal transmission image of the corresponding egg to be tested. The internal transmission image is a grayscale image of the RGB image of the corresponding egg to be tested.

[0036] It should be noted that in automated sorting lines, a single detection method often has limitations in achieving comprehensive and non-destructive evaluation of egg quality. Visible light reflectance imaging technology can capture information such as color, texture, and cracks on the eggshell surface, but due to the short wavelength of visible light, its penetrating power is limited and it cannot effectively detect the internal structure beneath the eggshell. Near-infrared spectral light waves have stronger penetrating power and can pass through the eggshell. Its transmission intensity is affected by absorption and scattering by internal substances, making it an ideal means of detecting internal defects. Therefore, this invention acquires image information from two spectra in parallel, providing a data foundation for subsequent egg quality detection.

[0037] It should be further explained that, considering that visible light color images provide all the information for analyzing the optical attenuation characteristics of the eggshell, while grayscale images represent the worst-case transmission image, that is, the situation where all eggshell surface features completely obscure the internal information, this invention directly converts the visible light image into a grayscale image as a simulated internal transmission image severely interfered with by the optical characteristics of the eggshell. By utilizing the eggshell feature information contained in the visible light color image, the interference caused by these features in the internal transmission image is eliminated, thereby restoring a clean and true internal image of the egg.

[0038] Specifically, a monitoring point is set up, and an industrial camera is set up above the monitoring point. Multiple RGB images of eggs to be tested are acquired through the industrial camera. The RGB images of each egg to be tested are converted into grayscale images and recorded as the internal transmission images of the corresponding eggs to be tested. The RGB image and the corresponding internal transmission image of any egg to be tested are recorded as the image pair of the egg to be tested.

[0039] At this point, image pairs for each egg to be tested have been obtained.

[0040] S2: Based on the gray values ​​of any pixel in the internal transmission image of each egg to be tested and the gray value difference in the neighborhood, obtain the base attenuation index and local spot response index of any pixel in the internal transmission image of each egg to be tested.

[0041] It should be noted that eggshells are not optically homogeneous; their color intensity and texture (including spots and patterns) attenuate transmitted light. This attenuation is unrelated to the egg's internal quality and represents a systematic interference that needs to be calculated and eliminated. The eggshell's base color determines the fundamental, large-area absorption of light, resulting in a low-frequency spatial signal; while spots, stains, and other textures cause localized, high-frequency scattering and absorption. Therefore, these two features differ in both spatial frequency and range of influence. This invention uses two different image processing operators to decompose these two distinct features.

[0042] It should be noted that, according to the Beer-Lambert law, the intensity attenuation of light as it passes through an absorbing medium is logarithmically related to the optical density or concentration of the medium. The darker the eggshell, the more pigment is deposited, resulting in a higher optical density and therefore a stronger ability to absorb light. Since the grayscale value of a pixel is a linear measure of light intensity, this invention employs a logarithmic transformation to map the linear grayscale value into a non-linear, substrate attenuation exponent that directly reflects the intensity of optical attenuation.

[0043] Specifically, logarithmic transformation is used to process each pixel in the internal transmission image of any egg to obtain the basis attenuation index of any pixel in the internal transmission image of any egg, including:

[0044] The basis attenuation index of any pixel in the internal transmission image of any egg under test satisfies the expression:

[0045] ;

[0046] In the formula, represents the base attenuation index of the c-th pixel in the internal transmission image of the i-th egg to be tested; This represents the maximum grayscale value of a pixel; This represents the grayscale value of the c-th pixel in the internal transmission image of the i-th egg to be tested. It is a local minimum value, used to prevent the denominator from being in the range of 1 / 2. A calculation error occurs when the value is 0, for example. ; Represents a logarithmic function.

[0047] In the formula, 255 represents the maximum grayscale value of a pixel, which is also the maximum intensity of the incident light. This represents the light intensity at the c-th pixel of the i-th egg being tested after transmission; The attenuation rate of light intensity is expressed as a percentage of light intensity. The larger the logarithm value, the darker the color of the c-th pixel of the i-th egg being tested, and the stronger the basic optical attenuation.

[0048] For example, Figure 2 This is a schematic diagram of the RGB image of the egg to be tested. Figure 2 coordinate The grayscale value is The basic decay index at this point is The 0.53 is obtained by retaining two decimal places.

[0049] It should be noted that the essential characteristic of surface textures such as spots and stains is the abrupt change in grayscale values ​​within a local area of ​​the image. Statistical measures such as standard deviation cannot effectively distinguish these spot-like features from smooth edges or gradients. Considering that the Laplacian of Gaussian (LoG) operator is a classic spot detector, capable of finding the extreme points of grayscale curvature by calculating the second spatial derivative of the image, it will produce a strong response to spot-like structures that match the operator's scale. Therefore, this invention uses the LoG operator to construct a local spot response index that is highly sensitive to texture features such as spots and stains.

[0050] Preferably, the local spot response index of any pixel in the internal transmission image of any egg to be tested is obtained based on the local pixel grayscale difference of the internal transmission image of any egg to be tested, including:

[0051] The Laplacian Gaussian operator is applied to the internal transmission image of any egg to be tested for convolution.

[0052] The local speckle response index of any pixel in the internal transmission image of any egg under test satisfies the expression:

[0053] ;

[0054] In the formula, Indicates the first The first internal transmission image of the test egg Local spot response index of each pixel; Indicates the first The first internal transmission image of the test egg The coordinates of each pixel; The scale parameter is represented as The Gaussian Laplace kernel function; This represents the convolution operation; Indicates the first Internal transmission image of an egg to be tested; Represents the absolute value symbol.

[0055] In the formula, This means that the internal transmission image is smoothed using the Laplacian Gaussian operator to suppress noise, and then the value at the coordinates of each pixel is calculated. This value will have a large response in the central region of the spot with drastic gray-scale changes in the internal transmission image. The larger the value, the higher the value. The first internal transmission image of the test egg The more pixels there are, the more likely they are to be the center of a spot or stain. Scale parameter The choice of size determines which size of spot the operator is most sensitive to; for example, Take 3.0.

[0056] For example, Figure 2 coordinate The local spot response index is .

[0057] Thus, the base attenuation index and local spot response index of any pixel in the internal transmission image of each egg under test were obtained.

[0058] S3: Fusion of the base attenuation index and local spot response index of all pixels in the internal transmission image of each egg to be tested, to obtain the fused attenuation index of any pixel in the internal transmission image of any egg to be tested.

[0059] It should be noted that the dominant factors contributing to light attenuation differ among the eggshells tested. For example, for eggs with a darker color but a smooth surface, the total attenuation is primarily contributed by the base attenuation index; while for eggs with a lighter color but a rougher surface, the total attenuation is mainly contributed by the local spot response index. Using fixed weights to fuse these two features cannot accommodate these individual differences, potentially leading to overemphasis on secondary factors or neglect of dominant factors in some eggs. Considering that principal component analysis (PCA) is an unsupervised dimensionality reduction technique, its core function is to find the linear combination direction that can explain the maximum variance in the dataset. For the base attenuation index and pixel variability of eggs, this linear combination direction with the maximum variance corresponds to the most significant way in which the egg's attenuation characteristics change. Therefore, this invention performs PCA on the attenuation characteristics of each egg tested separately, dynamically calculating the fusion weights that best reflect the characteristics of each egg.

[0060] Specifically, the feature matrix of each egg is constructed by using the base attenuation index and local speckle response index of all pixels in the internal transmission image of each egg. Principal component analysis is then performed on the feature matrix of each egg to obtain the eigenvector corresponding to the largest eigenvalue. The components of the eigenvector are the optimal fusion weights of the base attenuation index and local speckle response index of all pixels in the internal transmission image of each egg.

[0061] Preferably, based on the optimal fusion weight, the base attenuation index and local speckle response index of all pixels in the internal transmission image of each egg to be tested are fused to obtain the fused attenuation index of any pixel in the internal transmission image of any egg to be tested, including:

[0062] The fusion attenuation index of any pixel in the internal transmission image of any egg under test satisfies the expression:

[0063] ;

[0064] In the formula, denoted as the fusion attenuation index of the c-th pixel in the internal transmission image of the i-th egg to be tested; represents the base attenuation index of the c-th pixel in the internal transmission image of the i-th egg to be tested; Indicates the first The first internal transmission image of the test egg Local spot response index of each pixel; , These are the optimal fusion weights for the base attenuation index and the local speckle response index of all pixels in the internal transmission image of the i-th egg to be tested.

[0065] In the formula, This means that by projecting the two-dimensional feature space of the i-th egg to be tested onto the most important principal direction, the resulting fusion feature index is a one-dimensional optimal fusion result that retains the original attenuation information to the greatest extent.

[0066] For example, for Figure 2 After performing principal component analysis, the optimal fusion weights were obtained as follows: and This indicates that for Figure 2 The overall difference in optical attenuation is mainly contributed by surface texture, in coordinates The fusion decay index is: The The result is obtained by retaining two decimal places.

[0067] Thus, the fusion attenuation index of each pixel in the internal transmission image of each egg under test was obtained.

[0068] S4: Nonlinearly modulate the fusion attenuation index of each pixel in the internal transmission image of each egg to be tested, and generate a compensation factor map for each egg to be tested.

[0069] It should be noted that the numerical range of the fusion decay index varies depending on the individual egg; an absolute decay index, for example... A certain attenuation index might mean higher attenuation on light-colored eggs, but average on dark-colored eggs, so it cannot be directly used as a uniform correction standard. To establish a universal compensation model that is unaffected by individual differences, the fusion attenuation index for each pixel needs to be transformed into a standardized metric.

[0070] It should be further explained that although simple linear normalization and threshold cutoff can achieve basic compensation logic, the hard cutoff method may introduce abrupt changes in the critical region of attenuation and cannot finely control the compensation response curve. In order to achieve a smoother and more controllable adaptive compensation mechanism, this invention designs a nonlinear compensation modulator. First, the relative significance of pixel attenuation is obtained through Z-Score normalization, and then the sigmoid function is used to smoothly map this significance into a compensation modulation factor between 0 and 1.

[0071] Specifically, the fusion attenuation index of all pixels in the internal transmission image of each egg to be tested is used to construct the fusion feature map of the corresponding egg.

[0072] Preferably, the fusion feature maps of each test egg are standardized to obtain the compensation factor map of each test egg, including:

[0073] Obtain the mean and standard deviation of the fusion attenuation index of all pixels in the internal transmission image of any egg to be tested.

[0074] The normalized fusion attenuation index of any pixel in the internal transmission image of any egg under test satisfies the expression:

[0075] ;

[0076] In the formula, denoted as the normalized fusion attenuation index of the c-th pixel in the internal transmission image of the i-th egg to be tested; denoted as the fusion attenuation index of the c-th pixel in the internal transmission image of the i-th egg to be tested; This represents the mean of the fusion attenuation index of all pixels in the internal transmission image of the i-th egg to be tested; The standard deviation of the fusion attenuation index of all pixels in the internal transmission image of the i-th egg under test; It is a local minimum value, used to prevent the denominator from being in the range of 1 / 2. A calculation error occurs when the value is 0, for example. .

[0077] The compensation modulation factor for any pixel in the internal transmission image of any egg under test satisfies the expression:

[0078] ;

[0079] In the formula, This represents the compensation modulation factor for the c-th pixel in the internal transmission image of the i-th egg to be tested. Indicates the first Gain slope parameters for each egg under test; Indicates the first The compensated activation threshold for each egg to be tested; Let represent the normalized fusion attenuation index of the c-th pixel in the internal transmission image of the i-th egg being tested. It should be noted that... and The skewness and kurtosis of the image statistical characteristics are adaptively determined, for example, , ,in , These are the kurtosis and skewness of the internal transmission image of the i-th egg to be tested. This is to prevent the minimum value where the denominator is 0.

[0080] In the formula, This indicates that scaling and translation of the normalized fusion decay exponent determines the activation position and steepness of the sigmoid function.

[0081] The compensation modulation factors of all pixels in the internal transmission image of the i-th egg to be tested constitute the compensation factor map of the i-th egg to be tested.

[0082] For example, for Figure 2 Statistical analysis of the entire fusion attenuation index plot yielded a mean of 5.0, a standard deviation of 8.0, a skewness of 1.2, and a kurtosis of 4.5. This resulted in a gain slope parameter of 0.18 and a compensation activation threshold of 1.44. For the coordinate... The pixel has a fusion attenuation index of . Then its Z-Score value is The compensation modulation factor at this point is equal to ; and It is obtained by retaining two decimal places.

[0083] At this point, the compensation factor diagrams for each egg to be tested were obtained.

[0084] S5: Based on the compensation factor map of each egg to be tested, perform exponential gain correction on the corresponding internal transmission image to obtain the corrected internal transmission image of each egg to be tested.

[0085] It should be noted that the attenuation of light in a medium is physically a multiplicative process, and is exponentially related to the attenuation exponent. Therefore, the correction should also adopt a multiplicative model to most accurately restore the intensity of the signal before attenuation. Thus, this invention converts the compensation factor map of each egg under test into a gain coefficient using an exponential function, and nonlinearly enhances the brightness of areas darkened by the eggshell in the internal transmission image of the egg under test.

[0086] Specifically, based on the compensation factor map of each egg to be tested, exponential gain correction is performed on the corresponding internal transmission image to obtain the corrected internal transmission image of each egg to be tested, including:

[0087] The corrected grayscale value of any pixel in the corrected internal transmission image of any egg under test satisfies the expression:

[0088] ;

[0089] In the formula, This represents the corrected grayscale value of the c-th pixel in the corrected internal transmission image of the i-th egg to be tested. This represents the grayscale value of the c-th pixel in the internal transmission image of the i-th egg to be tested. This represents the maximum gain control parameter. The intensity of the overall compensation can be adjusted based on the average color depth of the eggshell. For example, ; This represents the compensation modulation factor for the c-th pixel in the internal transmission image of the i-th egg to be tested. This represents the amplitude limiting function.

[0090] In the formula, This indicates that the original pixel grayscale value is multiplicatively amplified; Make The value can be in the grayscale range of 0 to 255.

[0091] For example, for coordinates Its compensation factor is The original grayscale value of this point is... The corrected grayscale is Since the brightness limit of an 8-bit image is 255, this value is eventually automatically clipped to 255 by the system.

[0092] The grayscale values ​​of all pixels in the corrected internal transmission image of each egg to be tested constitute the corrected internal transmission image of that egg. It should be noted that, as... Figure 3 This is a thermogram of the internal transmission image of the egg to be tested. Figure 4 This is a thermogram of the corrected internal transmission image of the egg to be tested.

[0093] At this point, calibrated internal transmission images of each egg to be tested were obtained.

[0094] S6: Based on the corrected internal transmission images of each egg to be tested, perform quality inspection on each egg to be tested.

[0095] It should be noted that the corrected internal transmission image has greatly eliminated the interference introduced by the eggshell color and texture. When applied to a real transmission image, this correction can significantly enhance the contour and contrast of internal defects or structures.

[0096] Specifically, for each egg to be tested, a corresponding defect detection algorithm is executed based on the corrected internal transmission image and the original RGB image, and all information is combined to output the final quality grade. For example, on the corrected internal transmission image, methods such as adaptive threshold segmentation and contour analysis are used to detect the presence of blood spots or flesh spots; on the original RGB image, algorithms such as edge detection are used to detect the presence of cracks. Finally, the grading result signal is sent to the automated sorting device to drive it to perform the corresponding physical sorting actions.

[0097] Thus, this invention completes the egg quality testing.

[0098] 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. An egg quality recognition method based on image processing, characterized by, include: Acquire an RGB image of the egg to be tested; convert the RGB image to a grayscale image to obtain an internal transmission image; The base attenuation index is obtained based on the grayscale values ​​of the internal transmission image; the local speckle response index is obtained based on the local grayscale differences of the internal transmission image, including: applying a Laplacian of Gaussian operator to the internal transmission image; taking the absolute value of the calculation result of the Laplacian of Gaussian operator at the corresponding pixel coordinates as the local speckle response index; and weightedly fusing the base attenuation index and the local speckle response index to obtain a fused attenuation index; the weights of the weighted fusion are obtained by performing principal component analysis on the base attenuation index and the local speckle response index of all pixels of each egg to be tested. A compensation factor map is generated based on the fusion attenuation index of each egg to be tested. The compensation factor map contains a compensation modulation factor corresponding to each pixel. The compensation modulation factor is positively correlated with the magnitude of the corresponding fusion attenuation index. The brightness of the internal transmission image is compensated based on the compensation factor map to obtain a corrected internal transmission image. The brightness compensation includes multiplying the gray value of each pixel by an exponential function of the corresponding compensation modulation factor. Obtaining the compensation modulation factor includes: performing Z-score normalization on the fusion attenuation index of each egg to be tested to obtain the normalized fusion attenuation index; and substituting the normalized fusion attenuation index into the Sigmoid function to obtain the compensation modulation factor. The quality of the eggs to be tested is determined based on the corrected internal transmission image and RGB image.

2. The egg quality recognition method based on image processing according to claim 1, characterized by, The base attenuation index satisfies the expression: ; In the formula, represents the base attenuation index of the i-th pixel point of the internal transmission image of the j-th egg to be tested; represents the maximum gray value of the pixel point; represents the gray value of the i-th pixel point of the internal transmission image of the j-th egg to be tested; is a minimum value, used to prevent the denominator from being 0.​​​​ 3. The image processing-based egg quality recognition method according to claim 1, characterized in that, The Gaussian Laplacian operator includes a scaling parameter, the value of which ranges from 2.5 to 3.

5.

4. The egg quality identification method based on image processing according to claim 1, characterized in that, The fusion attenuation index satisfies the following expression: ; In the formula, Indicates the first The first internal transmission image of the test egg The fusion attenuation index of each pixel; Indicates the first The first internal transmission image of the test egg The substrate attenuation index of each pixel; Indicates the first The first internal transmission image of the test egg Local spot response index of each pixel; , They are the first The optimal fusion weights for the base attenuation index and local spot response index of all pixels of the egg under test.

5. The egg quality identification method based on image processing according to claim 1, characterized in that, The compensation modulation factor satisfies the following expression: ; In the formula, Indicates the first The first internal transmission image of the test egg Compensation modulation factor for each pixel; Indicates the first Gain slope parameters for each egg under test; Indicates the first The compensated activation threshold for each egg to be tested; Indicates the first The first internal transmission image of the test egg The standardized fusion attenuation index for each pixel.

6. The egg quality recognition method based on image processing according to claim 5, characterized in that, The gain slope parameter is inversely correlated with the kurtosis of the fusion decay index of the corresponding egg under test; the compensation activation threshold is positively correlated with the skewness of the fusion decay index of the corresponding egg under test.

7. The egg quality recognition method based on image processing according to claim 1, characterized in that, The grayscale value of the corrected internal transmission image satisfies the following expression: ; In the formula, Indicates the first The corrected internal transmission image of the first test egg Corrected grayscale value of each pixel; Indicates the first The first internal transmission image of the test egg The grayscale value of each pixel; This represents the maximum gain control parameter; Indicates the first The first internal transmission image of the test egg Compensation modulation factor for each pixel; This represents the amplitude limiting function.

8. The egg quality identification method based on image processing according to claim 1, characterized in that, The quality inspection of the eggs to be tested includes: detecting whether there are blood spots or flesh spots on the calibrated internal transmission image; detecting whether there are cracks on the RGB image; and determining that the eggs to be tested are unqualified when at least one of blood spots, flesh spots or cracks is detected.

Citation Information

Patent Citations

  • Egg spot detection and automatic grading system based on deep learning or image recognition

    CN114342838B

  • Fertilized egg classification method and system based on transmission spectrum information

    CN118275369A