Food production line real-time monitoring method and system based on image processing

Through the anisotropic diffusion model and the multi-constrained edge connection method, the problems of edge breakage and false edges in complex food images are solved, and the accurate extraction of food contours and defect recognition are achieved.

CN120807646AActive Publication Date: 2025-10-17SHAANXI YIMING FOOD CO LTD

Patent Information

Application Number
CN202511301239.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-12
Publication Date
2025-10-17
Estimated Expiration
2045-09-12

AI Technical Summary

Technical Problem

In the existing technology of complex food image processing, the edge detection algorithm cannot take into account both strong edges and weak edges, resulting in contour breaks or pseudo-edge interference, affecting the defect recognition effect.

Method used

An anisotropic diffusion model in which the diffusion coefficient is inversely proportional to the gradient amplitude is used to smooth the image. The threshold is adjusted by combining fractal dimension and local phase consistency. Edge points are connected by gradient direction and geometric collinearity, and defects are located using wavelet transform.

Benefits of technology

It achieves accurate extraction of true edges under complex backgrounds, reduces contour breaks and pseudo-edge interference, generates complete, continuous and smooth food contours, and improves the accuracy of defect recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120807646A_ABST
    Figure CN120807646A_ABST
Patent Text Reader

Abstract

The invention relates to the field of image processing, and particularly discloses a food production line real-time monitoring method and system based on image processing, and the method comprises the following steps: S1, obtaining an original image of to-be-monitored food, carrying out the graying of the original image, and carrying out the smoothing of the original image through employing an anisotropic diffusion model with the diffusion coefficient being inversely proportional to the gradient amplitude, and obtaining a preprocessed image; s2, calculating a gradient magnitude and a gradient direction of each pixel point in the preprocessed image; and S3, for any pixel point in the preprocessed image, calculating the fractal dimension and local phase consistency of a window area of the pixel point, obtaining an adjustment coefficient from a preset lookup table based on the two feature values, and adjusting a preset reference threshold by using the adjustment coefficient to obtain a dynamic high threshold Thigh. The method has the beneficial effects that the judgment basis of edge connection is more sufficient, more complete, continuous and smooth food contours can be generated, and fracture and burrs of the contours are remarkably reduced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of image processing, in particular to a food production line real-time monitoring method and system based on image processing. BACKGROUND

[0002] In the field of modern food production and processing, automatic quality detection is the core link to ensure product quality and improve production efficiency. Machine vision technology is often applied to food production lines due to its non-contact, high efficiency, and high precision, and is used to monitor the size, shape, and surface defects of products in real time. In these vision detection tasks, edge detection as a basic step of image processing directly affects the accuracy of subsequent feature extraction and defect recognition. By accurately extracting the edge profile of food, its geometric shape can be effectively analyzed, and common defects such as breakage, gaps, adhesion, or irregular shapes can be located. The Canny operator usually includes steps such as Gaussian filtering, gradient calculation, non-maximum suppression, and double-threshold hysteresis connection.

[0003] In practical applications, especially when dealing with complex background, uneven lighting, and diverse texture food images, a globally uniform high and low threshold is used, which cannot adapt to changes in local image content. When there are strong and weak edges in the image, a single threshold cannot be balanced: a high threshold will cause the loss of weak edge information with rich details, resulting in contour breakage; a low threshold will introduce a large number of false edges caused by background texture or noise, interfering with the extraction of the real contour. In addition, the hysteresis connection process only simply judges the adjacency relationship between candidate edge points and strong edge points, without fully considering the geometric continuity and directional consistency of the edge, which is prone to false connections under noise interference, affecting the smoothness and integrity of the contour, and further causing difficulties in subsequent contour-based defect analysis. SUMMARY

[0004] The present application provides a food production line real-time monitoring method and system based on image processing, aiming to solve the limitations of edge detection algorithms in complex food image processing in related technologies.

[0005] In a first aspect, the present application provides a food production line real-time monitoring method based on image processing, comprising the following steps: S1, obtaining an original image of the food to be monitored, and after gray-scale processing and smoothing using an anisotropic diffusion model with a diffusion coefficient inversely proportional to the gradient amplitude, obtaining a preprocessed image; S2, calculating the gradient amplitude and gradient direction of each pixel point in the preprocessed image; S3, for any pixel in the preprocessed image, calculate the fractal dimension and local phase consistency of the pixel window area, and based on these two eigenvalues, obtain an adjustment coefficient from the preset lookup table, and use the adjustment coefficient to adjust the preset baseline threshold to obtain the dynamic high threshold T high , using the preset low threshold proportional coefficient to adjust the dynamic high threshold T high Adjust to get dynamic low threshold T low ; S4, the gradient amplitude is higher than its corresponding dynamic high threshold T high The pixel point is determined as a strong edge point, and the gradient amplitude is between its corresponding dynamic low threshold T low With dynamic high threshold T high The pixels between are determined as candidate edge points; S5, for any candidate edge point, calculate the connection contribution by comprehensively considering its gradient direction similarity, gradient amplitude and geometric collinearity with the strong edge points in the eight neighborhoods. When the cumulative connection contribution exceeds the preset threshold, the candidate edge point is determined to be the final edge point; S6, connect all strong edge points with the final edge point to form the food edge contour, represent the food edge contour as an ordered coordinate point sequence and calculate its local curvature; by performing a one-dimensional wavelet transform on the local curvature sequence, locate the energy anomaly point in the high-frequency subband and map it back to the food edge contour, thereby determining the defect location of the food.

[0006] Preferably, the anisotropic diffusion model is the Perona-Malik diffusion model, and the calculation formula of its diffusion coefficient c is: , where |▽I | is a pixel ( ) is the gradient amplitude after t iterations, and K is the gradient adjustment constant.

[0007] Preferably, in S3, a differential box counting method is adopted, in which a multi-size box coverage count is performed on the three-dimensional surface composed of grayscale values ​​in a window area of ​​a preset size centered on the target pixel point, and a linear fitting is performed in a double logarithmic coordinate system, and the slope of the fitting line is used as the fractal dimension of the window area.

[0008] Preferably, a logarithmic Gabor wavelet is used to perform multi-scale and multi-directional filtering on a window area of ​​a preset size, and the local phase consistency is obtained by calculating the energy-weighted average of the filtering responses at each scale.

[0009] Preferably, in S3, the Otsu method is used to calculate the baseline threshold T of the pre-processed image. base; for any pixel point, according to the fractal dimension of its window region and the local phase consistency, an index adjustment coefficient μ is indexed from a preset two-dimensional lookup table; the dynamic high threshold T high =μ×T base , and the dynamic low threshold T low =λ×T high , wherein λ is a preset low threshold proportion coefficient, and the value range is 0.4 to 0.6.

[0010] Preferably, in S5, for any candidate edge point p, strong edge points q in the eight-neighborhood of the candidate edge point p are traversed, the connection contribution degree C(p, q) between the candidate edge point p and the strong edge point q is calculated, and all C(p, q) are accumulated, wherein C(p, q) is calculated by the following formula: , wherein θ p and θ q are gradient directions of the candidate edge point p and the strong edge point q, M q is a gradient amplitude of the strong edge point q, M max is a maximum gradient amplitude of the preprocessed image, is an included angle between an edge tangent direction of the candidate edge point p and a connection vector of the candidate edge point p to the strong edge point q, and the edge tangent direction is orthogonal to the gradient direction of the candidate edge point p, , , are preset weights satisfying and 1.

[0011] Preferably, in S6, for any point in the ordered coordinate point sequence P, the central difference method is used to calculate the approximate values of the first derivative and the second derivative, and further to obtain the curvature value.

[0012] Preferably, in S6, the local curvature sequence is subjected to multi-layer discrete wavelet transform to obtain a high-frequency detail coefficient sequence of a specified layer; the median absolute deviation of the high-frequency detail coefficient sequence is calculated; a coefficient point whose absolute value exceeds a preset multiple of the median absolute deviation is identified as an abnormal point, and is mapped back to the contour to determine the defect position.

[0013] Preferably, in S1, the original image is an image in RGB format.

[0014] In a second aspect, the present application provides an image processing-based real-time monitoring system for a food production line, comprising a memory and a processor, and the memory stores computer program instructions, which, when executed by the processor, implement the above-mentioned image processing-based real-time monitoring method for a food production line.

[0015] By adopting the above technical solutions, the present application has the following beneficial effects: Compared with the prior art, the application provides more fine edge determination basis for each pixel point in the preprocessed image by combining the window region texture complexity and structural saliency features of the pixel points, so that the challenges brought by complex background and uneven illumination in the original image can be effectively coped with, the noise is effectively inhibited and the pseudo edges are filtered out, and the real and weak edge details are maximally retained. In the edge connection process, the judgment basis for the edge connection is more sufficient through multiple constraints such as gradient direction, gradient amplitude and geometric collinearity, so that the food contour generated is more complete, continuous and smooth, and the contour breakage and burrs are significantly reduced. BRIEF DESCRIPTION OF DRAWINGS

[0016] Figure 1 A flowchart of the food production line real-time monitoring method based on image processing.

[0017] Figure 2 A structural framework diagram of the food production line real-time monitoring system based on image processing. DETAILED DESCRIPTION

[0018] The technical solutions in the embodiments of the application will be clearly and completely described below with reference to the drawings in the embodiments of the application. It should be known by those skilled in the art that the embodiments described below are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of the present application.

[0019] Embodiments of the food production line real-time monitoring method based on image processing provided by the application are as follows: As shown in Figure 1 The food production line real-time monitoring method based on image processing comprises the following steps: S1, obtaining an original image of a food to be monitored, and obtaining a preprocessed image after gray-scale processing and smoothing by using an anisotropic diffusion model with a diffusion coefficient inversely proportional to a gradient amplitude.

[0020] The camera deployed above the food conveying belt continuously takes pictures of the food at fixed time intervals to obtain the original image of the food to be monitored. The original image is a color image and is an image in RGB format. Each color image is subjected to gray-scale processing to be converted into a single-channel gray-scale image. The anisotropic diffusion equation is applied to the gray-scale image for iterative processing to smooth the noise in the internal region of the gray-scale image and maintain the sharpness of the edge. The diffusion coefficient function is set as the inverse of the gradient amplitude, so that the diffusion effect is strong in the flat region with small gradient amplitude in the gray-scale image to effectively filter out the noise, and the diffusion effect is weak in the edge region with large gradient amplitude to avoid edge blurring.

[0021] In an alternative embodiment, the smoothing is performed using an anisotropic diffusion model with a diffusion coefficient inversely proportional to the gradient magnitude, specifically, the Perona-Malik diffusion model is used, and the diffusion coefficient c is calculated according to the following formula: ; where |▽I |tis the gradient magnitude of the pixel point ) after t iterations, and K is a gradient adjustment constant.

[0022] For example, for a pre-processed image containing obvious edges and uniform areas, the gradient adjustment constant K can be set to 30. In an edge area with a large pixel gradient magnitude, for example, with a gradient magnitude of 90, the calculated diffusion coefficient c is about 0.1, which is small, so the smoothing diffusion effect is weak here, and the edge is protected from being blurred. On the contrary, in a uniform area with a small pixel gradient magnitude, for example, with a gradient magnitude of 5, the calculated diffusion coefficient c is about 0.97, close to 1, which means that the smoothing diffusion effect is strong here, and can effectively filter out random noise in the area. By setting the number of iterations N, for example, to 15, the smoothing process will be repeated 15 times. Each iteration continues to suppress noise and preserve edges based on the results of the previous processing. This iterative approach makes the smoothing effect more refined and controllable, and the final pre-processed image eliminates most of the interference noise while preserving the clear contour information essential for subsequent edge detection.

[0023] S2, calculate the gradient magnitude and direction of each pixel point in the pre-processed image.

[0024] For example, a 3x3 Sobel operator is used to perform convolution operations on the pre-processed image to calculate the horizontal gradient Gx and the vertical gradient Gy respectively; for each pixel point in the pre-processed image, its gradient magnitude is obtained by calculating the square root of the sum of the squares of Gx and Gy, and its gradient direction is obtained by calculating the arctangent of Gy and Gx.

[0025] S3, for any pixel point in the pre-processed image, calculate the fractal dimension and local phase consistency of the pixel point window region, and based on these two characteristic values, obtain an adjustment coefficient from a pre-set lookup table, and use the adjustment coefficient to adjust the pre-set reference threshold to obtain a dynamic high threshold T high , and use the pre-set low threshold proportion coefficient to adjust the dynamic high threshold T high to obtain a dynamic low threshold T low .

[0026] In an alternative embodiment, a differential box counting method is adopted. In a preset size window centered at the target pixel, a three-dimensional surface is formed by the gray values in the window region. The box counting method is used to count the number of boxes of different sizes covering the three-dimensional surface. A linear fitting is performed in a double logarithmic coordinate system, and the slope of the fitted straight line is taken as the fractal dimension of the window region. A log Gabor wavelet is used to perform multi-scale and multi-direction filtering on the window region of the preset size. The energy weighted average value of the filtering response of each scale is calculated to obtain the local phase consistency.

[0027] The two features calculated in this embodiment are used to describe the local characteristics of the pixel from different angles. The fractal dimension of the window region is used to quantify the texture complexity and roughness of the local region of the preprocessed image. For example, in a 16x16 pixel window centered at the target pixel, boxes of different sizes such as 2, 4, 8, etc. are used to cover the three-dimensional surface formed by the gray values in the window. For a region with complex texture, such as a rough cloth surface, the number of boxes needed to cover will increase rapidly as the size of the box decreases. The slope of the straight line fitted in the double logarithmic coordinate system, i.e. the fractal dimension, may be 2.8. For a smooth metal surface, the fractal dimension value may be only 2.2. The local phase consistency is used to measure the degree of prominence of the pixel as an edge feature. A log Gabor wavelet of 4 scales and 6 directions is used to filter the above-mentioned 16x16 pixel window. If a pixel is located on a clear edge, the phases of its Fourier components in the filtering response of different scales and directions will be highly consistent, and the energy weighted average value calculated, i.e. the phase consistency, will be a high value close to 1. Conversely, if the pixel is located on a region without structural features or a noise point, the phases will be randomly distributed, and the calculated phase consistency value will be low, e.g. less than 0.2. The combination of the two features can more comprehensively describe the local information of the pixel.

[0028] In an alternative embodiment, the Otsu method is used to calculate the reference threshold T base of the preprocessed image. For any pixel, the adjustment coefficient μ is indexed from a preset two-dimensional lookup table according to the fractal dimension and the local phase consistency of its window region. The dynamic high threshold T high of the pixel is T base = μ × T low , and the dynamic low threshold T high is λ × T high , where λ is a preset low threshold proportion coefficient, and the value range is 0.4 to 0.6.

[0029] By analyzing the preprocessed image using the Otsu method, a global reference threshold T base120. This value itself can be used as a basic reference, but it cannot well adapt to the local changes within the preprocessed image. For any pixel in the preprocessed image, the two characteristic values of fractal dimension and local phase consistency of the window region calculated in the previous step are used to query the corresponding adjustment coefficient μ in a preset two-dimensional lookup table. For example, a pixel in a complex texture region has a fractal dimension of 2.7 and a phase consistency of 0.4, and the μ value obtained by lookup table is 1.4. Another pixel on a clear contour has a fractal dimension of 2.3 and a phase consistency of 0.9, and the μ value obtained by lookup table is 0.9. Therefore, the dynamic high threshold T high of the former is adjusted to 1.4 x 120 = 168, and the dynamic high threshold T high of the latter is adjusted to 0.9 x 120 = 108. If the low threshold proportion coefficient λ is 0.5, the dynamic low thresholds of the two points are 84 and 54, respectively. This way makes the threshold higher in the texture region, which is not easy to misjudge the texture as an edge, and the threshold lower in the real edge region, which ensures the complete detection of the edge.

[0030] S4, the pixel points with gradient amplitudes higher than the corresponding dynamic high threshold T high are determined as strong edge points, and the pixel points with gradient amplitudes between the corresponding dynamic low threshold T low and the dynamic high threshold T high are determined as candidate edge points.

[0031] Each pixel point in the preprocessed image is traversed, and the gradient amplitude G calculated in the second step and the dynamic high threshold T high and the dynamic low threshold T low determined for the point in the third step are compared; if G is greater than T high , the pixel point is marked as a strong edge point; if G is between T low and T high , it is marked as a candidate edge point; if G is less than T low , the point is considered as a non-edge point and is suppressed.

[0032] S5, for any candidate edge point, the connection contribution degree is calculated by comprehensively considering the gradient direction similarity, gradient amplitude and geometric collinearity of the strong edge points in the eight-neighbor region, and when the cumulative connection contribution degree exceeds a preset threshold, the candidate edge point is determined as a final edge point.

[0033] For each candidate edge point, check its eight neighboring pixels; if there is a strong edge point in the neighborhood, then for each strong edge point, calculate three components: one is the difference of the gradient direction, the smaller the difference, the higher the similarity; the second is based on the gradient amplitude of the strong edge point, the greater the amplitude, the higher the contribution weight; the third is to investigate whether the candidate point, the strong edge point and another point in the extension direction of the strong edge point are approximately on a straight line to judge geometric collinearity; the weighted sum of the three components is obtained. The connection contribution degree of the strong edge point to the candidate edge point; accumulate all the connection contribution degrees from the strong edge points in the eight neighborhoods, if the total exceeds a predetermined connection judgment threshold, then the candidate edge point is confirmed as a real edge point, that is, the final edge point.

[0034] In an optional embodiment, the connection contribution degree is calculated, specifically: for any candidate edge point p, traverse the strong edge points q in its eight neighborhoods, calculate the connection contribution degree C(p, q) between p and q, and accumulate all C(p, q); wherein C(p, q) is calculated by the following formula: ; In the formula, θ p and θ q are the gradient directions of the candidate edge point p and the strong edge point q, M q is the gradient amplitude of the strong edge point q, M max is the maximum gradient amplitude of the preprocessed image, is the angle between the edge tangent direction at the candidate edge point p and the connection vector from the candidate edge point p to the strong edge point q, and the edge tangent direction is orthogonal to the gradient direction of the candidate edge point p, 、 、 is a preset weight satisfying and 1.

[0035] The embodiment is used to judge whether a candidate edge point should be accepted as a real edge point. The judgment is based on the association strength between it and its surrounding neighbors confirmed as strong edge points. For example, there is a candidate edge point p, and a strong edge point q appears in its eight neighboring pixels. Set the weight to 0.5, to 0.3, = 0.2. Three aspects are analyzed to calculate the connection contribution. First, the similarity of gradient direction. If the gradient direction of candidate edge point p is 30 degrees and the gradient direction of strong edge point q is 35 degrees, they are very close, so the result of the first term is close to 0.5, indicating that they are likely to belong to the same continuous edge. Second, the intensity of neighbors. Assuming that the maximum gradient amplitude of the preprocessed image is 250 and the gradient amplitude of strong edge point q is 200, the result of the second term is: 0.3 x 200 ÷ 250 = 0.24, which indicates that strong edge point q is a significant strong edge point q, and its connection value is higher. Third, the continuity of geometric position. If the vector direction from candidate edge point p to strong edge point q is almost consistent with the edge tangent direction at candidate edge point p, the included angle is close to 0 degrees, and the result of the third term is close to 0.2. Adding the three terms, the connection contribution between candidate edge point p and strong edge point q is 0.94. By accumulating the contribution of candidate edge point p and all strong edge neighbors, if the total exceeds a predetermined threshold, candidate edge point p is confirmed as a real edge, and reliable connection of the edge is achieved.

[0036] S6, connecting all strong edge points and final edge points to form a food edge contour, representing the food edge contour as an ordered coordinate point sequence and calculating its local curvature; by performing one-dimensional wavelet transform on the local curvature sequence, locating energy abnormal points in the high-frequency subband, and mapping them back to the food edge contour, the defect position of the food is determined.

[0037] All strong edge points and confirmed final edge points are combined to form a binary edge map; a contour tracking algorithm such as Moore neighborhood tracking is used to connect along the edge pixel points to form one or more closed or open ordered point sequences composed of (x, y) coordinates, which is the edge contour of the food; for each point in the contour sequence, take several points before and after it, and fit a circle using these points, the reciprocal of the radius of the circle is the local curvature of the point, thus obtaining a one-dimensional local curvature sequence; discrete wavelet transform is applied to the curvature sequence to check its high-frequency detail component; in the detail component, points with energy or amplitude much higher than the average level are identified as energy abnormal points, which usually correspond to sharp corners or breaks in the contour, i.e. food defects; the index of these abnormal points in the curvature sequence is recorded, and the corresponding coordinate point in the contour coordinate sequence is found according to the index, which is the exact position of the food surface defect.

[0038] In an optional embodiment, for any point p in the ordered coordinate point sequence P i =( i , i ), the central difference method is used to calculate its first derivative ( , ) and the second derivative ( , ) and substitute them into the curvature formula to obtain each curvature value that constitutes the local curvature sequence.

[0039] The purpose of this embodiment is to quantify the geometry of the profile into a sequence of curvature values, so that the profile can be analyzed to locate abnormal points such as sharp corners or dents. Curvature describes the degree of bending of a curve, and the curvature of a straight section is close to zero, while the curvature of a sharp turn is very large. For example, there is an ordered sequence of profile points obtained from the previous step, which contains three consecutive points p i-1 with coordinates (20, 30), p i with coordinates (22, 31), and p i+1 with coordinates (24, 30). The first and second derivatives of p i are estimated using the central difference method. The first derivative component of p ≈ 24-20 ÷ 2 = 2, ≈ 30-30 ÷ 2 = 0. The second derivative component of p ≈ 24-2×22 + 20 = 0, ≈ 30-2×31 + 30 = -2. Substituting these derivative values into the curvature formula, the curvature value of p i is calculated to be about 0.5. If the profile has a sharp dent at this point, for example, the coordinates of p i+1 become (23, 35), then the calculated curvature value will increase sharply, possibly more than 5.0. By performing such calculations for each point on the profile, a local curvature sequence that reflects the geometric changes of the profile is obtained.

[0040] In an optional embodiment, a multi-layer discrete wavelet transform is performed on the local curvature sequence to obtain a high-frequency detail coefficient sequence of a specified number of layers; the median absolute deviation of the high-frequency detail coefficient sequence is calculated; the coefficient points in the sequence whose absolute values exceed a preset multiple of the median absolute deviation are identified as abnormal points, and they are mapped back to the profile to determine the defect location.

[0041] The curvature signal is analyzed using a one-dimensional wavelet transform to identify sudden changes caused by defects. Wavelet transforms excel at locating transient singular points in the signal, which correspond precisely to geometric defects on the contour. The local curvature sequence obtained in the previous step is decomposed into three layers. After decomposition, the high-frequency detail coefficients in the second layer are of interest, as these coefficients are well suited to reflecting sharp changes in curvature. Suppose that the obtained high-frequency detail coefficient sequence mostly fluctuates between -0.2 and 0.2, but a coefficient value of 3.5 appears at a certain location, corresponding to a spike in the original curvature sequence. Calculating the median absolute deviation of the entire high-frequency detail coefficient sequence might yield a value of 0.15. A detection threshold is set at four times the median absolute deviation, or 0.6. The entire high-frequency detail coefficient sequence is then traversed, and the value of 3.5 is found to be significantly greater than 0.6, thus identifying it as an energy outlier. Based on the position of this outlier coefficient in the sequence, it can be reverse-mapped back to its index in the original contour coordinate sequence, accurately locating the contour defect.

[0042] The embodiment of the food production line real-time monitoring system based on image processing provided by the present invention is as follows: like Figure 2 As shown, the real-time monitoring system for a food production line based on image processing includes a processor and a memory, wherein the memory stores computer program instructions. When the computer program instructions are executed by the processor, the above-mentioned real-time monitoring method for a food production line based on image processing is implemented.

[0043] The food production line real-time monitoring system based on image processing also includes other components well known to those skilled in the art, such as a communication interface. The configuration and functions of these components are known in the art and will not be described in detail here.

[0044] In this description and the following claims, "computer readable medium" can be any tangible or physical medium that stores the program for use by or in connection with an instruction execution system, apparatus, or device. The program can be a component of the computer-readable medium, which can be a machine-readable storage medium or a machine-readable signal medium. The computer-readable medium can be, for example, but is not limited to, a tangible medium such as any tangible medium that stores the program of instructions for use by or in connection with the instruction execution system, apparatus, or device. The program can be fixed in a form of machine-readable instruction stored in any tangible medium such as a storage medium or a memory medium, for example, without limitation, a resistive random access memory (RRAM), a dynamic random access memory (DRAM), a static random access memory (SRAM), an enhanced dynamic random access memory (EDRAM), a high-bandwidth memory (HBM), a hybrid memory cube (HMC), or any other medium that stores the desired information and that can be accessed by an application, module, or both. Any such computer storage media can be part of the device or accessible or connectable thereto. Any application or module described herein can be implemented using computer readable / executable instructions stored or otherwise held by such computer readable media.

[0045] Also, in the description herein, the meaning of "a", "an", or "the" is intended to include "at least one", e.g., one, two, three, or more, unless otherwise indicated.

Claims

1. A real-time monitoring method for a food production line based on image processing, characterized in that: The steps include: S1, obtaining the original image of the food to be monitored, graying it and smoothing it using an anisotropic diffusion model in which the diffusion coefficient is inversely proportional to the gradient amplitude to obtain a preprocessed image; S2, calculate the gradient magnitude and gradient direction of each pixel in the preprocessed image; S3, for any pixel in the preprocessed image, calculate the fractal dimension and local phase consistency of the pixel window area, and based on these two eigenvalues, obtain an adjustment coefficient from the preset lookup table, and use the adjustment coefficient to adjust the preset baseline threshold to obtain the dynamic high threshold T high , using the preset low threshold proportional coefficient to adjust the dynamic high threshold T high Adjust to get dynamic low threshold T low ; S4, the gradient amplitude is higher than its corresponding dynamic high threshold T high The pixel point is determined as a strong edge point, and the gradient amplitude is between its corresponding dynamic low threshold T low With dynamic high threshold T high The pixels between are determined as candidate edge points; S5, for any candidate edge point, calculate the connection contribution by comprehensively considering its gradient direction similarity, gradient amplitude and geometric collinearity with the strong edge points in the eight neighborhoods. When the cumulative connection contribution exceeds the preset threshold, the candidate edge point is determined to be the final edge point; S6, connect all strong edge points with the final edge point to form the food edge contour, represent the food edge contour as an ordered coordinate point sequence and calculate its local curvature; by performing a one-dimensional wavelet transform on the local curvature sequence, locate the energy anomaly point in the high-frequency subband and map it back to the food edge contour, thereby determining the defect location of the food.

2. The method for real-time monitoring of a food production line based on image processing according to claim 1, characterized in that: The anisotropic diffusion model is the Perona-Malik diffusion model, and the calculation formula for its diffusion coefficient c is: , where |▽I | is a pixel ( ) is the gradient amplitude after t iterations, and K is the gradient adjustment constant.

3. The method for real-time monitoring of a food production line based on image processing according to claim 1, characterized in that: In S3, the differential box counting method is used. In a window area of ​​preset size centered on the target pixel, multi-size box coverage counting is performed on the three-dimensional surface composed of grayscale values ​​in the window area, and linear fitting is performed in a double logarithmic coordinate system. The slope of the fitting line is used as the fractal dimension of the window area.

4. The method for real-time monitoring of a food production line based on image processing according to claim 3, characterized in that: Logarithmic Gabor wavelet is used to perform multi-scale and multi-directional filtering on a window area of ​​a preset size, and the local phase consistency is obtained by calculating the energy-weighted average of the filtering responses at each scale.

5. The method for real-time monitoring of a food production line based on image processing according to claim 1, characterized in that: In S3, the Otsu method is used to calculate the baseline threshold T of the preprocessed image. base For any pixel, the adjustment coefficient μ is indexed from the preset two-dimensional lookup table according to the fractal dimension and local phase consistency of its window area; the dynamic high threshold T of the pixel is high =μ×T base , dynamic low threshold T low =λ×T high , where λ is the preset low threshold proportional coefficient, ranging from 0.4 to 0.

6.

6. The method for real-time monitoring of a food production line based on image processing according to any one of claims 1 to 5, characterized in that: In S5, for any candidate edge point p, traverse the strong edge points q in its eight neighborhoods, calculate the connection contribution C(p,q) between the candidate edge point p and the strong edge point q, and accumulate all C(p,q), where C(p,q) is calculated by the following formula: , where θ p and θ q is the gradient direction of the candidate edge point p and the strong edge point q, M q is the gradient amplitude of the strong edge point q, M max is the maximum gradient amplitude of the preprocessed image, is the angle between the edge tangent direction at the candidate edge point p and the connection vector from the candidate edge point p to the strong edge point q. The edge tangent direction is orthogonal to the gradient direction of the candidate edge point p. 、 、 The preset weights are those that sum to 1.

7. The method for real-time monitoring of a food production line based on image processing according to claim 6, characterized in that: In S6, for any point in the ordered coordinate point sequence P, the central difference method is used to calculate the approximate values ​​of its first-order derivative and second-order derivative, and further obtain the curvature value.

8. The method for real-time monitoring of a food production line based on image processing according to claim 7, characterized in that: In S6, a multi-layer discrete wavelet transform is performed on the local curvature sequence to obtain a high-frequency detail coefficient sequence of a specified number of layers; the median absolute deviation of the high-frequency detail coefficient sequence is calculated; coefficient points in the sequence whose absolute values ​​exceed a preset multiple of the median absolute deviation are identified as abnormal points, and are mapped back to the contour to determine the defect location.

9. The method for real-time monitoring of a food production line based on image processing according to claim 1, characterized in that: In S1, the original image is an image in RGB format.

10. A real-time monitoring system for food production lines based on image processing, characterized in that: The method comprises a memory and a processor, wherein the memory stores computer program instructions, and when the computer program instructions are executed by the processor, the method for real-time monitoring of a food production line based on image processing according to any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Remote sensing image information extraction method based on FCN-8s and improved Canny edge detection

    CN111985329A

  • X-ray-based intelligent food detection system

    CN116630425A

  • Seasoning packet packaging integrity detection method and system based on machine vision

    CN119068270A

  • Image edge extraction method and device, and automated driving system

    US20190392585A1

Cited By

  • Circular curve burr detection method and system based on multi-scale phase consistency and contour model, and medium

    CN122066705A