A sensor splicing seam quality evaluation method based on geometric fitting
Patent Information
- Application Number
- CN202611167071.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-03
- Publication Date
- 2026-10-23
AI Technical Summary
[0006]针对上述现有技术中存在的抗噪性差、量化能力弱等核心问题,本发明提出了一种基于几何拟合与空间度量的图像分割线评价方法
[0104]本发明通过引入几何拟合与空间度量的先进思想,成功克服了传统检测方法在抗噪性、量化能力方面的不足,为工业相机图像分割线的检测与评价提供了一种全新的、高效的解决方案。
Smart Images

Figure CN122966596A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image sensor technology, and particularly relates to a method for evaluating the quality of sensor seams based on geometric fitting. Background Technology
[0002] In the fields of modern industrial automation and machine vision, industrial cameras, as core sensing devices, are widely used in key processes such as product quality inspection, dimensional measurement, and positioning guidance. As manufacturing processes evolve towards higher precision and consistency, the requirements for the imaging quality of industrial cameras are becoming increasingly stringent. Among these requirements, the fixed-position "segmentation lines" (or "seams," "dark lines," or "bright lines") formed in images due to sensor stitching, optical system obstruction, or mechanical structural limitations have always been a critical issue affecting image quality and the stability of subsequent image processing algorithms.
[0003] Traditional image segmentation line detection techniques primarily rely on statistical methods based on grayscale thresholds. These methods typically assume that segmentation lines exhibit significant brightness abrupt changes, binarizing the image by setting global or local grayscale thresholds to extract defect regions. However, this simple thresholding method has significant limitations in practical industrial applications. First, it is highly susceptible to image noise. The complex electromagnetic environment and lighting conditions in industrial settings often result in low image signal-to-noise ratios, making random noise points easily misidentified as defect signals, leading to a high false alarm rate. Second, traditional thresholding methods lack consideration for image structural information, failing to effectively distinguish between genuine physical seam defects and normal texture edges or lighting gradients, resulting in poor detection robustness. Furthermore, when segmentation line defects exhibit subtle grayscale gradients rather than drastic step changes, fixed-threshold methods often lack sufficient sensitivity, making early warning difficult.
[0004] Another mainstream technique is based on edge detection operators, such as the Sobel and Canny operators. These methods locate edges with drastic gray-level changes by calculating image gradients. While theoretically capable of capturing the position of segmentation lines, they essentially involve solving for the first derivative, making them sensitive to noise and prone to edge breaks or double edges. More importantly, these methods only provide positional information about the edges and struggle to quantify the severity of segmentation line defects, failing to meet the refined requirements of defect classification and quality control in industrial production.
[0005] In summary, existing technologies for detecting segmentation lines in industrial camera images generally suffer from bottlenecks such as weak noise resistance, insensitivity to minor defects, and a lack of quantitative evaluation systems. The industry urgently needs a novel detection method that can overcome image noise interference, not only accurately locate segmentation lines but also quantitatively evaluate the severity of defects from both geometric morphology and grayscale distribution dimensions. This requires algorithms with high-precision feature extraction capabilities and the ability to establish a mapping relationship between image features and physical defect attributes, thereby achieving an objective and stable assessment of image quality. Summary of the Invention
[0006] To address the core problems of poor noise resistance and weak quantization capability in the existing technologies, this invention proposes an image segmentation line evaluation method based on geometric fitting and spatial measurement. This invention elevates image grayscale information to a three-dimensional geometric space for analysis, thereby achieving highly robust detection and accurate quantification evaluation of segmentation line defects.
[0007] This invention discloses a sensor splice seam quality evaluation method based on geometric fitting, which includes the following steps:
[0008] Step 1: Take several images using the industrial camera to be inspected, calculate the mean image through multi-frame noise reduction and determine the physical segmentation line position, and generate the mean image and global segmentation line information for evaluation.
[0009] Step 2: Based on the global segmentation line information, generate the fitting plane, normal vector, and projection thickness of the regions on both sides of the segmentation line in the mean image;
[0010] Step 3: Based on the fitted plane and normal vector, generate the evaluation index for the current window by calculating the difference in projected thickness and the difference in distance between the endpoints of the intersection line;
[0011] Step 4: Based on the evaluation metrics of the current window and its neighboring windows, generate an adaptive evaluation threshold for the current window by calculating the maximum value of the neighboring metrics and combining it with the benchmark coefficient.
[0012] Step 5: Based on the evaluation metrics and adaptive threshold of the current window, generate the final quality evaluation results of all dividing lines through comparison and full-image sliding traversal.
[0013] Furthermore, step 1 includes the following steps:
[0014] Step 11: Take multiple images of the industrial camera to be tested, without a lens, and capture them at a uniform light source to form an evaluation image group.
[0015] Step 12: Calculate the mean image based on the collected evaluation image set, and use it as the input image for subsequent evaluation of the segmentation line quality;
[0016] Step 13: Based on the sensor signal used by the current camera, determine the position and direction of the dividing line introduced by its physical device, and obtain dividing line information including both vertical and horizontal directions.
[0017] Furthermore, step 2 includes the following steps:
[0018] Step 21: Perform sliding window sampling on both sides of the vertical dividing line. The number of columns in the sliding window is W, and the number of rows in the window is H. The vertical center of the window is the current dividing line column number, and the horizontal center of the window is H / 2 rows.
[0019] Step 22: Perform mean filtering on the sampled window image and use the image grayscale data contained therein as height information Z to obtain the three-dimensional point set data. , in Represents the pixel coordinates of the image. This represents the grayscale value corresponding to that pixel;
[0020] Step 23: Divide the 3D point set data into two regions, left and right, based on the center position of its window. The data located to the left of the dividing line is taken as the first point set. The data located to the left of the dividing line is used as the second point set. ;
[0021] Step 24, First point set Fit the first point set to a three-dimensional plane using the least squares method. and the normal vector of the first point set ;
[0022] Step 25, calculate the first point set The projected thickness on the plane normal vector obtained from its fitting ;
[0023] Step 26, Calculate the second point set The corresponding second point set in the three-dimensional plane and the normal vector of the second point set And calculate the projected thickness of the second point set. .
[0024] Furthermore, step 24 includes the following steps:
[0025] Step 241, calculate the centroid of the point set, that is, calculate the centroid of all points. The centroid of the point cloud is obtained by averaging the values across the three dimensions. ;
[0026] ;
[0027] ;
[0028] N is the total number of points in the point set;
[0029] Step 242, construct the centralized coordinate matrix M:
[0030] ;
[0031] Step 243: Solve for the normal vector using singular value decomposition. Obtain the eigenvector corresponding to the smallest eigenvalue through singular value decomposition as the normal vector, thus obtaining... ,in It is a left singular vector matrix. It is a singular value matrix. It is the transpose of the right singular vector matrix, which is a 3x3 matrix, and represents the normal vector of the fitted plane. That is, the row vector corresponding to the smallest singular value in matrix V;
[0032] Step 244, calculate the constant term D of the plane equation:
[0033] ;
[0034] Let D be the constant term of the three-dimensional plane of the first point set.
[0035] Furthermore, step 25 includes the following steps:
[0036] Step 251, Calculate the unit normal vector :
[0037] ;
[0038] Step 252, calculate the projection value of a single point onto the normal vector:
[0039] ;
[0040] Step 253: Iterate through the projected scalar values of all N points. Find the maximum and minimum values of the point set, and the thickness of the projection of the point set onto the normal vector. for:
[0041] ;
[0042] The maximum value of the projection among all N points. It is the minimum projection among all N points.
[0043] Furthermore, step 3 includes the following steps:
[0044] Step 31, calculate the normal vector of the first point set. Second point set normal vector The sum vector is used as the evaluation normal vector for the entire current window. ;
[0045] ;
[0046] Step 32, calculate all points in the first and second point sets, and their normal vectors. Projected thickness ;
[0047] Step 33: Calculate the value of the first evaluation index for the current window, the difference between the total point set projection thickness and the maximum value of the individual projection thicknesses of the two point sets:
[0048] ;
[0049] The thickness difference is the primary evaluation indicator.
[0050] Step 34: Calculate the intersection of the fitting planes of the first and second point sets with the vertical plane perpendicular to the XOY plane of the current segmentation line:
[0051] The expression for the intersection line of the first point, L1: ;
[0052] The expression for the intersection line of the second point, L2: ;
[0053] This represents the column coordinates of the current vertical segmentation line in the image coordinate system.
[0054] Step 35: Based on the intersection lines of the first and second points, the z values corresponding to the upper and lower boundaries of the sliding window, respectively:
[0055] The two endpoints of the intersection line L1 and :
[0056] ;
[0057] ;
[0058] The two endpoints of the intersection line L2 and :
[0059] ;
[0060] ;
[0061] The coordinates of the upper boundary row of the current sliding window. The coordinates of the lower boundary row of the current sliding window;
[0062] Step 36: Calculate the difference in distance between the endpoints of the two line segments based on the coordinates of their endpoints. and :
[0063] ;
[0064] ;
[0065] Step 37: Calculate the second evaluation index for the current window, namely the maximum value D of the difference between the endpoints of the line segment:
[0066] ;
[0067] The second evaluation indicator is the distance between the lines of intersection.
[0068] Furthermore, step 4 includes the following steps:
[0069] Step 41: Slide the current detection window to the left and right by W / 2 and distance respectively to obtain two new detection windows that are adjacent to the dividing line but do not contain the dividing line.
[0070] Step 42: Calculate the two evaluation metrics for each of the two neighboring windows, namely the thickness difference of the left window. Intersection distance Thickness difference in the right window Intersection distance ;
[0071] Step 43: Calculate the adaptive evaluation threshold for the current detection window, which is the maximum value of the detection values from both neighboring windows:
[0072] ;
[0073] ;
[0074] The detection threshold representing the thickness difference. The detection threshold representing the distance between intersection lines. and These are the reference coefficients for the two thresholds: thickness difference and intersection distance. and The maximum threshold for the configurable error prevention property; if the left and right neighboring windows exceed the image boundaries, the neighboring window on the side that does not exceed the image boundaries is used as the evaluation.
[0075] Step 44: Record the two detection indicators of the current window and compare them with the evaluation value of the current detection window and its evaluation threshold. If both are less than the threshold, it means that the detection result of the current window dividing line meets the requirements.
[0076] Step 45: Complete the detection of the current detection window. Slide the current detection window down by its height and repeat the calculation and evaluation process until the last row of the current vertical dividing line is included.
[0077] Step 46: Traverse the remaining vertical dividing lines and establish a sliding window for detection until all vertical dividing lines have been calculated and evaluated.
[0078] Step 47: Calculate and evaluate the horizontal dividing line using the same principle as the vertical dividing line.
[0079] Furthermore, step 5 includes the following steps:
[0080] Step 51: For sensors with both horizontal and vertical dividing lines, further analysis is performed on the area near the intersection of the two dividing lines: the center of the current detection window is aligned with the intersection of the dividing lines, and the evaluation window is divided into 4 point set areas with the two dividing lines as the boundary.
[0081] Step 52: Calculate the maximum value of the thickness difference corresponding to the four point set regions respectively, and use it as the first evaluation index "thickness difference" of the current detection window;
[0082] Step 53: Calculate the Z-coordinate values corresponding to the endpoints of the intersection lines of the four fitted planes with the perpendicular planes of the two dividing lines: and And stipulate:
[0083] First pair of intersections and The corresponding intersection line is from the midpoint of the top edge of the window to the center of the window;
[0084] The second pair of intersections and The corresponding intersection line is from the center of the window to the midpoint of the bottom edge of the window;
[0085] The third pair of intersections and The corresponding intersection line is from the midpoint of the left side of the window to the center of the window;
[0086] 4th pair of intersections and The corresponding intersection line is from the center of the window to the midpoint of the right side of the window;
[0087] Step 54: Detect the existence of 4 fitting planes within the detection window. The second evaluation index, "intersection distance," is the maximum value D of the segment difference of the 5 sets of points.
[0088] The segment difference values are calculated for five sets of points. The first four segments correspond to the midpoints of the four edges (top, bottom, left, and right) of the detection window. The fifth segment difference represents the center of the detection window, which has eight intersection points with four planes and two vertical planes. The maximum segment difference among these eight points needs to be evaluated.
[0089] ;
[0090] ;
[0091] ;
[0092] ;
[0093]
[0094] ;
[0095] The current overall intersection distance value of the detection window is:
[0096] ;
[0097] Step 55: The neighborhood window needs to be shifted by 4 neighborhoods of ±W / 2 and ±H / 2 respectively; repeat the calculations from steps 51 to 53 to obtain the two detection index values for the 4 neighborhood windows, namely the thickness difference of the upper left window. Intersection distance thickness difference in the lower left window Intersection distance Thickness difference in the upper right window Intersection distance Thickness difference in the lower right window Intersection distance ;
[0098] Step 56, same as step 43, calculates the adaptive evaluation threshold for the current detection window, which is the maximum value of the detection values of the four neighborhood windows:
[0099] ;
[0100] ;
[0101] Step 57: Based on the evaluation values and evaluation thresholds obtained in steps 53 and 55, determine whether the current detection window passes the detection.
[0102] Step 58: Repeat the above steps until the evaluation of all horizontal and vertical dividing line intersections is completed.
[0103] The beneficial effects achieved by this invention are:
[0104] This invention, by introducing advanced concepts of geometric fitting and spatial measurement, successfully overcomes the shortcomings of traditional detection methods in terms of noise resistance and quantization capabilities, providing a novel and efficient solution for the detection and evaluation of segmentation lines in industrial camera images.
[0105] This invention introduces three-dimensional geometric fitting and spatial metric theory into the detection and evaluation of segmentation lines in industrial camera images. It transforms the grayscale distribution problem of two-dimensional images into a three-dimensional problem of plane fitting and vector operations, opening up a new perspective for image quality evaluation.
[0106] This invention proposes a defect feature extraction mechanism based on normal vector projection. It utilizes the direction and magnitude of the plane normal vector to characterize the physical properties of grayscale changes, providing a more directional and stable feature than traditional gradient magnitude.
[0107] This invention constructs a dual evaluation index system based on geometric consistency. Through the two dimensions of "intersection distance" and "thickness difference," it achieves multi-dimensional quantitative analysis of segmentation line defects, providing clear and objective data support for quality control in industrial production.
[0108] This invention solves the problems of severe noise interference and high false alarm rate in traditional methods. Traditional thresholding and edge detection methods are extremely sensitive to the grayscale value of individual pixels, and noise points are easily misidentified as defects. By introducing a "plane fitting" mechanism, a continuous grayscale plane model is constructed by performing least-squares or robust fitting on the set of pixels within a local region of interest (ROI). This model-based fitting process naturally has the ability to smooth noise and extract trends, effectively filtering out randomly distributed salt-and-pepper noise or Gaussian noise, significantly improving the stability and reliability of the detection algorithm in complex industrial environments.
[0109] This invention solves the problem of the difficulty in quantifying and evaluating subtle defects. Existing technologies often only provide a binary judgment of "presence or absence of a defect," making it difficult to distinguish the severity of the defect. By introducing the concepts of "normal vector" and "projected thickness," the normal vectors of the fitting planes on both sides are calculated to accurately describe the "steepness" and "trend direction" of gray-level changes on both sides of the segmentation line; by calculating the projected thickness of the pixel on the normal vector, the dispersion of the gray-level distribution can be quantified. This method of describing defects from a geometric perspective transforms abstract gray-level differences into concrete physical indicators, enabling a refined classification of defect severity.
[0110] This invention solves the problem of difficulty in characterizing grayscale continuity and consistency at the dividing line. Addressing the unique physical characteristics of sensor seams, this solution designs a unique dual-evaluation index system. The first index evaluates the flatness and grayscale continuity at the seam by calculating the distance between the intersection lines of the two side planes and the perpendicular plane of the dividing line; the second index evaluates the dispersion and inconsistency at the seam by calculating the thickness difference between the two sides. These two indicators complement each other, constructing a complete evaluation system that comprehensively reflects the overall quality of defects at the dividing line. Simultaneously, by utilizing the known defect-free area of the sensor, an appropriate evaluation threshold is automatically calculated, enabling minimal manual intervention in the detection process (requiring only a relatively broad error-proofing threshold). Attached Figure Description
[0111] Figure 1 This is a schematic diagram of the sliding window detection area for the dividing line in this invention;
[0112] Figure 2 This is a schematic diagram showing the position of the window in the vertical dividing line area in this invention;
[0113] Figure 3 This is a schematic diagram of the detection window at the intersection of the dividing lines in this invention;
[0114] Figure 4 This is a schematic diagram of the field window at the intersection of the dividing lines in this invention;
[0115] Figure 5 This is an overall flowchart of the current solution in this invention;
[0116] Figure 6 This is a schematic diagram of the left and right fitting planes, the intersection line, and their endpoints in this invention;
[0117] Figure 7 This is an example of an image acquired by a sensor with poor quality in a specific embodiment of the present invention;
[0118] Figure 8 This is an example of an image acquisition sensor with superior quality provided by the present invention. Detailed Implementation
[0119] The present invention will be further described below with reference to specific embodiments, and the advantages and features of the present invention will become clearer as a result. However, these embodiments are merely exemplary and do not constitute any limitation on the scope of the present invention. Those skilled in the art should understand that modifications or substitutions can be made to the details and form of the technical solutions of the present invention without departing from the spirit and scope of the present invention, but all such modifications and substitutions fall within the protection scope of the present invention.
[0120] like Figure 1As shown, this invention provides a sensor splicing seam quality evaluation method based on geometric fitting, and the specific implementation steps are as follows:
[0121] Step 1: Acquire several captured images, preprocess them, and perform vertical and horizontal segmentation;
[0122] Step 11: With the industrial camera to be tested in a lensless scene, point it at a uniform light source and take several images (generally recommended to be 4 to 32 images).
[0123] Step 12: Based on the acquired evaluation image group, perform multi-frame noise reduction (i.e., calculate the mean image) as the input image for subsequent evaluation of the segmentation line quality. The mean image is calculated by summing the pixel values at corresponding positions in each acquired image and then dividing by the number of images.
[0124] The present invention uses multi-frame noise reduction to reduce (eliminate) random noise in the time domain of the sensor and reduce interference with subsequent evaluation.
[0125] Step 13: Based on the sensor signals used by the current camera, determine the position and orientation of the dividing lines introduced by its physical components. Obtain dividing line information including both vertical and horizontal directions (there may be multiple dividing lines and dividing lines in multiple directions).
[0126] In one specific embodiment: the vertical dividing line Hs: {400, 5000, 9600};
[0127] Horizontal dividing line Vs: {4000};
[0128] This embodiment indicates that the sensor has 3 vertical dividing lines (located in columns 400, 5000, and 9600), and 1 horizontal dividing line (located in row 4000), as well as 3 intersection points of dividing lines (400, 4000), (5000, 4000), and (9600, 4000).
[0129] Step 2: Based on the global segmentation line information, generate the fitting plane, normal vector, and projection thickness of the regions on both sides of the segmentation line in the mean image;
[0130] Step 21: Perform sliding window sampling on both sides of the vertical dividing line. The number of columns in the sliding window is W, and the number of rows in the window is H. The vertical center of the window is the current dividing line column number, and the horizontal center of the window is H / 2 rows. (Typical window sizes are W=200, H=200), see instructions. Figure 1 .
[0131] Step 22: Perform mean filtering on the image in the sampling window (the filter kernel should not be too large; 3*3 to 5*5 is generally recommended), and use the image grayscale data contained therein as the height information Z to obtain the three-dimensional point set data. That is, a three-dimensional point set can be represented as , in Represents the pixel coordinates of the image. This represents the grayscale value corresponding to that pixel.
[0132] Step 23: Divide the 3D point set data from Step 22 into two regions, left and right, based on the center position of the window. The data located to the left of the dividing line is designated as point set 1. The data located to the left of the dividing line are denoted as point set 2. .
[0133] Step 24: Based on point set 1, fit its three-dimensional plane equation using the least squares method. and its normal vector The calculation method is as follows:
[0134] Step 241: Calculate the centroid (mean point) of the point set, that is, calculate the centroid of all points. The centroid of the point cloud is obtained by averaging the values across the three dimensions. :
[0135]
[0136]
[0137] Step 242, construct a centralized coordinate matrix by subtracting the centroid coordinates from the coordinates of each point, and constructing an N*3 centralized matrix M:
[0138]
[0139] Step 243: Solve for the normal vector using Singular Value Decomposition (SVD). Obtain the eigenvector corresponding to the smallest eigenvalue through Singular Value Decomposition as the normal vector, thus obtaining... ,in It is a 3x3 matrix; the normal vector of the fitted plane. This is the row vector corresponding to the smallest singular value in matrix V (i.e., the last row of V).
[0140] The left singular vector matrix U is an m×m orthogonal matrix whose column vectors are the eigenvectors of AAT, representing the orthogonal basis of the output space.
[0141] Singular value matrix Σ: an m×n diagonal matrix (if not a square matrix, all other elements are 0), with diagonal elements being non-negative singular values. Arranged from largest to smallest, these represent the scaling intensity in each direction;
[0142] transpose of a right singular vector matrix V is an n×n orthogonal matrix whose column vectors are the eigenvectors (right singular vectors) of ATA. This represents an orthogonal transformation of the input space.
[0143] In mathematical terms, this is equivalent to finding the eigenvector corresponding to the smallest eigenvalue of the covariance matrix. The SVD method is more stable in numerical computation and more suitable for specific implementation.
[0144] Step 244, calculate the constant term D of the plane equation:
[0145]
[0146] Step 25: Calculate the projection distance of point set 1 onto the normal vector of the fitted plane, i.e., the projection thickness. ;
[0147] Step 251, calculate the unit normal vector, that is, for Normalization is performed to obtain the unit normal vector. :
[0148]
[0149] Step 252: Calculate the projection value of a single point onto the normal vector.
[0150]
[0151] Step 253: Calculate the projection thickness (projection distance difference) by iterating through the projection scalar values of all N points. Find the maximum and minimum values of the point set, and the thickness of the projection of the point set onto the normal vector. for:
[0152]
[0153] Step 26, similarly, based on steps 24 and 25, calculate the fitting plane corresponding to point set 2 on the right side of the window. and its normal vector And calculate the projection thickness of its point set onto the normal vector. ;
[0154] Step 3: Based on the fitted plane and normal vector, generate the evaluation index for the current window by calculating the difference in projected thickness and the difference in distance between the endpoints of the intersection line;
[0155] Step 31, Calculate and The sum vector is used as the evaluation normal vector for the entire current window. ;
[0156]
[0157] Step 32, similar to step 25, calculates all points in point sets 1 and 2, along with the normal vector. Projected thickness .
[0158] Step 33: Calculate the value of the first evaluation index "thickness difference" for the current window, which is the difference between the total projection thickness of the point set and the maximum value of the individual projection thickness of the two point sets.
[0159]
[0160] Step 34: Calculate the intersection of the fitting planes of point set 1 and point set 2 with the vertical plane perpendicular to the XOY plane of the current dividing line.
[0161] The fitted plane representation F1 of point set 1: ,
[0162] The fitted plane representation F2 of point set 2: ,
[0163] The perpendicular plane Fv containing the secant:
[0164] Solve for the equation of the intersection line, Substituting these equations into the expressions for F1 and F2 respectively, we obtain two linear equations.
[0165] K represents the column coordinates of the current vertical dividing line in the image coordinate system. For example, if the dividing line is between the 100th and 101st pixels in the image, then K is 100, or more precisely, 100.5.
[0166] The expression L1 for intersection line 1:
[0167] The expression for intersection line 2, L2:
[0168] Step 35: Based on the two intersection lines calculated in Step 34, the z values are the upper and lower boundaries of the sliding window, respectively. That is, assuming the range of values for the currently calculated local ROI along the y-axis is... (For example, when the number of rows in the sliding window is H=200, the first window corresponds to...) At this point, the Z-value of the intersection line at the endpoint is:
[0169] The two endpoints of the intersection line L1 and ,See Figure 6 :
[0170]
[0171]
[0172] The two endpoints of the intersection line L2 and :
[0173]
[0174]
[0175] Step 36: Calculate the difference in distance between the endpoints of the two line segments based on the coordinates of their endpoints. and :
[0176]
[0177]
[0178] Step 37: Calculate the value of the second evaluation index "intersection distance" in the current window, which is the maximum value D of the difference between the endpoints of the line segments:
[0179]
[0180] Step 4: Based on the evaluation metrics of the current window and its neighboring windows, generate an adaptive evaluation threshold for the current window by calculating the maximum value of the neighboring metrics and combining it with the benchmark coefficient.
[0181] Step 41: Extract the neighborhood region of the current segmentation line detection window. This involves sliding the current detection window left and right by W / 2 and a distance, respectively, to obtain two new detection windows that are adjacent to the segmentation line but do not contain the segmentation line itself. See... Figure 2 .
[0182] Step 42, similar to steps 22 to 37, calculates the two evaluation metrics for each of the two neighboring windows, namely the thickness difference of the left window. Intersection distance Thickness difference in the right window Intersection distance .
[0183] It is important to note that the descriptions here are equivalent, meaning that the left-side point set of the left neighbor window and the right-side point set of the current detection window are the same region. Therefore, we can calculate only the left-side part of the left neighbor window and combine it with the data of the left-side part of the current detection window to complete the current calculation (saving some computation). Similarly, the computation of the right neighbor window can be reduced by half.
[0184] Step 43: Calculate the adaptive evaluation threshold for the current detection window, which is the maximum value of the detection values from both neighboring windows.
[0185]
[0186]
[0187] in, and These are the baseline coefficients for the two thresholds of thickness difference and intersection distance, respectively. The range is greater than or equal to 1, depending on the factory inspection requirements. The smaller the value, the closer the gray value continuity at the dividing line is to the gray value continuity of its neighboring undivided area, that is, the stricter the inspection requirements. The recommended value in typical scenarios is (between 1.3 and 1.8).
[0188] and The maximum threshold for configurable error prevention properties, (where It can generally be set to 64. Set to 40);
[0189] To prevent abnormal defects (dust spots, lens bright spots, etc.) in the neighboring images on both sides of some image segmentation lines from interfering with the adaptive threshold calculation and causing an abnormally large threshold to be calculated, a maximum value limit is added to it.
[0190] Specifically, if the left and right neighboring windows exceed the image boundaries, the neighboring window on the side that does not exceed the image boundaries is used for evaluation. (Generally, it is unlikely that both windows will exceed the boundaries; if this happens, it indicates that the sliding window size is too large for the image to be detected, and the window size should be appropriately reduced.)
[0191] Step 44: Record the two detection metrics for the current window and compare them with the evaluation value and its evaluation threshold for the current detection window. If both are less than the threshold, it means that the detection result of the current window segmentation line meets the requirements.
[0192]
[0193] Step 45: Complete the detection of the current detection window. Slide the current detection window down by its height and repeat the calculation and evaluation process from Step 21 to Step 43 until the last row of the current vertical dividing line is included.
[0194] Step 46, same as above, traverse the remaining vertical dividing lines to establish a sliding window for detection, until all vertical dividing lines have been calculated and evaluated.
[0195] Step 47: For the horizontal dividing line, the principle is the same as that for the vertical dividing line described above. That is, the detection window slides horizontally along the horizontal dividing line, and the detection window is divided into two point sets, upper and lower, with the dividing line as the center. The vertical plane where the dividing line is located... Adjusted to The range of values for the previously calculated local ROI in the x-axis direction is: And the direction of the calculation of key steps, such as the neighborhood window obtained by translating up and down with a step size of H / 2, is modified synchronously.
[0196] Alternatively, by transposing the image and swapping its rows and columns, the logic of the vertical dividing lines described above can be fully reused to process the horizontal dividing lines.
[0197] Step 5: Based on the evaluation metrics and adaptive threshold of the current window, generate the final quality evaluation results of all dividing lines through comparison and full-image sliding traversal.
[0198] Step 51, specifically, for sensors with both horizontal and vertical dividing lines, further analysis can be performed on the area near the intersection of the two dividing lines, that is, aligning the center of the current detection window with the intersection of the dividing lines. Using the two dividing lines as boundaries, the evaluation window is divided into four point sets (upper left, upper right, lower left, lower right), see... Figure 3 .
[0199] Step 52, the same as steps 22 to 33, calculates the maximum value of the thickness difference corresponding to the four point set regions, which is used as the first evaluation index "thickness difference" of the current detection window.
[0200] Step 53, similar to steps 34 and 35, calculates the Z-coordinate values corresponding to the endpoints of the intersection lines of the four fitted planes with the perpendicular planes of the two dividing lines: and The following is stipulated:
[0201] First pair of intersections and The corresponding intersection line is from the midpoint of the top edge of the window to the center of the window;
[0202] The second pair of intersections and The corresponding intersection line is from the center of the window to the midpoint of the bottom edge of the window;
[0203] The third pair of intersections and The corresponding intersection line is from the midpoint of the left side of the window to the center of the window;
[0204] 4th pair of intersections and The corresponding intersection line is from the center of the window to the midpoint of the right side of the window;
[0205] Step 54: Since there are 4 fitting planes within the detection window at this time, the second evaluation index "intersection distance" is the maximum value D of the segment difference of the 5 sets of points.
[0206] The segment difference values are calculated for five sets of points. The first four segments correspond to the midpoints of the four edges (top, bottom, left, and right) of the detection window. The fifth segment difference represents the center of the detection window, which has eight intersection points with four planes and two vertical planes. The maximum segment difference among these eight points needs to be evaluated.
[0207]
[0208]
[0209]
[0210]
[0211]
[0212]
[0213] The current overall intersection distance value of the detection window is:
[0214]
[0215] Step 55: In this case, the neighborhood window also needs to be shifted by 4 neighborhoods of ±W / 2 and ±H / 2 respectively. Repeat the calculations from steps 51 to 53 to obtain the two detection index values for the 4 neighborhood windows, namely the thickness difference of the upper left window. Intersection distance thickness difference in the lower left window Intersection distance Thickness difference in the upper right window Intersection distance Thickness difference in the lower right window Intersection distance .
[0216] Step 56, same as step 43, calculates the adaptive evaluation threshold for the current detection window, which is the maximum value of the detection values of the four neighborhood windows:
[0217]
[0218]
[0219] Step 57: Based on the evaluation values and evaluation thresholds obtained in steps 53 and 56, determine whether the current detection window passes the detection.
[0220] Step 58, as above, processes the evaluation of the intersection positions of all the horizontal and vertical dividing lines mentioned above.
[0221] To facilitate understanding of this solution, the following two specific embodiments are provided to demonstrate the effectiveness of the sensor splice seam quality evaluation method provided by this invention.
[0222] Example 1:
[0223] Image to be evaluated, such as Figure 7 As shown, the sensor belongs to the poor batch. The sensor structure under test has 4 vertical dividing lines Hs: {352,5632,10912,16192}; no horizontal dividing line Vs: {}; the sensor resolution is 16500*9200.
[0224] Sliding window sampling is performed on both sides of the vertical dividing line. The number of columns in the sliding window is W=200, and the number of rows in the window is H=200. The vertical center of the window is the current column number of the dividing line, and the horizontal center of the window is the 100th row (starting from 0). That is, each dividing line is divided into 9200 / 200 = 46 windows.
[0225] The image in the sampling window is subjected to a 5x5 mean filter.
[0226] Taking the detection data of the first dividing line as an example, the table below shows two evaluation values for windows 0-45 and their neighborhood windows:
[0227] Table 1. Detection values of each window at the first dividing line.
[0228]
[0229] Calculate the maximum value for each of the above windows:
[0230] Thickness difference: dividing line 12.08123, left neighbor 6.147689, right neighbor 3.81139;
[0231] Intersection distance: dividing line 12.40954, left neighbor 3.406009, right neighbor 4.52718;
[0232] Calculate the threshold values for two evaluation metrics, including the baseline coefficients for the thickness difference and intersection distance thresholds. and Maximum threshold and Calculated 11.06584, 6.79077:
[0233]
[0234]
[0235] The results were evaluated, and the thickness difference (12.08123) was greater than 11.06584, and the intersection distance (12.40954) was greater than 6.79077. That is, both evaluation values were greater than the corresponding thresholds, and the current segmentation line detection was unqualified.
[0236] Similarly, the results for the remaining four dividing lines are as follows:
[0237] Second dividing line: Thickness difference 67.45244 > 7.961294, intersection distance 69.80683 > 8.0, unqualified;
[0238] Third dividing line: Thickness difference 66.26909 > 10.3661, intersection distance 19.78123 > 8.0, unqualified;
[0239] 4th dividing line: thickness difference 50.6166 > 14.2742, intersection distance 51.7383 > 8.00, unqualified;
[0240] Example 2:
[0241] Image to be evaluated, such as Figure 8 As shown, the sensor belongs to a better batch. The sensor structure under test has 4 vertical dividing lines Hs: {352,5632,10912,16192}; no horizontal dividing line Vs: {}; and the sensor resolution is 16500*9200.
[0242] Sliding window sampling is performed on both sides of the vertical dividing line. The number of columns in the sliding window is W=200, and the number of rows in the window is H=200. The vertical center of the window is the current column number of the dividing line, and the horizontal center of the window is the 100th row (starting from 0). That is, each dividing line is divided into 9200 / 200 = 46 windows.
[0243] The image in the sampling window is subjected to a 5x5 mean filter.
[0244] Taking the detection data of the first dividing line as an example, the table below shows two evaluation values for windows 0-45 and their neighborhood windows:
[0245] Table 2 Detection values of each window at the first dividing line.
[0246]
[0247] Calculate the maximum value for each of the above windows:
[0248] Thickness difference: dividing line 3.26433, left neighbor 2.969914, right neighbor 3.120313;
[0249] Intersection distance: dividing line 6.301717, left neighbor 3.958579, right neighbor 2.943288;
[0250] Calculate the threshold values for two evaluation metrics, including the baseline coefficients for the thickness difference and intersection distance thresholds. and Maximum threshold and Calculated 5.616563, 7.125442:
[0251]
[0252]
[0253] The results were evaluated, and the thickness difference was 3.26433 < 5.616563, and the intersection distance was 6.301717 < 7.125442. That is, both evaluation values were less than the corresponding thresholds, and the current segmentation line detection was qualified.
[0254] Similarly, the results for the remaining four dividing lines are as follows:
[0255] Second dividing line: Thickness difference 5.699091 < 9.483957, intersection distance 7.5416 < 8.0, qualified;
[0256] Third dividing line: Thickness difference 8.358302 < 9.46213, intersection distance 6.75321 < 7.33698, qualified;
[0257] 4th dividing line: thickness difference 6.131914 < 8.636931, intersection distance 5.530613 < 7.494754, qualified;
[0258] In summary, this invention achieves multi-dimensional quantitative analysis of segmentation line defects through two dimensions of indicators: "intersection distance" and "thickness difference," providing clear and objective data support for quality control in industrial production.
[0259] The above are merely preferred embodiments of the present invention and do not constitute any limitation on the scope of protection of the present invention; all technical solutions formed by equivalent transformations or equivalent substitutions fall within the scope of protection of the present invention; the parts of the present invention not described in detail are well-known technologies to those skilled in the art.
Claims
1. A method for evaluating the quality of sensor splice seams based on geometric fitting, characterized in that, The sensor-based seam quality evaluation method based on geometry fitting includes the following steps: Step 1: Take several images using the industrial camera to be inspected, calculate the mean image through multi-frame noise reduction and determine the physical segmentation line position, and generate the mean image and global segmentation line information for evaluation. Step 2: Based on the global segmentation line information, generate the fitting plane, normal vector, and projection thickness of the regions on both sides of the segmentation line in the mean image; Step 3: Based on the fitted plane and normal vector, generate the evaluation index for the current window by calculating the difference in projected thickness and the difference in distance between the endpoints of the intersection line; Step 4: Based on the evaluation metrics of the current window and its neighboring windows, generate an adaptive evaluation threshold for the current window by calculating the maximum value of the neighboring metrics and combining it with the benchmark coefficient. Step 5: Based on the evaluation metrics and adaptive threshold of the current window, generate the final quality evaluation results of all dividing lines through comparison and full-image sliding traversal.
2. The sensor splice seam quality evaluation method based on geometric fitting according to claim 1, characterized in that, Step 1 includes the following steps: Step 11: Take multiple images of the industrial camera to be tested, without a lens, and capture them at a uniform light source to form an evaluation image group. Step 12: Calculate the mean image based on the collected evaluation image set, and use it as the input image for subsequent evaluation of the segmentation line quality; Step 13: Based on the sensor signal used by the current camera, determine the position and direction of the dividing line introduced by its physical device, and obtain dividing line information including both vertical and horizontal directions.
3. The sensor splice seam quality evaluation method based on geometric fitting according to claim 1, characterized in that, Step 2 includes the following steps: Step 21: Perform sliding window sampling on both sides of the vertical dividing line. The number of columns in the sliding window is W, and the number of rows in the window is H. The vertical center of the window is the current dividing line column number, and the horizontal center of the window is H / 2 rows. Step 22: Perform mean filtering on the sampled window image and use the image grayscale data contained therein as height information Z to obtain the three-dimensional point set data. , in Represents the pixel coordinates of the image. This represents the grayscale value corresponding to that pixel; Step 23: Divide the 3D point set data into two regions, left and right, based on the center position of its window. The data located to the left of the dividing line is taken as the first point set. The data located to the left of the dividing line is used as the second point set. ; Step 24, First point set Fit the first point set to a three-dimensional plane using the least squares method. and the normal vector of the first point set ; Step 25, calculate the first point set Projected thickness on the plane normal vector obtained from its fitting ; Step 26, calculate the second point set The corresponding second point set in the three-dimensional plane and the normal vector of the second point set And calculate the projected thickness of the second point set. .
4. The sensor splice seam quality evaluation method based on geometric fitting according to claim 3, characterized in that, Step 24 includes the following steps: Step 241, calculate the centroid of the point set, that is, calculate the centroid of all points. The centroid of the point cloud is obtained by averaging the values across the three dimensions. ; ; ; N is the total number of points in the point set; Step 242, construct the centralized coordinate matrix M: ; Step 243: Solve for the normal vector using singular value decomposition. Obtain the eigenvector corresponding to the smallest eigenvalue through singular value decomposition as the normal vector, thus obtaining... ,in It is a left singular vector matrix. It is a singular value matrix. It is the transpose of the right singular vector matrix, which is a 3x3 matrix, and represents the normal vector of the fitted plane. That is, the row vector corresponding to the smallest singular value in matrix V; Step 244, calculate the constant term D of the plane equation: ; Let D be the constant term of the three-dimensional plane of the first point set.
5. The sensor splice seam quality evaluation method based on geometric fitting according to claim 3, characterized in that, Step 25 includes the following steps: Step 251, Calculate the unit normal vector : ; Step 252, calculate the projection value of a single point onto the normal vector: ; Step 253: Iterate through the projected scalar values of all N points. Find the maximum and minimum values of the point set, and the thickness of the projection of the point set onto the normal vector. for: ; The maximum value of the projection among all N points. It is the minimum projection among all N points.
6. The sensor splice seam quality evaluation method based on geometric fitting according to claim 1, characterized in that, Step 3 includes the following steps: Step 31, calculate the normal vector of the first point set. Second point set normal vector The sum vector is used as the evaluation normal vector for the entire current window. ; ; Step 32, calculate all points in the first and second point sets, and their normal vectors. Projected thickness ; Step 33: Calculate the value of the first evaluation index for the current window, the difference between the total point set projection thickness and the maximum value of the individual projection thicknesses of the two point sets: ; The thickness difference is the primary evaluation indicator. Step 34: Calculate the intersection of the fitting planes of the first and second point sets with the vertical plane perpendicular to the XOY plane of the current segmentation line: The expression for the intersection line of the first point, L1: ; The expression for the intersection line of the second point, L2: ; This represents the column coordinates of the current vertical segmentation line in the image coordinate system. Step 35: Based on the intersection lines of the first and second points, the z values corresponding to the upper and lower boundaries of the sliding window, respectively: The two endpoints of the intersection line L1 and : ; ; The two endpoints of the intersection line L2 and : ; ; The coordinates of the upper boundary row of the current sliding window. The coordinates of the lower boundary row of the current sliding window; Step 36: Calculate the difference in distance between the endpoints of the two line segments based on the coordinates of their endpoints. and : ; ; Step 37: Calculate the second evaluation index for the current window, namely the maximum value D of the difference between the endpoints of the line segment: ; The second evaluation indicator is the distance between the lines of intersection.
7. The sensor splice seam quality evaluation method based on geometric fitting according to claim 1, characterized in that, Step 4 includes the following steps: Step 41: Slide the current detection window to the left and right by W / 2 and distance respectively to obtain two new detection windows that are adjacent to the dividing line but do not contain the dividing line. Step 42: Calculate the two evaluation metrics for each of the two neighboring windows, namely the thickness difference of the left window. Intersection distance Thickness difference in the right window Intersection distance ; Step 43: Calculate the adaptive evaluation threshold for the current detection window, which is the maximum value of the detection values from both neighboring windows: ; ; The detection threshold representing the thickness difference. The detection threshold representing the distance between intersection lines. and These are the reference coefficients for the two thresholds: thickness difference and intersection distance. and The maximum threshold for the configurable error prevention property; if the left and right neighboring windows exceed the image boundaries, the neighboring window on the side that does not exceed the image boundaries is used as the evaluation. Step 44: Record the two detection indicators of the current window and compare them with the evaluation value of the current detection window and its evaluation threshold. If both are less than the threshold, it means that the detection result of the current window dividing line meets the requirements. Step 45: Complete the detection of the current detection window. Slide the current detection window down by its height and repeat the calculation and evaluation process until the last row of the current vertical dividing line is included. Step 46: Traverse the remaining vertical dividing lines and establish a sliding window for detection until all vertical dividing lines have been calculated and evaluated. Step 47: Calculate and evaluate the horizontal dividing line using the same principle as the vertical dividing line.
8. The sensor splice seam quality evaluation method based on geometric fitting according to claim 1, characterized in that, Step 5 includes the following steps: Step 51: For sensors with both horizontal and vertical dividing lines, further analysis is performed on the area near the intersection of the two dividing lines: the center of the current detection window is aligned with the intersection of the dividing lines, and the evaluation window is divided into 4 point set areas with the two dividing lines as the boundary. Step 52: Calculate the maximum value of the thickness difference corresponding to the four point set regions respectively, and use it as the first evaluation index "thickness difference" of the current detection window; Step 53: Calculate the Z-coordinate values corresponding to the endpoints of the intersection lines of the four fitted planes with the perpendicular planes of the two dividing lines: and And stipulate: First pair of intersections and The corresponding intersection line is from the midpoint of the top edge of the window to the center of the window; The second pair of intersections and The corresponding intersection line is from the center of the window to the midpoint of the bottom edge of the window; The third pair of intersections and The corresponding intersection line is from the midpoint of the left side of the window to the center of the window; 4th pair of intersections and The corresponding intersection line is from the center of the window to the midpoint of the right side of the window; Step 54: Detect the existence of 4 fitting planes within the detection window. The second evaluation index, "intersection distance," is the maximum value D of the segment difference of the 5 sets of points. The segment difference values are calculated for five sets of points. The first four segments correspond to the midpoints of the four edges (top, bottom, left, and right) of the detection window. The fifth segment difference represents the center of the detection window, which has eight intersection points with four planes and two vertical planes. The maximum segment difference among these eight points needs to be evaluated. ; ; ; ; ; The current overall intersection distance value of the detection window is: ; Step 55: The neighborhood window needs to be shifted by 4 neighborhoods of ±W / 2 and ±H / 2 respectively; repeat the calculations from steps 51 to 53 to obtain the two detection index values for the 4 neighborhood windows, namely the thickness difference of the upper left window. Intersection distance thickness difference in the lower left window Intersection distance Thickness difference in the upper right window Intersection distance Thickness difference in the lower right window Intersection distance ; Step 56, same as step 43, calculates the adaptive evaluation threshold for the current detection window, which is the maximum value of the detection values of the four neighborhood windows: ; ; Step 57: Based on the evaluation values and evaluation thresholds obtained in steps 53 and 55, determine whether the current detection window passes the detection. Step 58: Repeat the above steps until the evaluation of all horizontal and vertical dividing line intersections is completed.