Machine vision-based beef pie green body defect online detection method
By using pixel-level spatial registration and gradient reconstruction fitting of multispectral band grayscale response values, combined with multi-frame verification to remove interference, accurate detection of defects in raw beef patties was achieved. This solves the problems of insufficient detection accuracy and reliability in existing technologies and provides efficient defect identification and classification support.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-18
- Publication Date
- 2026-04-14
AI Technical Summary
Existing beef patty raw material defect detection technologies suffer from inaccurate image preprocessing and insufficient correction for uneven illumination, leading to inaccurate defect feature extraction. Furthermore, the defect identification and verification processes are prone to misjudgment, and the detection accuracy and reliability are insufficient to meet industrial requirements.
By using pixel-level spatial registration and illumination unevenness correction, combined with gradient reconstruction fitting of multispectral band grayscale response values, the structured light field parameter matrix is calculated, gradient magnitude and direction analysis is performed, and transient interference is eliminated by multi-frame verification, thus achieving accurate determination of defect type and rendering of result images.
It significantly improves the accuracy and efficiency of defect detection, can identify real defect areas, reduce errors, provide intuitive detection results, and facilitate quality control.
Smart Images

Figure CN121856271A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of visual inspection technology, and in particular to an online detection method for defects in raw beef patties based on machine vision. Background Technology
[0002] In the production and inspection of raw beef patties, existing machine vision-based inspection technologies generally suffer from shortcomings in image preprocessing. The acquired raw surface images are not precisely registered at the pixel level and corrected for uneven illumination, resulting in problems such as image positional shifts and illumination distortion. Consequently, the accuracy of the basic data for subsequent defect feature extraction is insufficient, making it difficult to truly reflect the surface condition of the raw beef patties and creating potential errors in defect detection. Existing technologies only extract image features based on single grayscale information, without combining the differences in grayscale response across multiple spectral bands and the spatial structural features of the raw patty surface. The feature extraction is dimensional and lacks information, making it impossible to accurately capture subtle defect features on the raw patty surface.
[0003] Existing beef patty raw material defect detection technologies have significant shortcomings in their defect identification and verification processes. They fail to perform multi-frame verification and transient interference removal on initially identified defect candidate areas, easily misjudging transient interferences such as changes in light and shadow during production and equipment vibrations as actual defects, resulting in a high false alarm rate. Furthermore, defect type determination relies solely on simple feature comparison, lacking a standardized multi-dimensional defect spectral feature comparison table and a secondary verification step. This leads to low identification accuracy for different types of defects such as metallic foreign objects, bone particles, and cracks, resulting in frequent misjudgments and missed detections. The overall detection accuracy and reliability are insufficient to meet the actual needs of industrial online detection. Therefore, improving the efficiency of beef patty raw material defect detection has become an urgent problem to be solved. Summary of the Invention
[0004] This invention provides an online detection method for defects in raw beef patties based on machine vision, in order to solve the problems mentioned in the background art.
[0005] To achieve the above objectives, the present invention provides an online defect detection method for raw beef patties based on machine vision, comprising: S1. Perform pixel-level spatial registration on the original surface image of the beef patty blank, and perform illumination unevenness correction on the registered image to obtain the image of the beef patty blank to be analyzed. S2. Extract the grayscale response values of the pixel positions in the image to be analyzed under different spectral bands, and perform gradient reconstruction fitting on the differences between the grayscale response values to obtain the structured light field parameter matrix of the beef patty raw material. S3. Calculate the gradient magnitude and direction of the pixel position according to the structured light field parameter matrix to obtain the set of significantly different pixels of the beef patty raw material, and perform connected component analysis on the set of significantly different pixels to obtain the defect mask image of the beef patty raw material. S4. Based on the image to be analyzed, perform multi-frame verification to remove transient interference from the defect candidate region in the defect mask image to obtain the updated defect mask image of the beef patty raw material. S5. Traverse the connected components in the updated defect mask image to obtain the spectral feature vector of the updated defect mask image. Compare the spectral feature vector with the preset standard defect spectral feature comparison table item by item to obtain the defect type of the beef patty raw material. S6. Based on the position coordinates of the connected components in the updated defect mask image, the defect outline and the corresponding defect type are superimposed on the original surface image to obtain the detection result image of the beef patty raw material.
[0006] In a preferred embodiment, the step of performing pixel-level spatial registration on the original surface image of the beef patty blank and correcting for uneven illumination on the registered image to obtain the image of the beef patty blank to be analyzed includes: Acquire the original surface image of the raw beef patty, select a reference image from the original surface image, and use other images of the original surface image as images to be registered; Extract the reference feature point set from the reference image and the floating feature point set from the image to be registered; Bidirectional matching is performed on the baseline feature point set and the floating feature point set to obtain the matching feature point pair set of the beef patty raw material; Based on the set of matching feature points, the image to be registered is resampled to obtain the registered image of the beef patty raw material; The registered image is subjected to scene illumination component estimation to obtain the image to be analyzed of the beef patty raw material. In a preferred embodiment, the step of extracting the grayscale response values of pixel positions in the image to be analyzed under different spectral bands, and performing gradient reconstruction fitting on the differences between the grayscale response values to obtain the structured light field parameter matrix of the beef patty raw material includes: Traverse the pixel positions of the image to be analyzed, read the gray value of the pixel position, and arrange the gray value in spectral band order to obtain the multispectral gray vector of the pixel position; The multispectral grayscale vectors are compared and analyzed to obtain the grayscale differences between the multispectral grayscale vectors, and a local grayscale difference matrix of the pixel position is constructed based on the grayscale differences. Principal component analysis is performed on the local gray-level difference matrix. The direction with the largest variance in the local gray-level difference matrix is taken as the local surface gradient direction of the pixel position. Combined with the gradient magnitude of the pixel position, the local gradient vector of the pixel position is obtained. Based on the local gradient vector, the relative height of the pixel position is recursively calculated pixel by pixel by accumulating the height difference between adjacent pixels, thus obtaining the surface height distribution map of the beef patty raw material; Using the surface height distribution map as a new channel, the spectral band images of the image to be analyzed are superimposed to obtain the structured light field parameter matrix of the beef patty blank.
[0007] In a preferred embodiment, the step of obtaining the surface height distribution map of the beef patty raw material by accumulating the height differences between adjacent pixels and recursively calculating the relative height of the pixel position pixel by pixel based on the local gradient vector includes: The first pixel position in the upper left corner of the image to be analyzed is set as the height integration starting point, and the initial height value of the height integration starting point is assigned to the height integration starting point. All pixel positions in the image to be analyzed are sequentially according to the raster scanning order from left to right and from top to bottom. Based on the horizontal and vertical components in the local gradient vector, determine the horizontal and vertical height increments of the pixel position; The horizontal height increment and the vertical height increment are combined to obtain the relative height of the pixel position; The relative heights are arranged and combined according to the dimensions of the original surface image to obtain the surface height distribution map of the beef patty blank.
[0008] In a preferred embodiment, the step of calculating the gradient magnitude and direction of the pixel position based on the structured light field parameter matrix to obtain a set of significantly different pixels of the beef patty raw material, and performing connected component analysis on the set of significantly different pixels to obtain a defect mask image of the beef patty raw material, includes: By decomposing the structured light field parameter matrix, we can obtain the grayscale channel image and surface height distribution map of the beef patty raw material in the spectral band. Spatial differentiation is performed on the pixel positions in the grayscale channel image to obtain the horizontal gradient components and vertical gradient components of the pixel positions in the spectral band grayscale channel, and the horizontal gradient components and the vertical gradient components are integrated into a multispectral gradient vector set of the pixel positions; By combining the horizontal and vertical gradient components of the pixel location in the surface height distribution map, the height gradient vector of the pixel location is obtained. The fused gradient magnitude at the pixel location is calculated based on the multispectral gradient vector set and the height gradient vector. The multispectral gradient vector set and the height gradient vector are vector synthesized to obtain the gradient direction of the pixel position; The fused gradient magnitude and gradient direction are compared and analyzed with a preset gradient threshold to obtain a set of significantly different pixels in the beef patty raw material; Eight-neighbor connectivity analysis is performed on the set of significantly different pixels to obtain the defect mask image of the beef patty raw material.
[0009] In a preferred embodiment, the formula for calculating the fused gradient magnitude is: ; in, This represents the magnitude of the fused gradient. Indicates the pixel position at the th The horizontal gradient components of the grayscale channels in each spectral band Indicates the pixel position at the th Vertical gradient components of grayscale channels in each spectral band This represents the horizontal gradient component of the pixel location in the surface height distribution map. This represents the vertical gradient component of the pixel location in the surface height distribution map. This represents the preset band weighting factor. This represents the preset height weighting factor. This represents the preset nonlinear enhancement coefficient. This indicates the total number of spectral bands.
[0010] In a preferred embodiment, the step of performing multi-frame verification to remove transient interference from the defect candidate regions in the defect mask image based on the image to be analyzed, to obtain the updated defect mask image of the beef patty raw material, includes: Image registration is performed on the defect mask image to obtain the aligned defect mask image of the beef patty raw material; Traverse the connected components in the alignment defect mask image, use the connected components as defect candidate regions, and assign a unique tracking identifier to the defect candidate regions; Record the number of consecutive frames in which the defect candidate region appears in the aligned defect mask image, the centroid position offset, and the area change value. Based on the number of consecutive frames, the centroid position offset, and the area change value, the defect candidate region is comprehensively evaluated to obtain the transient interference region of the aligned defect mask image; After removing the transient interference region, an updated defect mask image of the beef patty blank is obtained.
[0011] In a preferred embodiment, the process of traversing the connected components in the updated defect mask image to obtain the spectral feature vector of the updated defect mask image, and comparing the spectral feature vector with a preset standard defect spectral feature lookup table item by item to obtain the defect type of the beef patty raw material, including: Extract the contour boundaries and internal pixel index sets of the connected components in the updated defect mask image, and then reverse-map the contour boundaries and internal pixel index sets to the image to be analyzed to obtain the pixel spectral response value matrix of the connected components. The pixel spectral response value matrix is statistically reduced to obtain the initial spectral feature vector of the connected domain, and the initial spectral feature vector is normalized to obtain the standard spectral feature vector of the connected domain. The standard spectral feature vector is compared item by item with a preset standard defect spectral feature comparison table to obtain the defect type of the beef patty raw material.
[0012] In a preferred embodiment, the step of comparing the standard spectral feature vector with a preset standard defect spectral feature lookup table item by item to obtain the defect type of the beef patty raw material includes: A standard defect spectral feature comparison table is pre-constructed, which includes various defect types such as metallic foreign objects, bone particles, hair, cracks, holes, and abnormal fat aggregation, and a reference spectral feature vector composed of typical gray-scale response values under the spectral band is provided for each defect type. By comparing the standard spectral feature vector with the reference spectral feature vector, the defect type corresponding to the reference spectral feature vector with the highest similarity to the standard spectral feature vector is selected as the potential defect type of the beef patty raw material; The potential defect types are verified by waveform similarity secondary verification to obtain the defect types of the beef patty raw material.
[0013] In a preferred embodiment, the step of overlaying and drawing the defect contour and the corresponding defect type onto the original surface image based on the position coordinates of the connected components in the updated defect mask image to obtain the detection result image of the beef patty raw material includes: Extract the set of contour point coordinates of connected components and the corresponding defect type labels from the updated defect mask image; The contour point coordinate set is mapped to the pixel coordinate system of the original surface image to obtain the contour mapping coordinate set of the beef patty blank; Using the original surface image as a base map, and employing highlight colors, the contour mapping coordinate set is connected to draw the defect contour lines of the beef patty raw material. The defect type label is superimposed on the defect outline to obtain the annotation layer of the beef patty raw material; By fusing the original surface image with the labeled layer, the detection result image of the beef patty blank is obtained.
[0014] Compared with the prior art, the present invention has the following beneficial effects: 1. This invention performs pixel-level spatial registration and illumination unevenness correction on the original image of the raw beef patty, and obtains the structured light field parameter matrix by combining gradient reconstruction fitting of gray-scale response values in multispectral bands. Then, the defect area is located by gradient amplitude and direction calculation and connected component analysis. At the same time, transient interference is eliminated through multi-frame verification, which greatly improves the accuracy of defect detection in raw beef patties. It can effectively identify the real defect area in the image, reduce the detection error caused by image deviation and environmental interference, and make the defect location more consistent with the actual situation.
[0015] 2. This invention achieves accurate determination of defect types by precisely comparing spectral feature vectors with a standard defect spectral feature comparison table. It can also overlay defect outlines and type labels onto the original image to form a detection result image. This not only improves the efficiency of defect detection in raw beef patties and enables rapid online identification and classification of defects, but also makes the detection results more intuitive, allowing staff to quickly obtain key information such as the location and type of defects. This provides efficient and clear technical support for the quality control of raw beef patties. Attached Figure Description
[0016] Figure 1 This is a flowchart illustrating an online defect detection method for raw beef patties based on machine vision, according to an embodiment of the present invention. The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0017] It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0018] This application provides an online detection method for defects in raw beef patties based on machine vision. The execution entity of this online detection method includes, but is not limited to, at least one of the following electronic devices that can be configured to execute the method provided in this application: a server, a terminal, etc. In other words, the online detection method for defects in raw beef patties based on machine vision can be executed by software or hardware installed on a terminal device or a server device. The server includes, but is not limited to, a single server, a server cluster, a cloud server, or a cloud server cluster. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0019] Reference Figure 1 The diagram shown is a flowchart illustrating an online defect detection method for raw beef patties based on machine vision, according to an embodiment of the present invention. In this embodiment, the online defect detection method for raw beef patties based on machine vision includes: S1. Perform pixel-level spatial registration on the original surface image of the beef patty blank, and perform illumination unevenness correction on the registered image to obtain the image of the beef patty blank to be analyzed. In this embodiment of the invention, the step of performing pixel-level spatial registration on the original surface image of the raw beef patty and correcting for uneven illumination on the registered image to obtain the image of the raw beef patty to be analyzed includes: Acquire the original surface image of the raw beef patty, select a reference image from the original surface image, and use other images of the original surface image as images to be registered; Extract the reference feature point set from the reference image and the floating feature point set from the image to be registered; Bidirectional matching is performed on the baseline feature point set and the floating feature point set to obtain the matching feature point pair set of the beef patty raw material; Based on the set of matching feature points, the image to be registered is resampled to obtain the registered image of the beef patty raw material; The scene illumination component is estimated from the registered image to obtain the image to be analyzed of the raw beef patty.
[0020] Industrial vision acquisition equipment is used to continuously acquire surface images of the moving beef patty blanks on the production line. During the acquisition process, the shooting parameters, shooting angle and shooting distance of the equipment are kept fixed to directly obtain the original surface images of the beef patty blanks. From the acquired original surface images, the image with clear picture, complete presentation of the beef patty blank and centered position is selected as the reference image. All other original surface images other than the reference image are designated as images to be registered.
[0021] Based on the corner and edge features of the image, a global feature point retrieval is performed on the reference image. All the retrieved valid feature points are integrated and collected to form the reference feature point set of the beef patty blank. Using the same feature point retrieval rules and retrieval range, a global feature point retrieval is performed on the image to be registered. All the retrieved valid feature points are integrated and collected to form the floating feature point set of the beef patty blank.
[0022] Using a single feature point in the baseline feature point set as a retrieval reference, the feature similarity between that feature point and all feature points in the floating feature point set is calculated. Floating feature points whose similarity meets the preset matching criteria are selected to form a preliminary feature point matching pair in one direction. Then, using the floating feature point as a retrieval reference, the feature similarity between it and the corresponding feature point in the baseline feature point set is calculated in reverse to verify whether it meets the preset matching criteria. Feature point pairs that pass both matching verifications are retained. All retained feature point pairs are integrated and aggregated to obtain the matching feature point pair set of the beef patty raw material.
[0023] Using the pixel coordinate system of the reference image as a unified reference system, and based on the coordinate correspondence of each feature point pair in the matching feature point pair set, the unique corresponding coordinate position of each pixel in the image to be registered in the pixel coordinate system of the reference image is determined. The pixel information of the image to be registered is re-acquired and arranged in an orderly manner according to the corresponding coordinate position, and the resampling operation of the image to be registered is completed, directly obtaining the registered image of the beef patty raw material.
[0024] The grayscale values of all pixels in the registered image are statistically analyzed point by point. Based on the distribution pattern of grayscale values, the overall grayscale information of the image is decomposed into the grayscale component of the background illumination and the body grayscale component corresponding to the real features of the beef patty surface. The grayscale component of the background illumination is separated and compensated in a targeted manner to complete the estimation of the background illumination component of the registered image, and directly obtain the image of the beef patty after eliminating the influence of uneven illumination.
[0025] The beneficial effects of this implementation process are that by fixing the parameters of the visual acquisition equipment, the consistency of the original surface image acquisition of the beef patty blank is ensured, avoiding image deviations introduced during the acquisition process. Through the global retrieval and bidirectional matching of corner and edge features, pixel-level spatial registration of the original surface image is achieved, unifying all images to be registered to the pixel coordinate system of the reference image, completely eliminating the positional offset problem between images. Then, by estimating the scene illumination component, the scene illumination grayscale component and the body grayscale component of the registered image are accurately separated, and the illumination component is compensated and adjusted, effectively eliminating the image grayscale distortion caused by uneven illumination. The final image to be analyzed can accurately and realistically reflect the surface features of the beef patty blank, and the pixel position remains highly accurate. This lays an accurate and reliable image foundation for the subsequent extraction and analysis of the defect features of the beef patty blank, avoiding defect detection errors caused by image deviations from the source of image preprocessing.
[0026] S2. Extract the grayscale response values of the pixel positions in the image to be analyzed under different spectral bands, and perform gradient reconstruction fitting on the differences between the grayscale response values to obtain the structured light field parameter matrix of the beef patty raw material. In this embodiment of the invention, the step of extracting the grayscale response values of pixel positions in the image to be analyzed under different spectral bands, and performing gradient reconstruction fitting on the differences between the grayscale response values to obtain the structured light field parameter matrix of the beef patty blank includes: Traverse the pixel positions of the image to be analyzed, read the gray value of the pixel position, and arrange the gray value in spectral band order to obtain the multispectral gray vector of the pixel position; The multispectral grayscale vectors are compared and analyzed to obtain the grayscale differences between the multispectral grayscale vectors, and a local grayscale difference matrix of the pixel position is constructed based on the grayscale differences. Principal component analysis is performed on the local gray-level difference matrix. The direction with the largest variance in the local gray-level difference matrix is taken as the local surface gradient direction of the pixel position. Combined with the gradient magnitude of the pixel position, the local gradient vector of the pixel position is obtained. Based on the local gradient vector, the relative height of the pixel position is recursively calculated pixel by pixel by accumulating the height difference between adjacent pixels, thus obtaining the surface height distribution map of the beef patty raw material; Using the surface height distribution map as a new channel, the spectral band images of the image to be analyzed are superimposed to obtain the structured light field parameter matrix of the beef patty blank.
[0027] The step of obtaining the surface height distribution map of the beef patty raw material by accumulating the height differences between adjacent pixels and recursively calculating the relative height of the pixel position pixel by pixel based on the local gradient vector includes: The first pixel position in the upper left corner of the image to be analyzed is set as the height integration starting point, and the initial height value of the height integration starting point is assigned to the height integration starting point. All pixel positions in the image to be analyzed are sequentially according to the raster scanning order from left to right and from top to bottom. Based on the horizontal and vertical components in the local gradient vector, determine the horizontal and vertical height increments of the pixel position; The horizontal height increment and the vertical height increment are combined to obtain the relative height of the pixel position; The relative heights are arranged and combined according to the dimensions of the original surface image to obtain the surface height distribution map of the beef patty blank.
[0028] The image to be analyzed is traversed one by one according to the order of raster scanning. During the traversal, the gray value corresponding to each pixel position in each spectral band is read. The gray values in each spectral band are arranged in the preset spectral band arrangement order to generate a corresponding multispectral gray vector for each pixel position.
[0029] The multispectral grayscale vectors at each pixel location are compared component by component to calculate the numerical difference between grayscale values in different spectral bands. This yields the grayscale difference between the multispectral grayscale vectors at each pixel location. The grayscale differences in each direction are then arranged according to the row and column rules of the matrix to construct a corresponding local grayscale difference matrix for each pixel location.
[0030] A simplified analysis of the data dimensions of the local gray-level difference matrix is performed to sort out the distribution characteristics of all data in the matrix, find the distribution direction with the largest data variance in the matrix, determine the local surface gradient direction of the corresponding pixel position, and integrate the direction with the gradient magnitude corresponding to the pixel position to form the local gradient vector of each pixel position.
[0031] The first pixel position in the upper left corner of the image to be analyzed is set as the height integration starting point, and the initial height value of the height integration starting point is assigned to zero. All pixel positions in the image to be analyzed are traversed in turn according to the raster scanning order from left to right and from top to bottom.
[0032] Based on the horizontal and vertical components contained in the local gradient vector of each pixel location, the height change values in the horizontal direction and the vertical direction relative to the neighboring pixels are calculated respectively, thereby determining the horizontal height increment and the vertical height increment of the corresponding pixel location.
[0033] The horizontal and vertical height increments of each pixel are numerically fused to obtain the height value of the starting point of the relative height integration for that pixel, thereby determining the relative height of each pixel.
[0034] The relative heights of all pixel positions are arranged in an orderly manner according to the pixel row and column size and position distribution of the original surface image to form a surface height distribution map that can reflect the three-dimensional state of the beef patty surface.
[0035] The generated surface height distribution map is used as an independent image channel and is overlaid with the original spectral band image channels of the image to be analyzed. The image data of all channels are integrated and collected to finally obtain the structured light field parameter matrix of the beef patty blank.
[0036] The beneficial effects are that this implementation process accurately captures the gray-level feature differences of the beef patty surface under different spectral bands by extracting multispectral gray-level vectors pixel by pixel and constructing a local gray-level difference matrix. Combined with the local gradient direction and amplitude determined by principal component analysis, a local gradient vector is formed, which provides an accurate feature basis for the recursive estimation of surface height. Then, by fixing the integration starting point and using raster scanning, the relative height is recursively estimated pixel by pixel. The generated surface height distribution map can truly reflect the three-dimensional structural features of the raw patty surface. Finally, this distribution map is used as a new channel and superimposed on the spectral band image. The resulting structured light field parameter matrix integrates multispectral gray-level information and surface spatial structure information, realizing a multi-dimensional representation of the raw patty surface features. This provides a comprehensive and reliable parameter basis for the accurate identification of subsequent defect features, effectively improving the richness and accuracy of defect feature extraction.
[0037] S3. Calculate the gradient magnitude and direction of the pixel position according to the structured light field parameter matrix to obtain the set of significantly different pixels of the beef patty raw material, and perform connected component analysis on the set of significantly different pixels to obtain the defect mask image of the beef patty raw material. In this embodiment of the invention, the step of calculating the gradient magnitude and direction of the pixel position based on the structured light field parameter matrix to obtain a set of significantly different pixels of the beef patty raw material, and performing connected component analysis on the set of significantly different pixels to obtain a defect mask image of the beef patty raw material, includes: By decomposing the structured light field parameter matrix, we can obtain the grayscale channel image and surface height distribution map of the beef patty raw material in the spectral band. Spatial differentiation is performed on the pixel positions in the grayscale channel image to obtain the horizontal gradient components and vertical gradient components of the pixel positions in the spectral band grayscale channel, and the horizontal gradient components and the vertical gradient components are integrated into a multispectral gradient vector set of the pixel positions; By combining the horizontal and vertical gradient components of the pixel location in the surface height distribution map, the height gradient vector of the pixel location is obtained. The fused gradient magnitude at the pixel location is calculated based on the multispectral gradient vector set and the height gradient vector. The multispectral gradient vector set and the height gradient vector are vector synthesized to obtain the gradient direction of the pixel position; The fused gradient magnitude and gradient direction are compared and analyzed with a preset gradient threshold to obtain a set of significantly different pixels in the beef patty raw material; Eight-neighbor connectivity analysis is performed on the set of significantly different pixels to obtain the defect mask image of the beef patty raw material.
[0038] The formula for calculating the fusion gradient magnitude is: ; in, This represents the magnitude of the fused gradient. Indicates the pixel position at the th The horizontal gradient components of the grayscale channels in each spectral band Indicates the pixel position at the th Vertical gradient components of grayscale channels in each spectral band This represents the horizontal gradient component of the pixel location in the surface height distribution map. This represents the vertical gradient component of the pixel location in the surface height distribution map. This represents the preset band weighting factor. This represents the preset height weighting factor. This represents the preset nonlinear enhancement coefficient. This indicates the total number of spectral bands.
[0039] The structured light field parameter matrix is decomposed and separated by channel dimension. The multispectral correlation data contained in the matrix are extracted and restored into grayscale channel images under each spectral band. At the same time, the corresponding surface structure correlation data in the matrix are extracted and restored into the surface height distribution map of the beef patty blank. Both types of images retain the pixel position correspondence consistent with the original structured light field parameter matrix.
[0040] The grayscale channel image under each spectral band is subjected to global pixel spatial differentiation processing. For each pixel position, the grayscale change value in the horizontal direction and the grayscale change value in the vertical direction are calculated to obtain the horizontal gradient component and vertical gradient component of the pixel position under the corresponding spectral band grayscale channel. The horizontal gradient component and vertical gradient component of the pixel position under all spectral bands are integrated and collected in band order to form a multispectral gradient vector set for each pixel position.
[0041] The surface height distribution map of the beef patty blank is subjected to spatial differentiation of pixels across the entire domain. For each pixel location, the height change value in the horizontal direction and the height change value in the vertical direction are calculated separately to obtain the horizontal gradient component and the vertical gradient component of the pixel location in the surface height distribution map. These two components are integrated to directly obtain the height gradient vector of each pixel location.
[0042] By combining the multispectral gradient vector set and the height gradient vector at each pixel location, a comprehensive numerical calculation is performed on each gradient component in the vector set and the component of the height gradient vector to obtain a fused gradient magnitude that can comprehensively characterize the degree of grayscale and height change at the pixel location. Each pixel location corresponds to a unique fused gradient magnitude.
[0043] The horizontal and vertical gradient components of the gray-level channel in the spectral bands are obtained by spatial differentiation of the gray-level channel image after decomposing the structured light field parameter matrix. Spatial differentiation calculates the difference between the gray-level values of neighboring pixels at each pixel location in the gray-level channel image, thereby obtaining the gray-level change rate of that pixel location in the horizontal and vertical directions. The horizontal and vertical gradient components of the surface height distribution map are obtained by spatial differentiation of the surface height distribution map after decomposing the structured light field parameter matrix. Spatial differentiation calculates the difference between the height values of neighboring pixels at each pixel location in the surface height distribution map, thereby obtaining the height change rate of that pixel location in the horizontal and vertical directions. The band weighting factor is a pre-set value based on the characterization ability of different spectral bands to the defect features of the beef patty raw material. The height weighting factor is a pre-set value based on the characterization ability of the surface height distribution to the defect features of the beef patty raw material. The nonlinear enhancement coefficient is a pre-set value to enhance the synergistic effect of multispectral gradient features. The total number of spectral bands is the actual number of spectral bands used when extracting the pixel gray-level response values of the image to be analyzed from the beef patty raw material.
[0044] The gradient features of grayscale channels in each spectral band are weighted and fused with the gradient features of surface height distribution map. At the same time, nonlinear enhancement processing is used to strengthen the synergistic effect of multispectral gradient features. The fused gradient amplitude can comprehensively characterize the grayscale and height variation features of the pixel position of the beef patty raw block. This value can accurately reflect the overall difference of the pixel position in the spectral and spatial dimensions.
[0045] As the horizontal and vertical gradient components of the pixel location in the grayscale channels of each spectral band increase, the fused gradient magnitude tends to increase, because an increase in these gradient components indicates a more significant change in the grayscale of the pixel location. Similarly, as the horizontal and vertical gradient components of the pixel location in the surface height distribution map increase, the fused gradient magnitude tends to increase, because an increase in these gradient components indicates a more significant change in the height of the pixel location. As the band weighting factor and height weighting factor increase, the proportion of the corresponding gradient features in the fusion calculation increases; if the corresponding gradient component is positive, the fused gradient magnitude tends to increase. As the nonlinear enhancement coefficient increases, the synergistic effect of multispectral gradient features is further strengthened, leading to an increase in the fused gradient magnitude. As the total number of spectral bands increases, the dimensions of the spectral gradient features participating in the fusion calculation increase; if the gradient component of the newly added band is positive, the fused gradient magnitude tends to increase.
[0046] The multispectral gradient vector set of each pixel position is vector synthesized to obtain a comprehensive spectral gradient vector. Then, the comprehensive spectral gradient vector is combined with the height gradient vector to form a second vector. The gradient direction corresponding to each pixel position is determined according to the direction of the synthesized vector. Each pixel position corresponds to a unique gradient direction.
[0047] The fused gradient magnitude and gradient direction of all pixel locations are compared one by one with the preset gradient magnitude threshold and gradient direction threshold. Pixels whose fused gradient magnitude exceeds the magnitude threshold and whose gradient direction meets the direction threshold judgment criteria are selected. All pixels that meet the judgment criteria are integrated and collected to obtain the set of significantly different pixels of the beef patty raw material.
[0048] Eight-neighbor connectivity retrieval is performed on all pixels in the set of significantly different pixels. Taking a single significantly different pixel as the core, the pixels in its eight neighboring positions (up, down, left, right, and four diagonals) are retrieved to see if they belong to the set of significantly different pixels. The significantly different pixels that are connected to each other are grouped into the same connected component. All connected components are labeled and their pixel position information is preserved. The labeled connected components are presented in the form of a binary image, directly obtaining the defect mask image of the beef patty raw material.
[0049] The beneficial effects are that this implementation process separates and extracts multispectral grayscale information and surface height information by decomposing the structured light field parameter matrix, making the gradient analysis of the two types of feature information more targeted. The multispectral gradient vector set and height gradient vector obtained by spatial differentiation can accurately capture the variation characteristics of pixel position in grayscale and height dimensions. By integrating the comprehensive judgment of gradient magnitude and gradient direction, it can effectively screen out significantly different pixels that truly reflect defect features, avoiding the bias of single-dimensional judgment. The eight-neighborhood connectivity analysis can accurately integrate discrete defect pixels into complete defect connected domains. The generated defect mask image can clearly and accurately characterize the location and range of defect areas on the surface of the beef patty raw cake, providing a precise defect area basis for subsequent defect verification and type determination, and greatly improving the accuracy and completeness of defect area identification.
[0050] S4. Based on the image to be analyzed, perform multi-frame verification to remove transient interference from the defect candidate region in the defect mask image to obtain the updated defect mask image of the beef patty raw material. In this embodiment of the invention, the step of performing multi-frame verification to remove transient interference from the defect candidate regions in the defect mask image based on the image to be analyzed, to obtain the updated defect mask image of the beef patty, includes: Image registration is performed on the defect mask image to obtain the aligned defect mask image of the beef patty raw material; Traverse the connected components in the alignment defect mask image, use the connected components as defect candidate regions, and assign a unique tracking identifier to the defect candidate regions; Record the number of consecutive frames in which the defect candidate region appears in the aligned defect mask image, the centroid position offset, and the area change value. Based on the number of consecutive frames, the centroid position offset, and the area change value, the defect candidate region is comprehensively evaluated to obtain the transient interference region of the aligned defect mask image; After removing the transient interference region, an updated defect mask image of the beef patty blank is obtained.
[0051] The defect mask images are registered using the same pixel-level spatial registration method as the original surface image of the beef patty blank. All defect mask images are unified into the pixel coordinate system of the reference image, so that the pixel position of each frame of defect mask image is precisely corresponding to the actual position of the beef patty blank, thus obtaining the aligned defect mask image of the beef patty blank.
[0052] The process involves traversing and aligning all marked connected components in the defect mask image in a predetermined order, directly defining each independent connected component as a defect candidate region, and assigning a unique character and number combination identifier to each defect candidate region according to the traversal order. This identifier serves as the tracking identifier for the defect candidate region, enabling the individual tracking and differentiation of each defect candidate region.
[0053] Based on continuously acquired frame sequences, each defect candidate region with a tracking identifier is monitored throughout the process. The number of image frames in which the defect candidate region continuously appears in the frame sequence is counted and recorded as the number of consecutive frames. At the same time, the change in centroid coordinates of the defect candidate region between adjacent frames is calculated and recorded as the centroid position offset. Then, the change in the number of pixels of the defect candidate region between adjacent frames is calculated and recorded as the area change value.
[0054] The number of consecutive frames, centroid position offset, and area change value of each defect candidate region are compared with the preset judgment criteria one by one. The overall judgment is made by combining the comprehensive matching of the three indicators. Defect candidate regions that do not reach the preset value for the number of consecutive frames, exceed the preset range for the centroid position offset, or do not meet the preset requirements for the area change value are all designated as transient interference regions for aligning the defect mask image.
[0055] In the aligned defect mask image, all pixel information that is identified as transient interference region is deleted as a whole, and only the defect candidate region that is determined to be related to the real defect is retained. The retained region retains the original connected component label and pixel position information, and finally the updated defect mask image of the beef patty blank is obtained.
[0056] The beneficial effects of this implementation process are that by uniformly registering the defect mask images, the accurate correspondence of the defect candidate region positions in multiple frames of images is ensured, laying the foundation for subsequent multi-frame verification. By assigning a unique tracking identifier to the defect candidate region, accurate individual monitoring of each region is achieved. Combined with the comprehensive judgment of the number of consecutive frames, centroid position offset, and area change value, transient interference regions caused by changes in light and shadow and equipment vibration during production can be accurately identified. By eliminating transient interference regions, false defect judgments caused by transient interference are effectively avoided, significantly reducing the false alarm rate of detection. The updated defect mask image only retains the real defect region, making subsequent defect type determination more targeted and accurate, and improving the overall reliability of defect detection.
[0057] S5. Traverse the connected components in the updated defect mask image to obtain the spectral feature vector of the updated defect mask image. Compare the spectral feature vector with the preset standard defect spectral feature comparison table item by item to obtain the defect type of the beef patty raw material. In this embodiment of the invention, the process of traversing the connected components in the updated defect mask image to obtain the spectral feature vector of the updated defect mask image, and comparing the spectral feature vector with a preset standard defect spectral feature lookup table item by item to obtain the defect type of the beef patty raw material, includes: Extract the contour boundaries and internal pixel index sets of the connected components in the updated defect mask image, and then reverse-map the contour boundaries and internal pixel index sets to the image to be analyzed to obtain the pixel spectral response value matrix of the connected components. The pixel spectral response value matrix is statistically reduced to obtain the initial spectral feature vector of the connected domain, and the initial spectral feature vector is normalized to obtain the standard spectral feature vector of the connected domain. The standard spectral feature vector is compared item by item with a preset standard defect spectral feature comparison table to obtain the defect type of the beef patty raw material.
[0058] The step of comparing the standard spectral feature vector with a preset standard defect spectral feature lookup table item by item to obtain the defect type of the beef patty raw material includes: A standard defect spectral feature comparison table is pre-constructed, which includes various defect types such as metallic foreign objects, bone particles, hair, cracks, holes, and abnormal fat aggregation, and a reference spectral feature vector composed of typical gray-scale response values under the spectral band is provided for each defect type. By comparing the standard spectral feature vector with the reference spectral feature vector, the defect type corresponding to the reference spectral feature vector with the highest similarity to the standard spectral feature vector is selected as the potential defect type of the beef patty raw material; The potential defect types are verified by waveform similarity secondary verification to obtain the defect types of the beef patty raw material.
[0059] For each labeled connected component in the updated defect mask image, a global pixel search is performed to accurately extract the contour boundary pixel index and the internal region pixel index of each connected component. The two types of pixel indices are integrated to form the pixel index set of the connected component. Then, according to the correspondence of pixel positions, the pixel index set is mapped inversely to the pixel coordinate system of the image to be analyzed. The grayscale response values of all pixels in each spectral band after mapping are extracted. These grayscale response values are arranged according to the dimensions of pixel rows and columns and spectral bands to obtain the pixel spectral response value matrix corresponding to each connected component.
[0060] A global statistical analysis is performed on the pixel spectral response value matrix to extract the core statistical features of each dimension within the matrix. Statistical dimensionality reduction of the data is completed by removing redundant data and retaining key feature information. The dimensionality-reduced feature data is arranged in a preset order to form the initial spectral feature vector of the connected domain. Then, all values within the initial spectral feature vector are scaled proportionally to ensure that the values within the vector are in a uniform range, thus obtaining the standard spectral feature vector of the connected domain.
[0061] Samples of common defects in raw beef patties, such as foreign metal objects, bone particles, hair, cracks, holes, and abnormal fat accumulation, were collected in advance. Typical gray-scale response values of each defect sample in each spectral band were extracted, and the typical gray-scale response values were arranged in a fixed order to form a reference spectral feature vector. A unique reference spectral feature vector was matched for each defect type. All defect types and reference spectral feature vectors were systematically integrated to construct a standard defect spectral feature comparison table.
[0062] The standard spectral feature vector of the connected domain of the beef patty blank is compared with the reference spectral feature vectors of all defect types in the standard defect spectral feature comparison table. The similarity value between the standard spectral feature vector and each reference spectral feature vector is calculated. The reference spectral feature vector with the highest similarity value is selected, and the defect type corresponding to the vector is determined as the potential defect type of the beef patty blank.
[0063] The reference spectral feature vector corresponding to the potential defect type and the standard spectral feature vector of the connected domain of the beef patty blank are converted into feature waveforms of the same dimension. A comprehensive waveform similarity comparison is performed on the overall trend, peak and trough positions, and numerical variation of the two feature waveforms to complete the secondary verification of the potential defect type. After the verification is passed, the potential defect type is the final defect type determined for the beef patty blank.
[0064] The beneficial effects are that this implementation process accurately extracts the true spectral response information of the defect region by back-mapping the pixel index set of the defect connected domain to the image to be analyzed. Statistical dimensionality reduction and normalization processing make the spectral feature vector more concise and comparable. The pre-constructed standard defect spectral feature comparison table covers common defect types in beef patty raw blanks, providing a standardized reference for defect judgment. The dual judgment method of screening potential defect types by component-by-component comparison and completing secondary verification by waveform similarity greatly improves the accuracy of defect type judgment, effectively avoids defect misjudgment caused by a single comparison method, and can accurately identify different types of defects such as metal foreign objects and bone particles, meeting the needs of refined defect detection in beef patty raw blanks.
[0065] S6. Based on the position coordinates of the connected components in the updated defect mask image, the defect outline and the corresponding defect type are superimposed on the original surface image to obtain the detection result image of the beef patty raw material.
[0066] In this embodiment of the invention, the step of overlaying and drawing the defect contour and the corresponding defect type onto the original surface image based on the position coordinates of the connected components in the updated defect mask image to obtain the detection result image of the beef patty raw material includes: Extract the set of contour point coordinates of connected components and the corresponding defect type labels from the updated defect mask image; The contour point coordinate set is mapped to the pixel coordinate system of the original surface image to obtain the contour mapping coordinate set of the beef patty blank; Using the original surface image as a base map, and employing highlight colors, the contour mapping coordinate set is connected to draw the defect contour lines of the beef patty raw material. The defect type label is superimposed on the defect outline to obtain the annotation layer of the beef patty raw material; By fusing the original surface image with the labeled layer, the detection result image of the beef patty blank is obtained.
[0067] Contour extraction is performed on each connected component in the updated defect mask image where the defect type has been determined. The pixel coordinates of all contour points on the edge of each connected component are accurately obtained and integrated into a contour point coordinate set. At the same time, the defect type determination results corresponding to each connected component are retrieved, and a unique defect type label is matched for each connected component to achieve a one-to-one correspondence between the contour point coordinate set and the defect type label.
[0068] Using the pixel coordinate system of the original surface image as a unified reference system, each coordinate value in the contour point coordinate set of each connected domain is precisely mapped to this coordinate system according to the correspondence of pixel positions. All the mapped coordinate values are then re-integrated to form the contour mapping coordinate set of the beef patty blank, ensuring that the coordinate set completely matches the pixel position of the original surface image.
[0069] The original surface image of the raw beef patty is used as the base image of the detection result image. A high-contrast highlight color is selected as the drawing color. According to the arrangement order of the coordinate points in the contour mapping coordinate set, all coordinate points are connected sequentially. The connection trajectory fits the actual edge of the defect area, and finally a clear and distinguishable defect contour line of the raw beef patty is formed.
[0070] At the preset positions of the completed defect outlines, add corresponding defect type labels. The labels are displayed in a way that avoids the critical areas of the defect outlines while ensuring visual clarity. All defect outlines are matched with corresponding defect type labels. The image layers with defect outlines and defect type labels are extracted separately to form the annotation layer of the beef patty raw material.
[0071] The annotation layer and the original surface image are merged. During the fusion process, all pixel information of the original surface image is preserved, while the defect outline and defect type label in the annotation layer are clearly superimposed on the corresponding positions of the original surface image. There is no pixel occlusion or offset between layers, and the final result image fully presents the surface condition and defect information of the raw beef patty.
[0072] The beneficial effects are that the implementation process achieves accurate positioning of defect contours on the original surface image through precise coordinate mapping, the defect contour lines drawn with highlighted colors make the edges and ranges of the defect area clearly distinguishable, the precise overlay of defect type labels achieves an intuitive correspondence between defect location and type, and the detection result image after layer fusion completely preserves the original surface information of the green blank and the defect detection information. This not only allows inspectors to quickly identify the specific location, range and type of defects, but also provides intuitive and accurate visual basis for defect tracing and handling in the production process, improving the practicality and visualization of defect detection results.
[0073] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0074] This application embodiment can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence is the theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0075] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A machine vision-based online detection method for defects in raw beef patties, characterized in that, The method includes: S1. Perform pixel-level spatial registration on the original surface image of the beef patty blank, and perform illumination unevenness correction on the registered image to obtain the image of the beef patty blank to be analyzed. S2. Extract the grayscale response values of the pixel positions in the image to be analyzed under different spectral bands, and perform gradient reconstruction fitting on the differences between the grayscale response values to obtain the structured light field parameter matrix of the beef patty raw material. S3. Calculate the gradient magnitude and direction of the pixel position according to the structured light field parameter matrix to obtain the set of significantly different pixels of the beef patty raw material, and perform connected component analysis on the set of significantly different pixels to obtain the defect mask image of the beef patty raw material. S4. Based on the image to be analyzed, perform multi-frame verification to remove transient interference from the defect candidate region in the defect mask image to obtain the updated defect mask image of the beef patty raw material. S5. Traverse the connected components in the updated defect mask image to obtain the spectral feature vector of the updated defect mask image. Compare the spectral feature vector with the preset standard defect spectral feature comparison table item by item to obtain the defect type of the beef patty raw material. S6. Based on the position coordinates of the connected components in the updated defect mask image, the defect outline and the corresponding defect type are superimposed on the original surface image to obtain the detection result image of the beef patty raw material.
2. The online detection method for defects in raw beef patties based on machine vision as described in claim 1, characterized in that, The process of performing pixel-level spatial registration on the original surface image of the raw beef patty and correcting for uneven illumination on the registered image to obtain the image of the raw beef patty to be analyzed includes: Acquire the original surface image of the raw beef patty, select a reference image from the original surface image, and use other images of the original surface image as images to be registered; Extract the reference feature point set from the reference image and the floating feature point set from the image to be registered; Bidirectional matching is performed on the baseline feature point set and the floating feature point set to obtain the matching feature point pair set of the beef patty raw material; Based on the set of matching feature points, the image to be registered is resampled to obtain the registered image of the beef patty raw material; The scene illumination component is estimated from the registered image to obtain the image to be analyzed of the raw beef patty.
3. The online detection method for defects in raw beef patties based on machine vision as described in claim 1, characterized in that, The step of extracting the grayscale response values of pixel positions in the image to be analyzed under different spectral bands, and performing gradient reconstruction fitting on the differences between the grayscale response values to obtain the structured light field parameter matrix of the beef patty blank includes: Traverse the pixel positions of the image to be analyzed, read the gray value of the pixel position, and arrange the gray value in spectral band order to obtain the multispectral gray vector of the pixel position; The multispectral grayscale vectors are compared and analyzed to obtain the grayscale differences between the multispectral grayscale vectors, and a local grayscale difference matrix of the pixel position is constructed based on the grayscale differences. Principal component analysis is performed on the local gray-level difference matrix. The direction with the largest variance in the local gray-level difference matrix is taken as the local surface gradient direction of the pixel position. Combined with the gradient magnitude of the pixel position, the local gradient vector of the pixel position is obtained. Based on the local gradient vector, the relative height of the pixel position is recursively calculated pixel by pixel by accumulating the height difference between adjacent pixels, thus obtaining the surface height distribution map of the beef patty raw material; Using the surface height distribution map as a new channel, the spectral band images of the image to be analyzed are superimposed to obtain the structured light field parameter matrix of the beef patty blank.
4. The online detection method for defects in raw beef patties based on machine vision as described in claim 3, characterized in that, The step of obtaining the surface height distribution map of the beef patty raw material by accumulating the height differences between adjacent pixels and recursively calculating the relative height of the pixel position pixel by pixel based on the local gradient vector includes: The first pixel position in the upper left corner of the image to be analyzed is set as the height integration starting point, and the initial height value of the height integration starting point is assigned to the height integration starting point. All pixel positions in the image to be analyzed are sequentially according to the raster scanning order from left to right and from top to bottom. Based on the horizontal and vertical components in the local gradient vector, determine the horizontal and vertical height increments of the pixel position; The horizontal height increment and the vertical height increment are combined to obtain the relative height of the pixel position; The relative heights are arranged and combined according to the dimensions of the original surface image to obtain the surface height distribution map of the beef patty blank.
5. The online detection method for defects in raw beef patties based on machine vision as described in claim 1, characterized in that, The step of calculating the gradient magnitude and direction of the pixel position based on the structured light field parameter matrix to obtain the set of significantly different pixels of the beef patty raw material, and performing connected component analysis on the set of significantly different pixels to obtain the defect mask image of the beef patty raw material, includes: By decomposing the structured light field parameter matrix, we can obtain the grayscale channel image and surface height distribution map of the beef patty raw material in the spectral band. Spatial differentiation is performed on the pixel positions in the grayscale channel image to obtain the horizontal gradient components and vertical gradient components of the pixel positions in the spectral band grayscale channel, and the horizontal gradient components and the vertical gradient components are integrated into a multispectral gradient vector set of the pixel positions; By combining the horizontal and vertical gradient components of the pixel location in the surface height distribution map, the height gradient vector of the pixel location is obtained. The fused gradient magnitude at the pixel location is calculated based on the multispectral gradient vector set and the height gradient vector. The multispectral gradient vector set and the height gradient vector are vector synthesized to obtain the gradient direction of the pixel position; The fused gradient magnitude and gradient direction are compared and analyzed with a preset gradient threshold to obtain a set of significantly different pixels in the beef patty raw material; Eight-neighbor connectivity analysis is performed on the set of significantly different pixels to obtain the defect mask image of the beef patty raw material.
6. The online detection method for defects in raw beef patties based on machine vision as described in claim 5, characterized in that, The formula for calculating the fusion gradient magnitude is: ; in, This represents the magnitude of the fused gradient. Indicates the pixel position at the th The horizontal gradient components of the grayscale channels in each spectral band Indicates the pixel position at the th Vertical gradient components of grayscale channels in each spectral band This represents the horizontal gradient component of the pixel location in the surface height distribution map. This represents the vertical gradient component of the pixel location in the surface height distribution map. This represents the preset band weighting factor. This represents the preset height weighting factor. This represents the preset nonlinear enhancement coefficient. This indicates the total number of spectral bands.
7. The online detection method for defects in raw beef patties based on machine vision as described in claim 1, characterized in that, The step of performing multi-frame verification to remove transient interference from the defect candidate regions in the defect mask image based on the image to be analyzed, to obtain the updated defect mask image of the beef patty raw material, includes: Image registration is performed on the defect mask image to obtain the aligned defect mask image of the beef patty raw material; Traverse the connected components in the alignment defect mask image, use the connected components as defect candidate regions, and assign a unique tracking identifier to the defect candidate regions; Record the number of consecutive frames in which the defect candidate region appears in the aligned defect mask image, the centroid position offset, and the area change value. Based on the number of consecutive frames, the centroid position offset, and the area change value, the defect candidate region is comprehensively evaluated to obtain the transient interference region of the aligned defect mask image; After removing the transient interference region, an updated defect mask image of the beef patty blank is obtained.
8. The online detection method for defects in raw beef patties based on machine vision as described in claim 1, characterized in that, The process involves traversing the connected components in the updated defect mask image to obtain the spectral feature vector of the updated defect mask image. This spectral feature vector is then compared item by item with a preset standard defect spectral feature lookup table to determine the defect types of the raw beef patty, including: Extract the contour boundaries and internal pixel index sets of the connected components in the updated defect mask image, and then reverse-map the contour boundaries and internal pixel index sets to the image to be analyzed to obtain the pixel spectral response value matrix of the connected components. The pixel spectral response value matrix is statistically reduced to obtain the initial spectral feature vector of the connected domain, and the initial spectral feature vector is normalized to obtain the standard spectral feature vector of the connected domain. The standard spectral feature vector is compared item by item with a preset standard defect spectral feature comparison table to obtain the defect type of the beef patty raw material.
9. The online detection method for defects in raw beef patties based on machine vision as described in claim 8, characterized in that, The step of comparing the standard spectral feature vector with a preset standard defect spectral feature lookup table item by item to obtain the defect type of the beef patty raw material includes: A standard defect spectral feature comparison table is pre-constructed, which includes various defect types such as metallic foreign objects, bone particles, hair, cracks, holes, and abnormal fat aggregation, and a reference spectral feature vector composed of typical gray-scale response values under the spectral band is provided for each defect type. By comparing the standard spectral feature vector with the reference spectral feature vector, the defect type corresponding to the reference spectral feature vector with the highest similarity to the standard spectral feature vector is selected as the potential defect type of the beef patty raw material; The potential defect types are verified by waveform similarity secondary verification to obtain the defect types of the beef patty raw material.
10. The online detection method for defects in raw beef patties based on machine vision as described in claim 1, characterized in that, The step of overlaying and drawing the defect contour and the corresponding defect type onto the original surface image based on the position coordinates of the connected components in the updated defect mask image to obtain the detection result image of the beef patty raw material includes: Extract the set of contour point coordinates of connected components and the corresponding defect type labels from the updated defect mask image; The contour point coordinate set is mapped to the pixel coordinate system of the original surface image to obtain the contour mapping coordinate set of the beef patty blank; Using the original surface image as a base map, and employing highlight colors, the contour mapping coordinate set is connected to draw the defect contour lines of the beef patty raw material. The defect type label is superimposed on the defect outline to obtain the annotation layer of the beef patty raw material; By fusing the original surface image with the labeled layer, the detection result image of the beef patty blank is obtained.
Citation Information
Patent Citations
Image registration method, computer equipment and storage medium
CN111951311A
Multispectral image registration method and system combining morphological characteristics and point characteristics
CN116523978A
Cord fabric production defect identification and analysis system based on machine vision
CN120219368A
Crushing particle size measuring method for runway long-wave uneven resonance crushing
CN120747150A
LED packaging tiny defect detection system based on machine vision
CN120823182A