An image processing-based die-cut product size detection method
Patent Information
- Application Number
- CN202610247615.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-02
- Publication Date
- 2026-08-28
- Estimated Expiration
- 2046-03-02
AI Technical Summary
[0006]本发明在实际检测场景中通过结合基础特征与切割应力模糊度等参数对边缘进行自适应权重抑制,相较于常规使用全局统一标准进行边缘提取容易将模切冲压产生的形变、撕裂或微观毛刺误判为正常轮廓的问题,本发明能有效规避高应力区域局部严重撕裂对整体边缘特征的干扰,使得最终拟合得到的模切产品二维尺寸能够精准反映真实的物理截面状态,从而大幅提升下游组件装配的精度与良品率
(1)本发明引入了局部应力分布特征,通过将物理力学形变特征与视觉底层算法深度融合,使亚像素边缘计算引擎能够有效识别并屏蔽微观破损的引力干扰,使拟合曲线精准回归至材料未受应力破坏前的真实物理轮廓,消除了由模切工艺固有的物理缺陷引起的系统性测量盲区;
Smart Images

Figure CN122265370B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology. More specifically, this invention relates to a method for detecting the size of die-cut products based on image processing. Background Technology
[0002] Dimensional inspection is a crucial step in quality inspection and control in industrial manufacturing. Image processing-based dimensional inspection technology uses machine vision to replace manual labor. It acquires product images through cameras and uses computer vision algorithms to extract edge features, thereby calculating various dimensional indicators of the product. Due to its advantages such as non-contact operation and high efficiency, this technology has become the mainstream inspection method in current industrial automation.
[0003] In actual die-cut product manufacturing scenarios, the edge quality and dimensional accuracy of die-cut parts directly affect the assembly fit of downstream components. However, the die-cutting process differs from the rigid cutting of conventional machining; it mainly relies on the instantaneous downward pressure of the cutting tool to cut flexible or semi-rigid materials. This processing method causes the material to be subjected to complex shear stress during the stamping process, making it prone to physical deformation. Especially in areas with high stress concentration, such as corners, it is often accompanied by varying degrees of material tearing and micro-burrs.
[0004] For the aforementioned application scenarios, a major technical problem currently faced in actual production inspection is that, in factory visual inspection environments, due to the roughness and slight tilt of the die-cut cross-section, it is prone to irregular diffuse reflection and strong reflective artifacts under light source illumination. When using traditional image edge localization techniques such as the conventional grayscale centroid method for dimensional measurement, the algorithm is easily stretched by pseudo-edges caused by strong reflections, misjudging the brightest reflective points as the actual physical cuts, resulting in severe edge localization deviations. Simultaneously, conventional methods often employ globally uniform extraction standards, failing to effectively identify and shield localized tears and microscopic burrs caused by mechanical shear stress. These actual physical phenomena collectively cause the image contour extracted by the system to deviate from the actual physical boundaries of the product, ultimately leading to deviations in dimensional inspection results. This results in the misjudgment of defective products and their flow into the next process, failing to meet the tolerance requirements of downstream high-precision component assembly for die-cut parts. Summary of the Invention
[0005] To address the aforementioned technical problem of insufficient accuracy in die-cut product size detection, this invention provides a method for die-cut product size detection based on image processing, comprising: Acquire an initial grayscale image of the die-cut product; extract basic feature data from the initial grayscale image, including: basic gradient matrix, structural tensor matrix, local background grayscale variance, coarse positioning edge contour, and local geometric curvature along the coarse positioning edge contour; calculate an directional deformation compensation coefficient based on the basic feature data, the directional deformation compensation coefficient being positively correlated with the cutting stress edge ambiguity, negatively correlated with a nonlinear activation function term including a preset stress sensitivity adjustment parameter and the local geometric curvature, and negatively correlated with the hyperbolic tangent function of the ratio of structural tensor eigenvalues; the cutting stress edge ambiguity having a negative exponential relationship with the edge transition bandwidth, positively correlated with the sum of the dot product of the gradient direction and the principal gradient direction in the local neighborhood, and negatively correlated with the standard deviation of the gradient magnitude in the local neighborhood; use the directional deformation compensation coefficient as an adjustment factor to calculate the weighted grayscale centroid of the coarse positioning edge contour to obtain sub-pixel edge coordinates; fit and reconstruct all sub-pixel edge coordinates to obtain a two-dimensional contour, and calculate the size of the two-dimensional contour to obtain the detection size of the die-cut product.
[0006] In practical testing scenarios, this invention uses adaptive weighting to suppress edges by combining basic features and parameters such as cutting stress ambiguity. Compared to conventional edge extraction using a globally unified standard, which easily misjudges deformation, tearing, or micro-burrs generated by die-cutting and stamping as normal contours, this invention can effectively avoid the interference of severe local tearing in high-stress areas on the overall edge features. This allows the final fitted two-dimensional dimensions of the die-cut product to accurately reflect the true physical cross-sectional state, thereby significantly improving the accuracy and yield of downstream component assembly.
[0007] Preferably, the cutting stress edge ambiguity satisfies the expression: ; In the formula, Representing coordinates The edge blurring of the cutting stress of the pixels; Represents the natural exponential function; Indicates the broadening penalty coefficient; Representing coordinates The pixel width of the edge transition band of the pixel along the gradient direction; This indicates the half-side length of the neighboring window; Representing coordinates pixels within the neighborhood window of a pixel The gray-level gradient direction vector; Representing coordinates The unit vector of the gradient principal direction of each pixel; Represents the unit gradient reference constant; Representing coordinates The standard deviation of the grayscale gradient magnitude within the neighborhood window of a pixel; Represents the base noise constant; This represents the absolute value function.
[0008] This invention combines a specific broadening decay function with gradient direction consistency to accurately assess the degree of physical degradation caused by mechanical shearing in multiple dimensions, avoiding the system from misjudging normal process chamfers as tearing defects. This allows for the accurate identification and removal of unhealthy edge features damaged by mechanical stretching in automated production line inspection.
[0009] Preferably, the directional deformation compensation coefficient satisfies the expression: ; In the formula, Representing coordinates The directional deformation compensation coefficient of the pixel; Represents the hyperbolic tangent function; This indicates the stress sensitivity adjustment parameter; Representing coordinates The local geometric curvature of the contour containing the pixel; and Representing coordinates The first and second eigenvalues of the structure tensor matrix of the pixels, and ; This represents the first minute value.
[0010] This invention utilizes tensor feature ratios and nonlinear activation functions to intelligently identify high stress concentration areas on actual die-cut parts. While ensuring normal detection of smooth areas, it automatically and significantly reduces the abnormal feature weights of areas prone to tearing and deformation, such as sharp corners, thus ensuring the stability of dimensional detection for complex contour die-cut products.
[0011] Preferably, the sub-pixel edge coordinates satisfy the expression: ; In the formula, This represents the coordinates of the r-th subpixel edge; This represents the total number of pixels in the r-th coarsely located edge pixel sequence; This represents the r-th coarsely located edge pixel sequence. The coordinates of each pixel; This represents the r-th coarsely located edge pixel sequence. Integer pixel coordinates of each pixel; This represents the r-th coarsely located edge pixel sequence. Adaptive edge localization weights for each pixel; This represents the r-th coarsely located edge pixel sequence. The grayscale gradient magnitude of each pixel.
[0012] This invention introduces an equivalent gradient quality calculation method with adaptive positioning weight modulation, which can effectively shield the pulling effect of defect points and specular artifacts, so that the deviation coordinates caused by deformation or burrs can automatically and accurately drift back to the true physical contour position, thereby enhancing the anti-reflective interference capability of the dimensional inspection system.
[0013] Preferably, the coarsely located edge pixel sequence includes: The pixels of each coarse positioning edge contour are sorted sequentially to form the corresponding coarse positioning edge pixel sequence.
[0014] Preferably, the adaptive edge localization weights satisfy the expression: ; In the formula, Representing coordinates Adaptive edge localization weights for pixels; Indicates A logarithmic function with base 0; Representing coordinates The local grayscale contrast of the neighborhood window of a pixel; Representing coordinates The local background grayscale variance of the neighborhood window of a pixel; This represents the second smallest value.
[0015] This invention obtains confidence weights by simulating the logarithmic nonlinear response mechanism of an optical sensor to the contrast of a real physical cut. In the actual complex reflective workshop inspection environment, it can give higher weights to pixels with small deformation and high signal-to-noise ratio, thereby effectively filtering out artifact edges caused by the rough die-cut surface.
[0016] Preferably, obtaining the initial grayscale image of the die-cut product includes: Use an industrial camera to capture surface images of die-cut products; The surface image is converted to grayscale to obtain an initial grayscale image; During filming, a telecentric lens and a coaxial parallel light source were used for illumination.
[0017] Preferably, the extraction of the basic feature data includes: The gray-level gradient magnitude and gradient direction of each pixel in the initial gray-level image are calculated using the Sobel operator to form the basic gradient matrix; The structure tensor matrix is calculated based on the aforementioned basic gradient matrix, and its first and second eigenvalues are extracted. Extract the grayscale profile along the gradient direction, calculate the grayscale variance of the local background region, and obtain the local background grayscale variance.
[0018] Preferably, calculating the dimensions of the two-dimensional contour to obtain the inspection dimensions of the die-cut product includes: All extracted sub-pixel edge coordinates are reassembled in order, and geometric fitting is performed using the least squares method to reconstruct a closed two-dimensional contour. Calculate the Euclidean distance between key vertices on the two-dimensional contour as a linear dimension index; The area enclosed by the two-dimensional contour is calculated based on Green's formula and used as an overall size indicator.
[0019] Preferably, obtaining the coarse positioning edge contour and calculating its local geometric curvature includes: Edge detection is performed on the initial grayscale image to obtain coarsely located edge contours; Calculate the local geometric curvature of each pixel on the coarse positioning edge contour.
[0020] The beneficial effects of this invention are as follows: (1) This invention introduces local stress distribution characteristics. By deeply integrating physical and mechanical deformation characteristics with visual underlying algorithms, the sub-pixel edge computing engine can effectively identify and shield the gravitational interference of micro-damage, so that the fitting curve can accurately return to the real physical contour of the material before stress damage, and eliminate the systematic measurement blind zone caused by the inherent physical defects of the die-cutting process. (2) The present invention constructs a detection scheme that combines the optical logarithmic response model, which can effectively compress the dynamic range of the highlight artifact area, while amplifying the weak texture details in the dark area and stripping away the optical distortion caused by physical stress deformation, so that it can still maintain extremely high edge feature extraction stability when facing complex materials or uneven lighting environments. Attached Figure Description
[0021] Figure 1 This is a flowchart illustrating an image processing-based die-cut product size detection method according to the present invention; Figure 2 This is a schematic representation of the initial grayscale image of the die-cut product; Figure 3 This is a schematic diagram illustrating the adaptive edge positioning weight distribution of a die-cut product. Detailed Implementation
[0022] This invention discloses a method for detecting the size of die-cut products based on image processing, referring to... Figure 1 This includes steps S1-S4: S1: Obtain the initial grayscale image of the die-cut product, construct the basic gradient matrix based on the grayscale gradient magnitude and direction vector of the pixels in the initial grayscale image, and calculate the first and second eigenvalues of the extracted structure tensor matrix and the local background grayscale variance; perform edge detection on the initial grayscale image to obtain the coarse positioning edge contour, and obtain the local geometric curvature of each pixel based on the coarse positioning edge contour.
[0023] It is important to note that the edge quality of die-cut products directly affects the assembly accuracy of downstream components. Unlike the rigid cutting of conventional machining, the die-cutting process easily causes material deformation, tearing, or the formation of micro-burrs during the stamping process. If conventional edge extraction is performed directly in the initial image processing stage, these micro-defects will be treated as normal contours and retained, leading to significant deviations in subsequent dimensional measurements. Therefore, considering the unique characteristics of die-cutting, this invention first extracts from the initial grayscale image the basic gradient matrix reflecting local physical deformation, the structural tensor feature values reflecting texture direction, and the local curvature characterizing the degree of edge bending. Through multi-dimensional basic feature data, a basic reference benchmark is established that can accurately characterize the physical state of the original die-cut cross-section, providing reliable data support for subsequent calculations of edge defects and deformation degrees.
[0024] Preferably, an initial grayscale image of the die-cut product is obtained; a basic gradient matrix is constructed based on the grayscale gradient magnitude and direction vector of the pixels in the initial grayscale image; and the first and second eigenvalues of the extracted structure tensor matrix and the local background grayscale variance are calculated, including: It should be noted that during image acquisition, in order to reduce lens distortion and enhance the optical reflection stability of the die-cut cross-section, it is preferable to use a telecentric lens and a coaxial parallel light source for shooting, which can provide a hardware foundation for the reliability of grayscale images.
[0025] An initial surface image of the die-cut product is acquired using an industrial camera, and this initial surface image is then converted to grayscale to obtain an initial grayscale image. It should be noted that, as... Figure 2 This is the initial grayscale image of the die-cut product.
[0026] It should be noted that the structure tensor can effectively reflect the local texture directionality and anisotropic distribution of an image, and can identify areas of high stress concentration. To preserve structural texture while filtering out high-frequency noise, Gaussian smoothing is used when constructing the structure tensor matrix; for example, the standard deviation of the Gaussian smoothing is set to 1.2. If the standard deviation is too large, such as 2, it will cause subtle burr features to be erased; if the standard deviation is too small, such as 0.5, it will retain too much sensor random noise.
[0027] The initial grayscale image is convolved using the Sobel operator to obtain the grayscale gradient magnitude and grayscale gradient direction vector of each pixel in the initial grayscale image, and then a basic gradient matrix is constructed.
[0028] Based on the initial grayscale image, calculate the structure tensor matrix of each pixel, perform eigenvalue decomposition on the structure tensor matrix, and extract its first eigenvalue and second eigenvalue.
[0029] Extract the grayscale profile line along the gradient direction, calculate the grayscale variance of the local background region, and denot it as the local background grayscale variance.
[0030] Preferably, edge detection is performed on the initial grayscale image to obtain a coarsely located edge contour, and the local geometric curvature of each pixel is obtained based on the coarsely located edge contour, including: It should be noted that calculating curvature directly on the entire image would consume a lot of computing power. By pre-extracting coarse localization contours through edge tracking algorithms, subsequent complex calculations can be limited to the region of interest, which can improve the system's operating efficiency.
[0031] Edge detection is performed on the initial grayscale image to obtain coarsely located edge contours, and the local geometric curvature of each pixel on the coarsely located edge contours is calculated. For example, the edge detection employs an edge tracking algorithm.
[0032] Thus, the eigenvalues of the fundamental gradient matrix and the structure tensor matrix, the local background gray-level variance, and the local geometric curvature have been obtained.
[0033] S2: Combining the preset broadening penalty coefficient and the base noise constant, construct the cutting stress edge ambiguity based on the gradient statistical characteristics of the base gradient matrix and the pixel width of the edge transition zone; combining the preset stress sensitivity adjustment parameters, calculate the directional deformation compensation coefficient based on the first and second eigenvalues of the structural tensor matrix, the local geometric curvature, and the cutting stress edge ambiguity.
[0034] It should be noted that, based on the stress characteristics of the die-cutting process, the stress on straight sections is relatively uniform when the cutter presses down to cut the material, while corners or bends often experience more complex concentrated shear stress. This stress spillover causes the tearing degree at corners to be much greater than in straight sections, resulting in varying degrees of physical widening of the optical transition band at the edge of the image, and microscopic burrs disrupting the originally regular pixel gradient direction. If a globally uniform detection standard is used, the true edges of high-stress areas may be over-smoothed or misjudged. Therefore, this invention utilizes the basic gradient matrix and structural tensor features to construct cutting stress edge ambiguity and directional deformation compensation coefficients, respectively, thereby assessing the stress concentration under different geometric shapes and applying targeted weight suppression to abnormal features in high-stress areas, avoiding interference from severe local tearing on overall edge features.
[0035] Specifically, combining a preset broadening penalty coefficient and a constant basis noise, and based on the gradient statistical characteristics of the fundamental gradient matrix and the pixel width of the edge transition band, a cutting stress edge blurring is constructed, including: It should be noted that well-cut edges exhibit a narrow grayscale gradient band with highly consistent gradient directions, while damaged edges show an increased transition band width and scattered gradient directions in the local neighborhood. Therefore, by constructing an exponential decay function and combining it with gradient direction consistency, the degree of physical degradation caused by mechanical shearing can be evaluated from multiple dimensions.
[0036] The preset widening penalty coefficient is denoted as: This is used to control the system's sensitivity to the width of the edge optical transition band. For example, Set it to 1. If If the value is too large, such as 1.5, the system will penalize edge widening too harshly, and the system will misjudge normal process chamfering as a tearing defect; if If the value is too small, such as 0.5, the system will not penalize the edge widening sufficiently, and the defective edge that is actually widened due to damage will still retain a high weight.
[0037] The preset unit gradient reference constant is denoted as... It has the same physical dimensions as the standard deviation of the gray-level gradient magnitude, used to unify dimensions and provide a basis for the mathematical denominator. For example, Set it to 1.
[0038] The preset base noise constant is denoted as . This is a constant reference used to characterize ambient light interference in a system, and it also has the same physical dimensions as the standard deviation of the grayscale gradient magnitude. For example, Set it to 0.05.
[0039] A preset neighborhood window is defined, where a window centered at any pixel is denoted as the neighborhood window of that pixel. For example, the size of the neighborhood window is... .
[0040] The cutting stress edge ambiguity satisfies the expression: ; In the formula, Representing coordinates The edge blurring of the cutting stress of the pixels; Represents the natural exponential function; Indicates the broadening penalty coefficient; Representing coordinates The pixel width of the edge transition band of the pixel along the gradient direction; This indicates the half-side length of the neighboring window; Representing coordinates pixels within the neighborhood window of a pixel The gray-level gradient direction vector; Representing coordinates The unit vector of the gradient principal direction of each pixel; Represents the unit gradient reference constant; Representing coordinates The standard deviation of the grayscale gradient magnitude within the neighborhood window of a pixel; Represents the base noise constant; This represents the absolute value function.
[0041] In the formula, This indicates that the widening attenuation term constructed using a negative exponential function decreases exponentially as the die-cutting tearing becomes more severe and the transition band width increases. The gradient disorder degree with uniform dimensions suppresses the denominator. The disordered reflection generated by the spikes increases the standard deviation of the gray-level gradient amplitude, which in turn leads to a reduction in the overall feature value. Indicates directional consistency dot product. The summation represents the consistent direction, characterizing the degree of convergence of gradient directions along the main direction within a local region; under their combined effect, the cutting stress edge ambiguity can identify unhealthy edges damaged by mechanical stretching.
[0042] Preferably, in conjunction with preset stress sensitivity adjustment parameters, the directional deformation compensation coefficient is calculated based on the first and second eigenvalues of the structural tensor matrix, the local geometric curvature, and the cutting stress edge ambiguity, including: It should be noted that during die-cutting, straight edges primarily experience unidirectional extrusion, while corners exhibit complex isotropic stress overflow. The dimensional characteristics of stress distribution can be identified using the ratio of structural tensor eigenvalues. Furthermore, by suppressing the weights of high-stress-concentration regions using a nonlinear activation function, a realistic directional deformation compensation state can be obtained.
[0043] The preset stress sensitivity adjustment parameter is denoted as: This is used to control the nonlinear decay rate of the weights in high-stress regions. For example, Let it be 3. If If the value is too large, such as 5, the nonlinear function will saturate prematurely. The system will then classify tiny arc-shaped contours as high-stress sharp corners and excessively reduce their weights, leading to contour reconstruction failure. If the value is too small, such as 1, the high stress concentration area cannot be effectively identified, the feature weight is not sufficiently suppressed, and the compensation fails.
[0044] Let the first tiny value be denoted as... This is used to prevent the denominator from being zero, ensuring the safety of calculations. For example, 0.01.
[0045] The directional deformation compensation coefficient satisfies the following expression: ; In the formula, Representing coordinates The directional deformation compensation coefficient of the pixel; Represents the hyperbolic tangent function; This indicates the stress sensitivity adjustment parameter; Representing coordinates The local geometric curvature of the contour containing the pixel; and Representing coordinates The first and second eigenvalues of the structure tensor matrix of the pixels, and ; This represents the first tiny value, used to avoid a denominator of 0. For example, It has the same dimensions as the eigenvalues of the structure tensor, ensuring computational safety and dimensional consistency.
[0046] In the formula, This represents the ratio of eigenvalues, which characterizes the local isotropy of the image. This term represents the saturation suppression term excited by both local geometry and isotropy. When it is at a smooth edge of a straight line, this term tends to zero, and when it is in a region of overflowing stress at sharp corners, this term tends to 1. This represents a compensation adjustment multiplier, which enables the system to maintain the original fuzzy feature values in smooth regions and automatically and significantly reduce feature weights in high stress concentration regions.
[0047] Thus, the edge ambiguity of cutting stress and the directional deformation compensation coefficient were obtained.
[0048] S3: Based on the directional deformation compensation coefficient, local gray-level contrast and local background gray-level variance, construct an adaptive edge positioning weight by combining the logarithmic response model; use the adaptive edge positioning weight as a penalty adjustment factor to calculate the weighted gray-level centroid of the coarsely positioned edge pixel sequence to obtain the sub-pixel edge coordinates.
[0049] It should be noted that, due to the slight tilt or roughness differences in the die-cut cross-section, under the illumination of industrial camera light sources, these uneven cross-sections will cause the reflected light to exhibit irregular diffuse reflection and an asymmetrical multi-peak distribution. This means that the point with the strongest contrast in the image is not necessarily the actual physical cut. Conventional grayscale centroid methods will be stretched by these highly reflective artifacts, causing a serious shift in the calculated edge coordinates. Therefore, this invention combines local signal-to-noise ratio to re-evaluate optical contrast and constructs adaptive edge localization weights, so that pixels with significant optical features and little interference from mechanical deformation can obtain higher confidence. Introducing this weight into the grayscale centroid calculation can effectively shield the stretching effect of defect points and specular artifacts, so that the finally extracted sub-pixel edge coordinates automatically and accurately drift back to the true physical contour position.
[0050] Specifically, based on the directional deformation compensation coefficient, local gray-level contrast, and local background gray-level variance, an adaptive edge localization weight is constructed using a logarithmic response model, including: It should be noted that a true physical cut should have optical contrast that is significantly greater than the background noise, and this contrast gain should conform to a logarithmic response law. By simulating the nonlinear response mechanism of an optical sensor to contrast to obtain confidence weights, artifact edges can be effectively filtered out.
[0051] Calculate the local grayscale contrast within the neighborhood of the current pixel.
[0052] The adaptive edge localization weights satisfy the expression: ; In the formula, Representing coordinates Adaptive edge localization weights for pixels; Indicates A logarithmic function with base 0; Representing coordinates The local grayscale contrast of the neighborhood window of a pixel; Representing coordinates The local background grayscale variance of the neighborhood window of a pixel; This represents the second smallest value, used to prevent the denominator from being zero. For example, It has the same dimensions as the local background grayscale variance.
[0053] In the formula, This represents the local signal-to-noise ratio energy ratio. By canceling out the dimensions, this ratio becomes a dimensionless pure numerical value. The larger this value is, the higher the optical contrast energy of the pixel is compared to the background noise energy. This represents a logarithmic excitation model based on local signal-to-noise ratio energy, where the number 1 is a dimensionless pure digital unit, which enables pixels with small deformation and high signal-to-noise ratio to obtain higher weighted confidence, thereby enhancing the real physical cut features.
[0054] It should be noted that, as Figure 3 This is an adaptive edge positioning weight distribution map for die-cut products. The color gradient represents the adaptive edge positioning weight of each pixel. Areas with high weights correspond to the real physical edges, while areas with low weights correspond to areas of deformation, burrs, and noise interference.
[0055] Preferably, the adaptive edge localization weights are used as penalty adjustment factors to perform weighted gray-level centroid calculations on the coarsely located edge pixel sequence to obtain sub-pixel edge coordinates, including: It should be noted that the traditional gray-scale centroid method is easily affected by asymmetric gray-scale distribution, resulting in positioning offset. By embedding the adaptive edge positioning weight as a penalty adjustment factor into the gray-scale centroid calculation, the position of the sub-pixel centroid can be adjusted, forcing it to shift towards the real physical edge.
[0056] The pixels of each coarse positioning edge contour are sorted sequentially to form the corresponding coarse positioning edge pixel sequence.
[0057] Subpixel edge coordinates satisfy the expression: ; In the formula, This represents the coordinates of the r-th subpixel edge; This represents the total number of pixels in the r-th coarsely located edge pixel sequence; This represents the r-th coarsely located edge pixel sequence. The coordinates of each pixel; This represents the r-th coarsely located edge pixel sequence. Integer pixel coordinates of each pixel; This represents the r-th coarsely located edge pixel sequence. Adaptive edge localization weights for each pixel; This represents the r-th coarsely located edge pixel sequence. The grayscale gradient magnitude of each pixel.
[0058] In the formula, This represents the equivalent gradient quality after adaptive edge localization weight modulation. The larger the weight, the stronger the pulling effect of that point on the sub-pixel centroid. This represents the sum of the weighted coordinates of all pixels within the edge pixel sequence; It represents the sum of the equivalent gradient quality of all pixels in the edge pixel sequence; the formula as a whole represents the weighted gray-scale centroid calculation method. Through this calculation process, pixels with severe deformation or burrs are shielded by the system due to low weight, so that the centroid coordinates automatically drift to the real physical edge with small deformation and no burrs.
[0059] At this point, multiple sub-pixel edge coordinates have been obtained.
[0060] S4: The least squares method is used to fit the coordinates of all discrete sub-pixel edges to reconstruct a closed two-dimensional contour; the Euclidean distance and the enclosing area of the two-dimensional contour are calculated, and the linear dimension index and the overall dimension index are output to complete the size detection of the die-cut product.
[0061] It should be noted that although the acquired sub-pixel edge coordinates have eliminated positioning errors caused by microscopic burrs and stress deformation, these coordinate points still exist as discrete point sets in the image space. Furthermore, individual pixels are inevitably affected by residual random quantization noise from the camera sensor. Directly using these discrete points for distance measurement would lead to cumulative dimensional errors due to extremely small local coordinate fluctuations. Therefore, this invention reconstructs the discrete sub-pixel coordinate point set using a geometric fitting algorithm, restoring the isolated point set to a continuous two-dimensional contour that conforms to the product design expectations. This eliminates local random noise interference, enabling high-precision output of die-cut product dimensional detection results from both macroscopic linear distance and overall enclosing area dimensions, ensuring assembly consistency in subsequent processes.
[0062] Specifically, the least squares method is used to fit all discrete sub-pixel edge coordinates to reconstruct a closed two-dimensional contour, including: It should be noted that, considering the quantization error of industrial cameras, directly connecting discrete coordinate points will result in a polygonal profile. Curve fitting can further smooth the edges at the sub-pixel level, eliminating even the smallest abrupt changes caused by process burrs.
[0063] All extracted subpixel edge coordinates are reassembled in order, and the least squares method is used to fit geometric lines and arcs to the discrete subpixel coordinate point set to eliminate local small fluctuations and reconstruct a complete closed two-dimensional contour.
[0064] Preferably, the Euclidean distance and enclosed area of the two-dimensional contour are calculated, and linear and overall dimensional indices are output to complete the dimensional inspection of the die-cut product, including: It should be noted that product size inspection includes not only one-dimensional information such as line segment length, but also the overall wrapping area. Multi-dimensional verification can ensure the pass rate of tolerances of die-cut parts in downstream assembly processes.
[0065] Calculate the Euclidean distance between each key vertex of the two-dimensional contour as a linear dimension index; simultaneously, calculate the enclosed area of the two-dimensional contour based on Green's formula as an overall dimension index; combine the linear dimension index and the overall dimension index to complete the dimension inspection of the die-cut product.
[0066] While various embodiments of the invention have been shown and described in this specification, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Many modifications, alterations, and alternatives will occur to those skilled in the art without departing from the spirit and essence of the invention.
Claims
1. A method for detecting the size of die-cut products based on image processing, characterized in that, include: Obtain the initial grayscale image of the die-cut product; Extract the basic feature data of the initial grayscale image. The basic feature data includes: basic gradient matrix, structure tensor matrix, local background grayscale variance, coarse localization edge contour, and local geometric curvature along the coarse localization edge contour. The directional deformation compensation coefficient is calculated based on the basic feature data. The directional deformation compensation coefficient is positively correlated with the cutting stress edge ambiguity, negatively correlated with the nonlinear activation function term containing the preset stress sensitivity adjustment parameter and the local geometric curvature, and negatively correlated with the hyperbolic tangent function of the ratio of structural tensor eigenvalues. The cutting stress edge ambiguity has a negative exponential relationship with the edge transition bandwidth, is positively correlated with the sum of the dot product of the gradient direction and the main gradient direction in the local neighborhood, and is negatively correlated with the standard deviation of the gradient magnitude in the local neighborhood; the directional deformation compensation coefficient is used as an adjustment factor to calculate the sub-pixel edge coordinates by weighted gray-level centroid of the coarse positioning edge contour; The two-dimensional contour is obtained by fitting and reconstructing the coordinates of all sub-pixel edges, and the size of the two-dimensional contour is calculated to obtain the detection size of the die-cut product.
2. The method for detecting the size of die-cut products based on image processing according to claim 1, characterized in that, The cutting stress edge ambiguity satisfies the expression: ; In the formula, Representing coordinates The edge blurring of the cutting stress of the pixels; Represents the natural exponential function; Indicates the broadening penalty coefficient; Representing coordinates The pixel width of the edge transition band of the pixel along the gradient direction; This indicates the half-side length of the neighboring window; Representing coordinates pixels within the neighborhood window of a pixel The gray-level gradient direction vector; Representing coordinates The unit vector of the gradient principal direction of each pixel; Represents the unit gradient reference constant; Representing coordinates The standard deviation of the grayscale gradient magnitude within the neighborhood window of a pixel; Represents the base noise constant; This represents the absolute value function.
3. The method for detecting the size of die-cut products based on image processing according to claim 1, characterized in that, The directional deformation compensation coefficient satisfies the expression: ; In the formula, Representing coordinates The directional deformation compensation coefficient of the pixel; Represents the hyperbolic tangent function; This indicates the stress sensitivity adjustment parameter; Representing coordinates The local geometric curvature of the contour containing the pixel; and Representing coordinates The first and second eigenvalues of the structure tensor matrix of the pixels, and ; This represents the first minute value.
4. The method for detecting the size of die-cut products based on image processing according to claim 1, characterized in that, The sub-pixel edge coordinates satisfy the expression: ; In the formula, This represents the coordinates of the r-th subpixel edge; This represents the total number of pixels in the r-th coarsely located edge pixel sequence; This represents the r-th coarsely located edge pixel sequence. The coordinates of each pixel; This represents the r-th coarsely located edge pixel sequence. Integer pixel coordinates of each pixel; This represents the r-th coarsely located edge pixel sequence. Adaptive edge localization weights for each pixel; This represents the r-th coarsely located edge pixel sequence. The grayscale gradient magnitude of each pixel.
5. The method for detecting the size of die-cut products based on image processing according to claim 4, characterized in that, The coarsely located edge pixel sequence includes: The pixels of each coarse positioning edge contour are sorted sequentially to form the corresponding coarse positioning edge pixel sequence.
6. The method for detecting the size of die-cut products based on image processing according to claim 4, characterized in that, The adaptive edge localization weights satisfy the expression: ; In the formula, Representing coordinates Adaptive edge localization weights for pixels; Indicated by A logarithmic function with base 0; Representing coordinates The local grayscale contrast of the neighborhood window of a pixel; Representing coordinates The local background grayscale variance of the neighborhood window of a pixel; This represents the second smallest value.
7. The method for detecting the size of die-cut products based on image processing according to claim 1, characterized in that, The process of obtaining the initial grayscale image of the die-cut product includes: Use an industrial camera to capture surface images of die-cut products; The surface image is converted to grayscale to obtain an initial grayscale image; During filming, a telecentric lens and a coaxial parallel light source were used for illumination.
8. The method for detecting the size of die-cut products based on image processing according to claim 1, characterized in that, The extraction of the basic feature data includes: The gray-level gradient magnitude and gradient direction of each pixel in the initial gray-level image are calculated using the Sobel operator to form the basic gradient matrix; The structure tensor matrix is calculated based on the aforementioned basic gradient matrix, and its first and second eigenvalues are extracted. Extract the grayscale profile along the gradient direction, calculate the grayscale variance of the local background region, and obtain the local background grayscale variance.
9. The method for detecting the size of die-cut products based on image processing according to claim 1, characterized in that, The calculation of the dimensions of the two-dimensional contour to obtain the inspection dimensions of the die-cut product includes: All extracted sub-pixel edge coordinates are reassembled in order, and geometric fitting is performed using the least squares method to reconstruct a closed two-dimensional contour. Calculate the Euclidean distance between key vertices on the two-dimensional contour as a linear dimension index; The area enclosed by the two-dimensional contour is calculated based on Green's formula and used as an overall size indicator.
10. The method for detecting the size of die-cut products based on image processing according to claim 1, characterized in that, The step of obtaining the coarse positioning edge contour and calculating its local geometric curvature includes: Edge detection is performed on the initial grayscale image to obtain coarsely located edge contours; Calculate the local geometric curvature of each pixel on the coarse positioning edge contour.
Citation Information
Patent Citations
Method, system and device for determining deformation of rocket engine structure
CN118691652A
Aviation part crack detection and repair method
CN121213475A