Visual geometry measurement method, apparatus, device, medium, and program product
By introducing the uncertainty information of sub-pixel edge points and a robust estimation algorithm into visual geometric measurement, the problem of difficulty in balancing accuracy and robustness in traditional methods is solved, and stable and accurate geometric parameter measurement is achieved.
Patent Information
- Application Number
- CN202610447202.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-07
- Publication Date
- 2026-08-25
AI Technical Summary
Existing visual geometry measurement methods struggle to balance high precision and robustness, especially in complex industrial environments. Traditional methods are sensitive to noise and outliers, have poor adaptability, and cannot achieve stable and accurate geometric parameter measurements.
By acquiring the image of the target to be tested, extracting edge points with sub-pixel precision and estimating their positional uncertainty information, fitting a mathematical model of geometric features based on a robust estimation algorithm, suppressing the influence of noise and outliers, and calculating relevant measurement parameters.
It achieves high-precision and robust geometric parameter measurement in complex industrial scenarios, reduces the dependence on manual parameter adjustment, and improves the method's adaptability and the reliability of measurement results.
Smart Images

Figure CN122636716A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of industrial measurement technology, and in particular to a visual geometric measurement method, apparatus, equipment, medium, and program product. Background Technology
[0002] In the fields of industrial automation, precision manufacturing, and quality inspection, machine vision-based non-contact geometric measurement technology has become a key tool. One of its core tasks is to accurately locate and model geometric features in images, such as the spacing between lines, the distance between circles, flatness, and parallelism, for industrial inspection tasks, and then calculate key parameters such as dimensions, distances, angles, and positional accuracy. Existing visual geometric measurement methods, especially those for measuring features such as lines and parallel lines, can be summarized into the following core technical approaches:
[0003] The first category is based on edge extraction and Hough Transform. This method first performs edge detection on the image to obtain a set of edge points, and then uses Hough Transform to detect straight lines in the parameter space. Its advantage is that it has a certain tolerance for edge discontinuities. However, its disadvantages are very significant: the measurement accuracy is limited by the quantization interval of the parameter space, and the computational cost is huge for high-precision requirements; more importantly, it is a global statistical method, and its result is an average straight line, which cannot reflect the local details of geometric features. When there is local deformation of features or complex background interference, both accuracy and robustness will drop sharply.
[0004] The second category is based on subpixel edge localization and deterministic model fitting. This method improves edge point localization accuracy through subpixel localization techniques (such as gray-scale moment method and Zernike moment method), and then uses deterministic algorithms such as least squares method to globally fit the edge points, obtaining a mathematical model of geometric features. This method improves accuracy compared to Hough transform. However, its core drawback is its over-reliance on the quality of edge points. Global fitting algorithms such as least squares method are extremely sensitive to outliers. Noise, local defects, background interference, or incomplete edges in the image can all generate incorrect edge points. These outliers significantly distort the fitting results, leading to large deviations in the final measurement parameters and poor robustness.
[0005] The third category is based on region matching and feature centerline extraction. This method attempts to locate the entire feature region through template matching or image segmentation, and then obtains the centerline through algorithms such as skeleton extraction. This method avoids the influence of edge incompleteness to some extent, but its accuracy heavily depends on the accuracy of template matching, the quality of image segmentation, and the stability of the skeleton extraction algorithm. It is also less adaptable to image rotation, scale changes, deformation, and neighboring interference.
[0006] In particular, the limitations of the existing technologies are especially pronounced in the typical application scenario of online spacing visual measurement. Existing methods generally suffer from a trade-off between accuracy and robustness: high-precision methods are sensitive to noise and outliers, while more adaptable methods have limited accuracy. Therefore, there is an urgent need in this field for a novel visual geometry measurement method that can achieve high-precision and highly robust geometric parameter measurement in complex and realistic industrial environments.
[0007] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0008] This disclosure provides a visual geometry measurement method, apparatus, device, medium, and program product that at least to some extent overcomes the problem that related visual geometry measurement technologies cannot simultaneously achieve high precision and high robustness.
[0009] Other features and advantages of this disclosure will become apparent from the following detailed description, or may be learned in part from practice of this disclosure.
[0010] According to one aspect of this disclosure, a visual geometric measurement method is provided, comprising: acquiring a target image to be measured, the target image containing at least one geometric feature to be measured; processing the target image to be measured, extracting edge points with sub-pixel precision, and estimating the positional uncertainty information of each edge point; determining the weight of each edge point in fitting a geometric model based on the positional uncertainty information of each edge point, and fitting a mathematical model of the geometric feature using a robust estimation algorithm, wherein the robust estimation algorithm is used to suppress the influence of edge points with low weights on the fitting result; and calculating measurement parameters related to the geometric feature based on the fitted mathematical model of the geometric feature.
[0011] In some embodiments, the geometric features contained in the target image to be tested are a first straight line feature and a second straight line feature, and the mathematical model of the geometric features is a straight line model; determining the weight of each edge point in the fitting of the geometric model based on the positional uncertainty information of each edge point includes: constructing an objective function, wherein the data terms of the objective function are weighted according to the fitting error of each edge point based on the positional uncertainty information of each edge point; fitting the mathematical model of the geometric features using a robust estimation algorithm includes solving the straight line model by minimizing the objective function; and calculating the measurement parameters related to the geometric features based on the fitted mathematical model of the geometric features, including: calculating the distance between the first straight line feature and the second straight line feature based on the first straight line model fitted for the first straight line feature and the second straight line model fitted for the second straight line feature.
[0012] In some embodiments, the location uncertainty information is characterized by the covariance matrix of each edge point; the fitting error is the Mahalanobis distance, which is calculated based on the covariance matrix.
[0013] In some embodiments, the objective function further includes a smoothing term, which is used to constrain the deviation of the parameters of the desired linear model from the parameters of the initial linear assumption; the process of solving the linear model by minimizing the objective function includes solving it using an iterative reweighted least squares method.
[0014] In some embodiments, calculating the distance between the first straight line feature and the second straight line feature includes: sampling multiple points along the first straight line model and calculating the vertical distance from each sampling point to the second straight line model to generate a local distance distribution map.
[0015] In some embodiments, the covariance matrix is modeled as anisotropic, with its minor axis direction aligned with the edge normal direction at the edge point, and the variance of its minor axis direction inversely proportional to the edge strength and / or confidence level at that edge point.
[0016] In some embodiments, the method further includes the step of: evaluating the uncertainty of the spacing measurement results, wherein the evaluation is based on the positional uncertainty information of the edge points and / or the fitting residuals of the straight line model.
[0017] According to another aspect of this disclosure, a visual geometric measurement device is also provided, comprising: an image acquisition module for acquiring a target image to be measured, the target image containing at least one geometric feature to be measured; an image processing module for processing the target image to be measured, extracting edge points with sub-pixel precision, and estimating the positional uncertainty information of each edge point; a model fitting module for determining the weight of each edge point in the geometric model fitting based on the positional uncertainty information of each edge point, and fitting a mathematical model of the geometric feature using a robust estimation algorithm, wherein the robust estimation algorithm is used to suppress the influence of edge points with low weight on the fitting result; and a parameter calculation module for calculating measurement parameters related to the geometric feature based on the fitted mathematical model of the geometric feature.
[0018] According to another aspect of this disclosure, an electronic device is also provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform the visual geometry measurement method described in any of the preceding claims by executing the executable instructions.
[0019] According to another aspect of this disclosure, a computer-readable storage medium is also provided, on which a computer program is stored, which, when executed by a processor, implements the visual geometric measurement method described in any of the preceding claims.
[0020] According to another aspect of this disclosure, a computer program product is also provided, including a computer program that, when executed by a processor, implements the visual geometric measurement method of any of the above.
[0021] The visual geometry measurement methods, apparatus, devices, media, and program products provided in the embodiments of this disclosure solve the core contradiction in traditional visual geometry measurement methods that make it difficult to balance high precision and high robustness. By elevating edge points from deterministic coordinates to probabilistic entities with uncertainty metrics and performing weighted robust fitting based on this, they achieve stable and accurate adaptive measurement in complex industrial scenarios.
[0022] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0023] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure. It is obvious that the drawings described below are merely some embodiments of this disclosure, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0024] Figure 1 This diagram illustrates an exemplary application system architecture in an embodiment of the present disclosure.
[0025] Figure 2 This diagram illustrates a flowchart of a visual geometry measurement method according to an embodiment of the present disclosure.
[0026] Figure 3 This diagram illustrates a flowchart of yet another visual geometry measurement method according to an embodiment of the present disclosure;
[0027] Figure 4 This diagram illustrates a flowchart of a specific line spacing measurement method according to an embodiment of the present disclosure;
[0028] Figure 5 This diagram illustrates a user interface with line spacing according to an embodiment of the present disclosure.
[0029] Figure 6 This diagram illustrates a visual geometry measurement device according to an embodiment of the present disclosure.
[0030] Figure 7 A structural block diagram of an electronic device according to an embodiment of the present disclosure is shown. Detailed Implementation
[0031] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, they are provided so that this disclosure will be more comprehensive and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0032] Furthermore, the accompanying drawings are merely illustrative of this disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted. Some block diagrams shown in the drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0033] The specific implementation methods of the embodiments of this disclosure will now be described in detail with reference to the accompanying drawings.
[0034] In the fields of industrial automation, precision manufacturing, and engineering measurement, the accurate measurement of the distance between two straight lines (line spacing) is a fundamental and crucial task. Its applications are extremely wide-ranging, including: detecting the spacing of parallel traces on printed circuit boards (PCBs), controlling the grid line spacing in LCD panels, measuring the distance between two parallel edges on mechanical parts, and calibrating mounting slots for structural components in the aerospace field. These applications place extremely high demands on the accuracy, speed, and robustness of measurements, which traditional contact measurement methods (such as calipers and micrometers) can no longer meet. Therefore, using machine vision technology for non-contact, high-efficiency line spacing measurement has become a mainstream research direction.
[0035] Existing machine vision-based line spacing measurement methods, based on their core ideas, can be mainly categorized into the following types: methods based on edge extraction and Hough transform, methods based on sub-pixel edge localization and line fitting, and methods based on region template matching.
[0036] Option 1: Measurement method based on edge extraction and Hough transform. This is the most classic and intuitive approach. The technical route is as follows: First, the acquired grayscale image is preprocessed, such as by Gaussian filtering to suppress noise. Then, edge detection operators (such as Canny and Sobel) are used to extract edge points in the image. Next, these edge points are mapped to the Hough parameter space for voting to detect straight lines in the image. In Hough space, a straight line can be represented using polar coordinate parameters. It means that among them It is the perpendicular distance from the origin to the line. This is the angle between the perpendicular line and the x-axis. By finding the peak points in the parameter space, the parameters of each line in the image can be determined. For two parallel lines, their Hough parameters should satisfy... And line spacing It can then be approximately calculated as follows: The advantage of this method lies in its tolerance for edge discontinuities and partial occlusion. However, its disadvantages are significant: firstly, its accuracy is limited. The accuracy of the Hough transform is affected by the parameter space quantization interval (i.e., and First, due to limitations, improving accuracy requires a dramatic increase in computation. Second, it is essentially a global statistical method, unable to provide local positional information for every point on the line. When the line has slight curvature or local deformation, it provides an "average" line, failing to reflect the true local spacing changes. Finally, in complex contexts or when multiple lines exist, the Hough transform is prone to producing spurious lines, interfering with the extraction of correct results.
[0037] Option 2: Measurement method based on sub-pixel edge localization and line fitting. This option aims to improve measurement accuracy and is a commonly used method in current industrial vision. The process is as follows: First, coarsely locate edge points using integer-pixel edge detection. Then, use sub-pixel localization algorithms (such as gray-scale moment method, interpolation method, Zernike moment method) to precisely locate these edge points, achieving a localization accuracy of one-tenth or even one-hundredth of a pixel. Taking the gray-scale moment method as an example, it assumes that near the edge, the gray-scale distribution perpendicular to the edge direction conforms to an ideal model (such as an S-curve). By calculating the first few moments of this gray-scale distribution, the precise position of the edge can be determined. A series of sub-pixel edge point coordinates are obtained. Then, the least squares method is used to fit these points to a straight line. For the two lines to be measured, the equations of the lines are fitted separately. and The distance between the two lines is... It can be calculated using the formula for the distance from a point to a line. If the two lines are parallel (i.e., ...), ... and If they are collinear, then the distance formula simplifies to the following formula (1):
[0038] (1)
[0039] This method offers a significant improvement in accuracy compared to the Hough transform. However, its core drawback lies in its over-reliance on the quality of edge points. Least squares methods are highly sensitive to outliers. Noise, spurs, local defects, or incomplete edges in the image can generate erroneous edge points. These outliers significantly distort the fitted line results, leading to substantial deviations in distance measurements. Furthermore, this method typically requires manual pre-definition of the region of interest (ROI) to limit the edge search range, and its automation and adaptability need improvement.
[0040] Option 3: A method based on region template matching and centerline extraction. For lines with a certain width (such as PCB traces), another approach is to first identify the entire line region. Using template matching or image segmentation techniques (such as thresholding), the regions containing the two lines are located, and their binary masks are generated. Then, through morphological operations (such as thinning) or distance transform skeleton extraction algorithms, the centerline (Skeleton) of each line is obtained. Finally, the average or minimum distance between the two centerlines is calculated as the line spacing. This method avoids the influence of incomplete edges to some extent. However, its drawbacks are: First, template matching is sensitive to rotation, scale changes, and deformation, resulting in poor adaptability. Second, skeleton extraction algorithms are prone to producing short branches (glitch) that require complex post-processing for cleanup, and the accuracy of the centerline is limited by the binarization process and the skeletonization algorithm itself. Finally, it is also difficult to handle situations where the line width varies locally or where there is neighboring interference.
[0041] Through in-depth analysis of the above-mentioned existing technical solutions, it can be clearly summarized that they share the following key drawbacks in achieving high-precision and high-robustness line spacing measurement:
[0042] The trade-off between accuracy and robustness: While Scheme 2 offers high accuracy, it is extremely sensitive to edge quality and has weak anti-interference capabilities (poor robustness); Schemes 1 and 3 offer slightly better robustness, but their accuracy is limited. There is a lack of a method that can simultaneously achieve both high accuracy and high robustness.
[0043] There is a lack of effective mechanisms for handling local deformations and outliers: Most existing methods are based on a global model (such as a global straight line). When the measured straight line has slight local curvature, jitter, or outliers due to noise or defects, the global model will be contaminated, resulting in distorted measurement results that cannot reflect the true, local spacing conditions.
[0044] Insufficient automation and intelligence: Method selection and parameter adjustment (such as edge detection threshold, Hough transform parameters, ROI settings) heavily rely on the operator's experience. For different imaging conditions and different objects being measured, repeated adjustments are required, making it difficult to achieve "one-click" automatic measurement.
[0045] Limited adaptability: The performance of existing methods drops sharply in scenes with complex backgrounds, low contrast, uneven lighting, or partial occlusion.
[0046] Figure 1 A schematic diagram of an exemplary application system architecture to which the visual geometric measurement method of the present disclosure embodiments can be applied is shown. For example... Figure 1 As shown, the system architecture may include an image acquisition device 101 and a visual geometry measurement device 102.
[0047] The image acquisition device 101 is responsible for acquiring high-quality images of the target object. It typically includes a high-resolution industrial camera, a telecentric lens with appropriate magnification (to eliminate perspective errors), and a light source (such as a ring LED or backlight) to provide stable and uniform illumination for the object being measured. The visual geometry measurement device 102 can operate in electronic devices such as industrial computers, industrial control computers, or embedded processing units. It receives digital images transmitted from the image acquisition device 101 and carries and executes the core visual geometry measurement algorithm of this disclosure.
[0048] The image acquisition device 101 and the visual geometry measurement device 102 can communicate via standard industrial interfaces such as Gigabit Ethernet, USB 3.0, and CameraLink to form a complete visual measurement system. The workflow of this system is as follows: After acquiring an image of the target object containing the geometric features to be measured, the image acquisition device 101 sends it to the visual geometry measurement device 102; the visual geometry measurement device 102 processes and analyzes the image, and finally outputs the required geometric parameter measurement results.
[0049] Under the above system architecture, this disclosure provides a visual geometry measurement method, which can be executed by any electronic device with computing capabilities, such as the aforementioned visual geometry measurement device 102.
[0050] Figure 2 A flowchart of a visual geometry measurement method according to an embodiment of this disclosure is shown, such as Figure 2 As shown, the visual geometric measurement method provided in this embodiment includes the following steps:
[0051] S202, acquire the target image to be tested, the target image to be tested contains at least one geometric feature to be tested.
[0052] It should be noted that the target image to be measured can be any digital image that requires calculation of industrial measurement parameters. The target image to be measured can be obtained through... Figure 1 The image acquisition device 101 shown acquires the image. The geometric features contained in the target image to be tested cover various geometric elements commonly found in industrial visual inspection. For example, it can be two straight lines, with the subsequent measurement parameter being the line spacing; it can also be two circles, with the measurement parameter being the distance between their centers; it can also be a planar region, with the measurement parameter being its flatness or parallelism relative to a reference; or it can be a more complex contour feature. The core of the method in this embodiment lies in the high-precision modeling and parameter calculation of these geometric features, and its application scenarios are not limited to specific geometric feature types.
[0053] S204 processes the target image to be tested, extracts edge points with sub-pixel precision, and estimates the positional uncertainty information of each edge point.
[0054] It should be noted that image processing of the target image requires at least edge point extraction and estimation of positional uncertainty. In digital images, pixels are the basic unit, and integer-pixel localization refers to an edge being located at a specific pixel position. However, true edges often lie between pixels. Subpixel-precision edge points refer to edge localization accuracy improved to a level less than one pixel size through specific interpolation or fitting algorithms (such as gray-scale moment method or quadratic curve fitting method).
[0055] The positional uncertainty information of edge points is a quantitative assessment of the accuracy of localization for each sub-pixel edge point. In reality, factors such as image noise, edge blurring, and uneven illumination can lead to positioning results that are not absolutely accurate but rather have a confidence range. Traditional methods treat each edge point as a deterministic, error-free coordinate, which is theoretically incomplete and is the main reason for its sensitivity to noise. One of the core innovations of this disclosure is that it elevates each edge point from a deterministic coordinate to a probabilistic entity. Estimating its positional uncertainty information provides a data foundation for subsequent robust fitting. Only by clarifying the positional uncertainty information (unreliability level) of each edge point can the credibility assessment of the final geometric parameter measurement results be more accurate. In a preferred embodiment, the positional uncertainty information can be characterized by a covariance matrix.
[0056] S206. Based on the positional uncertainty information of each edge point, determine its weight in the geometric model fitting, and obtain the mathematical model of geometric features by fitting through a robust estimation algorithm. The robust estimation algorithm is used to suppress the influence of edge points with low weight on the fitting result.
[0057] It should be noted that geometric model fitting refers to the process of finding a mathematical equation or parametric model that best describes the overall spatial distribution of a set of discrete, noisy edge points. In this embodiment, geometric model fitting refers to the process itself, that is, the operation of finding a geometric model. The mathematical model of geometric features refers to the result obtained from this process, that is, the specific and optimal model finally found. The goal of geometric model fitting is to obtain the mathematical model of geometric features. Determining weights based on location uncertainty information involves directly using the location uncertainty information of each edge point to calculate its weight in the fitting process. The lower the uncertainty of an edge point (i.e., the more accurate its location), the higher its weight; conversely, the higher the uncertainty of a point (which may be due to noise or ambiguity), the lower its weight. Robust estimation algorithms are a class of mathematical optimization algorithms specifically designed to resist the interference of outliers in the data. Unlike the standard least squares method, these algorithms can automatically reduce or even ignore the influence of data points that do not conform to the mainstream trend during the fitting process. In this embodiment, a robust estimation algorithm is used to suppress the influence of edge points with low weights on the fitting results.
[0058] S208, based on the mathematical model of the fitted geometric features, calculates the measurement parameters related to the geometric features.
[0059] It should be noted that after obtaining a robust and accurate mathematical model of the geometric features, the corresponding measurement parameters can be calculated according to specific application requirements. For example, if the geometric features are two straight lines, their average spacing or spacing distribution along the lines can be calculated; if they are two circles, the distance between their centers can be calculated; if it is a plane, its inclination or flatness error relative to a reference plane can be calculated. Since the mathematical model is based on the aforementioned robust fitting process, the measurement parameters output in this step have high accuracy and high reliability.
[0060] The visual geometric measurement method provided in this disclosure introduces the concept of probabilization, transforming edge points from deterministic coordinates into probabilistic entities with uncertainties. Based on this, a robust estimation algorithm is used for weighted fitting, achieving a balance between accuracy and robustness, making the measurement results more scientific and reliable. The method automatically determines weights based on uncertainties, reducing the dependence on manual parameter adjustments and enabling the method to adapt to different imaging conditions and the measured object.
[0061] In some embodiments of this disclosure, the visual geometric measurement method can be specifically applied to measuring the distance between two linear features, i.e., line spacing measurement. Specifically, the geometric features contained in the target image to be measured are a first linear feature and a second linear feature. Correspondingly, the mathematical model of the geometric feature to be solved in subsequent steps is a linear model.
[0062] like Figure 3As shown, the specific line spacing measurement method in the geometric measurement method also includes the following steps:
[0063] S302, based on the positional uncertainty information of each edge point, determine its weight in the geometric model fitting, including: constructing an objective function, the data terms of the objective function being weighted according to the positional uncertainty information of each edge point to its fitting error;
[0064] S304, a mathematical model of geometric features is obtained by fitting a robust estimation algorithm, including solving a linear model by minimizing an objective function;
[0065] S306, based on the mathematical model of the fitted geometric features, calculate the measurement parameters related to the geometric features, including: based on the first straight line model fitted for the first straight line feature and the second straight line model fitted for the second straight line feature, calculate the distance between the first straight line feature and the second straight line feature.
[0066] It's important to note that the objective function is a mathematical equation whose core function is to quantify the target we want to optimize—in this case, finding the straight line that best represents the overall trend of all edge points. It's the objective function connecting the observed edge points in the data to the desired straight line model. The smaller the value of the objective function, the better the fitted straight line model matches the true distribution of edge points. Constructing a reasonable objective function is key to obtaining high-precision fitting results. The fitting error measures the deviation between a single edge point and the current candidate straight line model. Traditional methods often use simple geometric distances, such as the perpendicular distance from a point to a line. In some preferred embodiments, Mahalanobis distance is preferred for the fitting error. Determining the weight of each edge point in the geometric model fitting based on its positional uncertainty information can be achieved by constructing an objective function. This objective function contains a data item that weights the fitting error based on the positional uncertainty information of each edge point. Specifically, the fitting error is usually expressed as a distance metric from the edge point to the candidate line. By introducing location uncertainty information (such as the covariance matrix) for weighting, for example using Mahalanobis distance, points with precise positioning can contribute more to the objective function value, while points with ambiguous or unreliable positioning contribute less, thus integrating weight information into the optimization process. The method of fitting a linear model using a robust estimation algorithm specifically involves minimizing the objective function to solve for the optimal linear model parameters. The minimization process is a mathematical optimization problem whose goal is to find a set of linear parameters that minimizes the sum of the weighted fitting errors of all edge points, i.e., the value of the objective function.
[0067] In this specific application scenario, the calculation of measurement parameters related to geometric features specifically involves calculating the distance between the first and second linear features. This calculation is based on a first linear model fitted to the first linear feature and a second linear model fitted to the second linear feature. Furthermore, to reveal the distribution of the distance along the linear direction, multiple points can be sampled along the first linear model, and the perpendicular distance from each sampling point to the second linear model can be calculated to generate a local distance distribution map, visually demonstrating any potential local deformation or distance fluctuations.
[0068] This embodiment applies the visual geometric measurement method to the high-frequency requirement of line spacing measurement in industrial inspection, clarifying the complete technology from image features to the final measurement value. By constructing a weighted objective function and minimizing it, not only is high accuracy and robustness of the model parameters achieved, but a specific and reliable measurement method is also provided for line spacing measurement.
[0069] In some embodiments of this disclosure, the location uncertainty information is characterized by the covariance matrix of each edge point. The covariance matrix is a mathematical tool derived from probability and statistics, used to describe the uncertainty (variance) between the dimensions of a random vector (here referring to the two-dimensional coordinates of the edge point) and the correlation between them. In this application scenario, the covariance matrix of each edge point is a 2x2 symmetric positive definite matrix. It can be visualized as an uncertainty ellipse centered on the edge point. The major axis of this ellipse represents the location uncertainty of the edge point along the edge tangent direction (usually large because positional changes along the edge are not significant), and the minor axis represents the location uncertainty along the edge normal direction (usually small because movement along the normal direction causes significant grayscale changes, thus resulting in high positioning accuracy). Through the covariance matrix, the positioning reliability of each edge point in different directions can be accurately and quantitatively described.
[0070] In some embodiments, the fitting error is Mahalanobis distance. Mahalanobis distance is a metric that measures the distance between a point and a population distribution. Unlike traditional Euclidean distance, it considers the characteristics of the data distribution (i.e., the covariance structure). Using Mahalanobis distance as the fitting error is the core mathematical foundation for achieving robustness and high accuracy in this embodiment. By employing the covariance matrix to represent uncertainty and introducing Mahalanobis distance as the fitting error, this embodiment deeply integrates probability and statistics theory into geometric vision measurement, providing a solid mathematical guarantee for achieving a balance between high accuracy and high robustness.
[0071] In some embodiments of this disclosure, the objective function further includes a smoothing term, which is used to constrain the deviation of the parameters of the desired linear model from the parameters of the initial linear assumption; the linear model is solved by minimizing the objective function, including by using an iterative reweighted least squares method.
[0072] This disclosure specifies the composition of the objective function and the optimization solution method. It should be noted that the objective function also includes a smoothing term. The smoothing term is a regularization term added to the data terms of the objective function. Its core function is to constrain the parameters of the finally solved linear model from an initial linear hypothesis to prevent excessive deviation. The initial linear hypothesis can be obtained in advance using a fast global estimation method (e.g., Hough transform or random sample consensus algorithm). Introducing the smoothing term prevents the solved linear model from deviating from its true global position and orientation due to interference from strong local noise or dense edges in the image during iterative optimization, thus avoiding getting trapped in a local optimum. Furthermore, the initial linear hypothesis provides reliable prior information about the approximate position and orientation of the line. The smoothing term utilizes this information to enhance the robustness of the method.
[0073] Solving the linear model by minimizing the objective function includes using the Iterative Reweighted Least Squares (IRLS) method. IRLS is an iterative optimization algorithm specifically designed for solving weighted least squares problems. Its specific process is as follows:
[0074] Initialization: Use the parameters of the aforementioned initial straight line assumption as the starting point for iteration.
[0075] Iterative loop:
[0076] Step 1: Calculate the weights. Based on the current linear model parameters, calculate the Mahalanobis distance from each edge point to the line, and convert the Mahalanobis distance into a weight for each point in the current iteration using a specific weighting function (such as the Huber weighting function or the Tukey weighting function). Points with larger Mahalanobis distances (outliers) will be assigned lower weights.
[0077] Step 2: Reweighted Solution. Using the updated weights, solve the single-weighted linear least squares problem to obtain new linear model parameters. This solution significantly reduces the impact of low-weighted points.
[0078] Convergence judgment: Repeat the above steps until the change in the linear model parameters is less than a preset tolerance, at which point the algorithm is considered to have converged, and the linear model obtained at this time is the optimal solution.
[0079] This embodiment introduces a smoothing term, integrating local consistency constraints into the optimization framework, effectively improving the stability and reliability of the optimization process and preventing the results from being affected by local noise. Simultaneously, it explicitly employs an iterative reweighted least squares method for solving the problem, achieving efficient and stable optimization of the weighted objective function. This embodiment enables the linear model fitting process to not only intelligently suppress outliers but also maintain the rationality of the global structure, thereby obtaining more accurate and robust measurement results in complex scenarios.
[0080] In some embodiments of this disclosure, calculating the distance between the first straight line feature and the second straight line feature includes: sampling multiple points along the first straight line model and calculating the vertical distance from each sampling point to the second straight line model to generate a local distance distribution map.
[0081] It should be noted that calculating the distance between the first and second linear features is not limited to calculating a global average. It also includes sampling multiple points along the first linear model at certain intervals, and then calculating the perpendicular distance from each sampling point to the second linear model. Organizing and visualizing this series of local distance values that vary along the linear position generates a local distance distribution map.
[0082] Generating local distance distribution maps enables the perception of local deformation. These maps clearly and intuitively display the fluctuations in line spacing along the straight line, revealing potential local deformations, installation deviations, or manufacturing errors in the measured object. Generating local distance distribution maps not only provides an average distance value but also identifies specific sections where the spacing exceeds tolerance limits, offering far richer data support for process improvement and equipment condition monitoring than a single numerical value. By analyzing the distribution of local distances, the stability of the measurement results can be assessed. If the local distance values fluctuate within a small range, it indicates high measurement consistency and reliable results; if the fluctuations are drastic, it suggests potential noise or unclear features in that area, requiring a cautious approach to the results.
[0083] In some embodiments of this disclosure, the covariance matrix is modeled as anisotropic, with its minor axis direction aligned with the edge normal direction at the edge point, and the variance of its minor axis direction inversely proportional to the edge strength and / or confidence level at that edge point.
[0084] It should be noted that the covariance matrix is modeled as anisotropic. The uncertainty represented by the covariance matrix is not equal in different directions, which is figuratively represented as an elliptical confidence region. This means that at an ideal step edge, moving along the edge tangent direction results in minimal change in image grayscale, making it difficult to accurately locate the edge point in that direction, thus leading to greater positional uncertainty. Conversely, moving along the normal direction perpendicular to the edge causes a dramatic change in image grayscale, making edge location in that direction very accurate, thus resulting in less positional uncertainty.
[0085] Specifically, the minor axis direction (i.e., the direction of least uncertainty) of the anisotropic covariance matrix is consistent with the edge normal direction at the edge point. This is because the edge normal direction is the direction of the image gray-level gradient, which is the most sensitive and accurate direction for edge localization. Simultaneously, the variance of the minor axis direction (i.e., the quantified value of uncertainty) is inversely proportional to the edge strength and / or confidence level of that edge point. Higher edge strength (usually represented by gradient magnitude), or higher confidence level estimated through other methods (such as lightweight neural networks), indicates a clearer and more reliable edge point, resulting in higher localization accuracy in the normal direction and a smaller variance. Conversely, for edge points in blurred or noisy areas, with weak edge strength and low confidence, the localization variance in the normal direction is correspondingly larger.
[0086] The covariance matrix is modeled as an anisotropic enhancement of the physical realism of the probabilistic model, accurately reflecting the inherent difference in the positioning accuracy of edge points in the tangent and normal directions. This transforms the description of uncertainty from an isotropic circular model to a more realistic anisotropic elliptical model, providing a more accurate and reliable data foundation for subsequent robust estimation. The inverse relationship between the variance of the covariance matrix along its minor axis and the edge strength / confidence allows the model to adaptively handle edge regions of varying quality in the image.
[0087] In summary, this embodiment, by performing physically meaningful anisotropic modeling of the covariance matrix and dynamically determining its parameters from image data, makes the theoretical foundation of the entire probabilistic measurement method more solid, ultimately effectively improving the accuracy and robustness of the measurement results.
[0088] In some embodiments of this disclosure, the measurement of line spacing is specifically introduced to demonstrate illustrative applications. Addressing the significant shortcomings of existing visual measurement methods for line spacing, the purpose of this embodiment is to provide a high-precision adaptive measurement method for the distance between two straight lines based on probabilistic perception and local consistency constraints. This fundamentally changes the measurement paradigm that relies on a global model and is susceptible to outlier interference. By introducing a probabilistic model to describe the uncertainty of edge points and utilizing the principle of local consistency to robustly estimate the true position of the line, stable and accurate line spacing measurement results can be obtained under both ideal and adverse imaging conditions. Specific objectives include: achieving sub-pixel-level measurement accuracy; significantly improving immunity to noise, local defects, and outliers; enhancing the method's adaptability in different scenarios and reducing human intervention; and providing not only a global average spacing but also a spacing distribution map along the straight line direction to reveal local variations.
[0089] The hardware of this measurement system mainly includes: a high-resolution industrial camera, a telecentric lens with appropriate magnification (to eliminate perspective errors), and a light source (such as a ring LED or backlight) to provide uniform illumination for the object being measured. The software algorithm runs on an industrial computer or embedded processing unit and carries the core method of this embodiment.
[0090] The core algorithm flow of this embodiment is as follows: Figure 4 As shown, it is mainly divided into four stages: probabilistic subpixel edge detection, robust estimation of the straight line model based on local consistency constraints, adaptive calculation of the distance between two straight lines, and result visualization and uncertainty assessment.
[0091] Phase 1: Probabilistic subpixel edge detection.
[0092] Unlike traditional methods that directly output a definite edge point location, this stage assigns a position uncertainty metric to each edge point.
[0093] Input and Preprocessing: The system input is a grayscale image. First, adaptive contrast enhancement and noise filtering (such as using non-local mean filtering) are performed to improve image quality.
[0094] Probabilistic response map generation: We employ an improved edge detection operator that not only calculates the edge intensity... It also estimates the confidence level of this point as an edge. and edge direction Confidence level The signal-to-noise ratio can be estimated based on local gradients or through a lightweight neural network.
[0095] Subpixel localization and uncertainty quantization: in edge intensity Near the peak point, sub-pixel localization is performed using quadratic surface fitting or gray-scale moment method to obtain the center position of the edge point. The key innovation lies in our simultaneous estimation of the covariance matrix at this sub-pixel location. This is used to characterize its uncertainty. For an ideal step edge, the positional uncertainty along the edge direction is much greater than that along the normal direction. Therefore, This can be modeled as an anisotropic Gaussian distribution, where the major axis aligns with the edge tangent direction, and the minor axis aligns with the edge normal direction. The variance along the minor axis... Inversely proportional to edge strength and confidence level, it reflects the positional accuracy of the normal direction:
[0096] (2)
[0097] As in formula (2) above, It is an empirical constant. It is a small quantity to prevent division by zero. The variance along the major axis (tangent direction) is... This can be set to a large, fixed value, indicating that the positioning in that direction is blurred. In this way, each edge point... It is no longer an isolated point, but an uncertain region with an elliptical shape. The probability entity.
[0098] Phase 2: Robust estimation of linear models based on local consistency constraints.
[0099] This embodiment abandons the strategy of performing a one-time global fitting of all edge points, and instead adopts a robust estimation method that gradually converges from coarse to fine.
[0100] Initial line hypothesis generation: First, using the traditional Hough transform or RANSAC algorithm, the initial parameters of the two lines to be tested are quickly estimated from all probability edge points. and The purpose of this step is to provide a global, rough direction and approximate location of the straight line, serving as a starting point for subsequent refinement.
[0101] Constructing the energy function for local consistency constraints: For each line, we define an energy function. To evaluate a candidate line The degree of agreement with all probability edge points. This function consists of two parts: .
[0102] Data Items This measures the degree of fit between an edge point and a line. Considering the probabilistic properties of edge points, we use the negative log-likelihood. For an edge point... and its uncertainty It goes to the straight line The square of the Mahalanobis distance is a better metric:
[0103] (3)
[0104] in, It is the unit normal vector of the line. It is a point In a straight line The foot of the perpendicular. The data item is defined as the weighted sum of the squared Mahalanobis distances of all points: Weight It can be determined by marginal confidence. This decision reduces the impact of unreliable edge points.
[0105] Smoothing Term : Encourage the final estimated straight line to match the initial assumptions Don't stray too far, especially in terms of direction. This helps stabilize the optimization process and prevent it from getting trapped in local minima. For example, .
[0106] Iterative reweighted least squares optimization: In order to solve for the energy function Minimum line parameter We employ an Iterative Reweighted Least Squares (IRLS) algorithm. In each iteration, the Mahalanobis distance and weights of each point are calculated based on the current line parameters, and then a weighted least squares problem is solved to update the line parameters. Since the Mahalanobis distance and weights contain uncertainties... Points that are poorly located or whose direction deviates significantly from the current line hypothesis (i.e., outliers) are automatically assigned lower weights and thus effectively suppressed. This process is repeated iteratively until convergence, ultimately yielding robust line parameter estimates. and .
[0107] Phase 3: Adaptive calculation of the distance between two lines.
[0108] Robust model for obtaining two straight lines and Then, calculate the spacing between them.
[0109] Global average distance: If two lines are determined to be parallel (i.e. Then the global average distance between them for: .
[0110] Local Distance Distribution Plot: To reveal the variation in spacing along a straight line, we introduce a local distance distribution plot. Along one of the straight lines... Sampling points at fixed intervals For each sampling point Calculate its distance to another straight line. vertical distance Simultaneously, the local distance for each sampling point can be estimated based on the distribution and uncertainty of edge points near the sampling point. The confidence interval is determined. Therefore, we can plot the distance as a function of location and identify areas outside the tolerance range.
[0111] Distance between non-parallel lines: If two lines are not parallel, the shortest distance between them (i.e., the length of the common perpendicular segment) can be calculated, or the average distance over a specific area can be calculated depending on the application requirements.
[0112] Phase 4: Results visualization and uncertainty assessment.
[0113] The system's final output includes: a measurement image overlaid with detected lines and local distance annotations, the global average distance value, the local distance distribution map, and an uncertainty assessment report for the entire measurement process (e.g., covariance based on the final energy function value or parameter estimates). See attached. Figure 5 As shown, the user interface can clearly display measurement results and suspicious areas, showing the original image, fitted line, local distance distribution map, and global results.
[0114] Compared to existing technologies, this invention brings fundamental improvements and significant beneficial effects:
[0115] A balance between accuracy and robustness: By introducing a probabilistic edge model and robust estimation based on Mahalanobis distance, this invention effectively suppresses the influence of outliers and noise, achieving unprecedented anti-interference capabilities while maintaining sub-pixel-level high accuracy. Stable measurement results can be obtained even with discontinuous edges, burrs, or local defects.
[0116] The ability to perceive local deformation: Traditional global fitting methods can obscure local information, while the local distance distribution map of this invention can clearly and intuitively show the fluctuation of line spacing along the straight line direction, providing richer data support for process improvement and equipment status monitoring.
[0117] It is highly adaptable and reduces the reliance on manual parameters: the probability weights and IRLS optimization process enable the algorithm to automatically adapt to different image qualities and edge characteristics, reducing the sensitivity to parameters such as edge detection thresholds and ROI regions, and improving the degree of automation.
[0118] This invention provides quantification of measurement uncertainty, a feature not found in traditional methods. It outputs not only a single measurement value but also a confidence range for that value, making the measurement results more scientific and reliable, and providing a more comprehensive basis for decision-making based on measurement data.
[0119] Wider applicability: Due to its robustness to noise and outliers, the present invention can maintain excellent performance in industrial environments with low contrast, uneven lighting, and complex backgrounds, thus broadening the application boundaries of machine vision ranging.
[0120] Additionally, it should be noted that, besides using the covariance matrix, other uncertainty representation methods can be considered in the embodiments of this disclosure, such as deep learning-based prediction, directly outputting the probability distribution of the location of each edge point. IRLS can be replaced with other robust regression algorithms, such as different weight functions of the M-estimator (Huber, Tukey), or an improved variant of the Random Sample Consensus (RANSAC) algorithm that considers the confidence level of edge points during sampling. The smoothing term can constrain not only the direction... It can also constrain the position. Alternatively, more complex prior knowledge can be introduced, such as requiring the line to be parallel or perpendicular to other known structures in the image. In addition to using the foot of the perpendicular distance, for the case of d, the shortest distance between a series of corresponding points on the two lines can be calculated, and the correspondence between the points can be established through algorithms such as Dynamic Time Warping (DTW).
[0121] Based on the same inventive concept, this disclosure also provides a visual geometry measurement device, as described in the following embodiments. Since the principle by which this device embodiment solves the problem is similar to that of the above-described method embodiments, the implementation of this device embodiment can refer to the implementation of the above-described method embodiments, and repeated details will not be elaborated further.
[0122] Figure 6 A schematic diagram of a visual geometry measurement device according to an embodiment of this disclosure is shown, such as... Figure 6 As shown, the device includes:
[0123] Image acquisition module 601 is used to acquire a target image to be tested, wherein the target image to be tested contains at least one geometric feature to be tested;
[0124] The image processing module 602 is used to process the target image to be tested, extract edge points with sub-pixel precision, and estimate the positional uncertainty information of each edge point;
[0125] The model fitting module 603 is used to determine the weight of each edge point in the geometric model fitting based on the positional uncertainty information of each edge point, and to obtain the mathematical model of the geometric feature by fitting it through a robust estimation algorithm, wherein the robust estimation algorithm is used to suppress the influence of edge points with low weight on the fitting result.
[0126] The parameter calculation module 604 is used to calculate the measurement parameters related to the geometric features based on the mathematical model of the fitted geometric features.
[0127] It should be noted that the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the content disclosed in the above method embodiments. It should also be noted that the above modules, as part of an apparatus, can be executed in a computer system such as a set of computer-executable instructions.
[0128] Those skilled in the art will understand that various aspects of this disclosure can be implemented as a system, method, or program product. Therefore, various aspects of this disclosure can be specifically implemented in the following forms: a completely hardware implementation, a completely software implementation (including firmware, microcode, etc.), or a combination of hardware and software aspects, collectively referred to herein as a "circuit," "module," or "system."
[0129] The following reference Figure 7 To describe an electronic device 700 according to such an embodiment of the present disclosure. Figure 7 The electronic device 700 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.
[0130] like Figure 7 As shown, the electronic device 700 is manifested in the form of a general-purpose computing device. The components of the electronic device 700 may include, but are not limited to: at least one processing unit 710, at least one storage unit 720, and a bus 730 connecting different system components (including storage unit 720 and processing unit 710).
[0131] The storage unit stores program code that can be executed by the processing unit 710, causing the processing unit 710 to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure. For example, the processing unit 710 can perform the following steps of the above method embodiments: acquiring a target image to be tested, the target image containing at least one geometric feature to be tested; processing the target image to be tested, extracting edge points with sub-pixel precision, and estimating the positional uncertainty information of each edge point; determining the weight of each edge point in the geometric model fitting based on the positional uncertainty information of each edge point, and fitting a mathematical model of the geometric feature using a robust estimation algorithm, wherein the robust estimation algorithm is used to suppress the influence of edge points with low weights on the fitting result; and calculating measurement parameters related to the geometric feature based on the fitted mathematical model of the geometric feature.
[0132] Storage unit 720 may include readable media in the form of volatile storage units, such as random access memory (RAM) 7201 and / or cache memory 7202, and may further include read-only memory (ROM) 7203.
[0133] The storage unit 720 may also include a program / utility 7204 having a set (at least one) program module 7205, such program module 7205 including but not limited to: an operating system, one or more application programs, other program modules and program data, each or some combination of these examples may include an implementation of a network environment.
[0134] Bus 730 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, a peripheral bus, a graphics acceleration port, a processing unit, or a local bus using any of the various bus structures.
[0135] Electronic device 700 can also communicate with one or more external devices 740 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 700, and / or with any device that enables electronic device 700 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via input / output (I / O) interface 750. Furthermore, electronic device 700 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 760. As shown, network adapter 760 communicates with other modules of electronic device 700 via bus 730. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0136] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0137] In particular, according to embodiments of this disclosure, the process described above with reference to the flowchart can be implemented as a computer program product, which includes a computer program that, when executed by a processor, implements the methods described in the above embodiments.
[0138] In exemplary embodiments of this disclosure, a computer-readable storage medium is also provided, which may be a readable signal medium or a readable storage medium. A program product capable of implementing the methods described above is stored thereon. In some possible implementations, various aspects of this disclosure may also be implemented as a program product including program code, which, when run on a terminal device, causes the terminal device to perform the steps described in the "Exemplary Methods" section of this specification according to various exemplary embodiments of this disclosure.
[0139] More specific examples of computer-readable storage media in this disclosure may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0140] In this disclosure, a computer-readable storage medium may include a data signal propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium, capable of transmitting, propagating, or transmitting a program for use by or in connection with an instruction execution system, apparatus, or device.
[0141] Optionally, the program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0142] In practical implementation, program code for performing the operations of this disclosure can be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, and conventional procedural programming languages such as C or similar languages. The program code can execute entirely on the user's computing device, partially on the user's device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing device can be connected to the user's computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0143] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0144] Furthermore, although the steps of the method in this disclosure are described in a specific order in the accompanying drawings, this does not require or imply that the steps must be performed in that specific order, or that all the steps shown must be performed to achieve the desired result. Additional or alternative steps may be omitted, multiple steps may be combined into one step, and / or a step may be broken down into multiple steps.
[0145] From the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, mobile terminal, or network device, etc.) to execute the methods according to the embodiments of this disclosure.
[0146] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the appended claims.
Claims
1. A visual geometric measurement method, characterized in that, include: Acquire a target image to be tested, wherein the target image contains at least one geometric feature to be tested; The target image to be tested is processed to extract edge points with sub-pixel precision, and the positional uncertainty information of each edge point is estimated. Based on the positional uncertainty information of each edge point, its weight in the geometric model fitting is determined, and a mathematical model of the geometric feature is obtained by fitting through a robust estimation algorithm, wherein the robust estimation algorithm is used to suppress the influence of edge points with low weight on the fitting result; Based on the mathematical model of the fitted geometric features, the measurement parameters related to the geometric features are calculated.
2. The visual geometric measurement method according to claim 1, characterized in that, The geometric features contained in the target image to be tested are a first straight line feature and a second straight line feature, and the mathematical model of the geometric features is a straight line model; Based on the positional uncertainty information of each edge point, determine its weight in the geometric model fitting, including: constructing an objective function, wherein the data terms of the objective function are weighted according to the positional uncertainty information of each edge point to their fitting error; A mathematical model of the geometric features is obtained by fitting a robust estimation algorithm, including solving the linear model by minimizing the objective function; Based on the mathematical model of the fitted geometric feature, the measurement parameters related to the geometric feature are calculated, including: based on the first straight line model fitted for the first straight line feature and the second straight line model fitted for the second straight line feature, the distance between the first straight line feature and the second straight line feature is calculated.
3. The visual geometric measurement method according to claim 2, characterized in that, The location uncertainty information is characterized by the covariance matrix of each edge point; The fitting error is the Mahalanobis distance, which is calculated based on the covariance matrix.
4. The visual geometric measurement method according to claim 3, characterized in that, The objective function also includes a smoothing term, which is used to constrain the degree of deviation between the parameters of the desired linear model and the parameters of the initial linear assumption. The method of solving the linear model by minimizing the objective function includes using the iterative reweighted least squares method.
5. The visual geometry measurement method according to any one of claims 2-4, characterized in that, Calculating the distance between the first straight line feature and the second straight line feature includes: sampling multiple points along the first straight line model and calculating the vertical distance from each sampling point to the second straight line model to generate a local distance distribution map.
6. The visual geometry measurement method according to claim 3 or 4, characterized in that, The covariance matrix is modeled as anisotropic, with its minor axis direction aligned with the edge normal direction at the edge point, and the variance of its minor axis direction inversely proportional to the edge strength and / or confidence level at that edge point.
7. A visual geometry measurement device, characterized in that, include: An image acquisition module is used to acquire a target image to be tested, wherein the target image contains at least one geometric feature to be tested; The image processing module is used to process the target image under test, extract edge points with sub-pixel precision, and estimate the positional uncertainty information of each edge point; The model fitting module is used to determine the weight of each edge point in the geometric model fitting based on the positional uncertainty information of each edge point, and to obtain the mathematical model of the geometric feature by fitting it through a robust estimation algorithm, wherein the robust estimation algorithm is used to suppress the influence of edge points with low weight on the fitting result. The parameter calculation module is used to calculate the measurement parameters related to the geometric features based on the mathematical model of the fitted geometric features.
8. An electronic device, characterized in that, include: processor; as well as Memory for storing the executable instructions of the processor; The processor is configured to execute the visual geometric measurement method according to any one of claims 1 to 6 by executing the executable instructions.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the visual geometric measurement method according to any one of claims 1 to 6.
10. A computer program product, comprising: A computer program or instruction, characterized in that, when executed by a processor, the computer program or instruction implements the visual geometric measurement method according to any one of claims 1 to 6.