Method and device for measuring distance of irregular edge in micro-target and defect
Patent Information
- Application Number
- CN202610836673.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-10
- Publication Date
- 2026-09-08
AI Technical Summary
这种离散化导致测距结果无法实现连续平滑过渡,只能产生固定步长(如1像素、1.414像素等)的离散跳跃值
通过获取待测对象的初始边缘像素梯度图像,并提取代表所述待测对象走向的单像素中心骨架,然后遍历所述单像素中心骨架的每一骨架点并计算得到各骨架点对应的法线方向,构建得到沿当前骨架点对应法线方向的探测射线,然后对所述初始边缘像素梯度图像进行非极大值抑制,定位局部梯度极值点,并结合一维抛物线插值算法计算生成所述待测对象的亚像素边界点集,然后基于空间加速检索结构,从所述亚像素边界点集中筛选出与当前骨架点对应探测射线处于同一设定邻域内的局部点集,并将所述局部点集中相邻的浮点坐标连接为微小局部矢量线段,然后将当前骨架点对应的探测射线与所述微小局部矢量线段进行二维矢量方程求交,得到当前骨架点对应探测射线与实际连续边缘的有效解析交点,然后根据所述有效解析交点的浮点坐标,计算得到所述待测对象在当前骨架点处的几何测量宽度,能够显著降低微小缺陷检测的相对误差,具备极高的工程可靠性,且通过空间加速结构能够实现实时级系统响应。
Smart Images

Figure CN122714352A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of engineering measurement technology, specifically to a method and apparatus for measuring the distance of irregular edges in small targets and defects. Background Technology
[0002] In the detection of extremely small engineering defects (such as microcracks requiring an accuracy of 0.1 mm), existing technologies typically apply normal rays directly to integer pixel-level edge points extracted by traditional operators (such as the Canny operator), resulting in inherent "raster quantization error" and "staircase effect".
[0003] Specifically, digital images are composed of discrete pixel grids, and the edges extracted by traditional methods are essentially a set of discrete pixel blocks with integer coordinates. When ranging along the skeleton normal, the intersection points obtained by ray detection can only be the pixel center coordinates that have been forcibly rounded. This discretization prevents the ranging results from achieving a continuous and smooth transition, producing discrete jump values with fixed step sizes (such as 1 pixel, 1.414 pixels, etc.). For tiny cracks whose physical width is not an integer multiple of the pixel's physical resolution, this integer-level quantization error causes severe numerical oscillations and abrupt changes in the width distribution curve of the entire crack, resulting in extremely high relative measurement errors. Mathematically, it shields the true, continuous microscopic direction of the crack edge, creating an irreconcilable mathematical contradiction that severely restricts the application of automated high-precision detection in practical engineering. Summary of the Invention
[0004] This application provides a method and apparatus for ranging irregular edges in small targets and defects, which can significantly reduce the relative error of small defect detection and has extremely high engineering reliability.
[0005] In a first aspect, embodiments of this application provide a method for ranging irregular edges in small targets and defects, the method comprising: Obtain the initial edge pixel gradient image of the object under test, and extract the single-pixel center skeleton representing the direction of the object under test; Traverse each skeleton point of the single pixel center skeleton and calculate the normal direction corresponding to each skeleton point to construct a probe ray along the normal direction corresponding to the current skeleton point. Non-maximum suppression is performed on the initial edge pixel gradient image to locate local gradient extrema points, and a sub-pixel boundary point set of the object under test is generated by combining a one-dimensional parabolic interpolation algorithm. Based on the spatial acceleration retrieval structure, a local point set that is in the same set of neighborhoods as the detection ray corresponding to the current skeleton point is selected from the sub-pixel boundary point set, and adjacent floating point coordinates in the local point set are connected into tiny local vector line segments. The intersection of the probe ray corresponding to the current skeleton point and the tiny local vector line segment is obtained by performing a two-dimensional vector equation to find the effective analytical intersection point between the probe ray corresponding to the current skeleton point and the actual continuous edge. Based on the floating-point coordinates of the effective analytical intersection points, the geometric measurement width of the object under test at the current skeleton point is calculated.
[0006] In conjunction with the first aspect, in one implementation, the step of traversing each skeleton point of the single-pixel central skeleton and calculating the normal direction corresponding to each skeleton point to construct a probe ray along the normal direction corresponding to the current skeleton point specifically includes: Traverse each skeleton point on the central skeleton of the single pixel and calculate the local tangent direction of each skeleton point; Based on the local tangent direction of the current skeleton point, the normal direction corresponding to the current skeleton point is obtained, and a probe ray along the normal direction corresponding to the current skeleton point is constructed.
[0007] In conjunction with the first aspect, in one implementation, the equation for the probe ray is specifically expressed as:
[0008] in, This indicates the probe ray corresponding to the current skeleton point. Indicates the coordinates of the current skeleton point. This represents a continuous scalar step size parameter extending along the normal direction corresponding to the current skeleton point. This represents the unit normal vector calculated based on the local tangent direction of the current skeleton point.
[0009] In conjunction with the first aspect, in one implementation, the step of performing non-maximum suppression on the initial edge pixel gradient image, locating local gradient extrema, and calculating and generating the sub-pixel boundary point set of the object to be tested using a one-dimensional parabolic interpolation algorithm specifically includes: Non-maximum suppression is performed on the initial edge pixel gradient image to locate local gradient extrema. A one-dimensional parabolic interpolation algorithm is used to calculate the continuous sub-pixel offset of the local gradient extremum point in the gradient direction, and then the sub-pixel boundary point set of the object under test is extracted. The sub-pixel boundary point set is an ordered set of double-precision floating-point coordinates sorted by the topology of the connected components.
[0010] In conjunction with the first aspect, in one implementation, the step of calculating the continuous sub-pixel offset of the local gradient extremum point in the gradient direction using a one-dimensional parabolic interpolation algorithm specifically includes: Find the integer pixel point with the largest local gradient in the gradient direction of the initial edge pixel gradient image, and obtain the coordinates and gradient magnitude of the integer pixel point; Obtain the gradient magnitude of the adjacent pixels before and after the integer pixel along the gradient direction; The sub-pixel offset is calculated based on the extreme value differentiation formula. Specifically:
[0011] in, Indicates subpixel offset. This represents the gradient magnitude of the neighboring pixels preceding the integer pixel along the gradient direction. This represents the gradient magnitude of the adjacent pixels following the gradient direction from the integer pixel. Represents the gradient magnitude at integer pixel points; The calculated subpixel offsets are superimposed onto the coordinates of integer pixels along the corresponding gradient direction vectors to obtain the double-precision floating-point subpixel boundary point coordinates representing the real physical location.
[0012] In conjunction with the first aspect, in one implementation, the spatial acceleration retrieval structure is a K-dimensional tree or an R-tree.
[0013] In conjunction with the first aspect, in one implementation, when the spatial acceleration retrieval structure is a K-dimensional tree, the step of filtering out a set of local points within the same defined neighborhood as the probe ray corresponding to the current skeleton point from the set of sub-pixel boundary points based on the spatial acceleration retrieval structure specifically includes: Construct a K-dimensional tree index containing the coordinates of all sub-pixel boundary points; A circular space is constructed with the current skeleton point as the center and the preset maximum allowable distance measurement error threshold as the radius; The local point set is generated by retrieving all local boundary points within the neighborhood of the constructed circular space using a K-dimensional tree index.
[0014] In conjunction with the first aspect, in one implementation, the step of intersecting the probe ray corresponding to the current skeleton point with the tiny local vector line segment using a two-dimensional vector equation to obtain the effective analytical intersection point between the probe ray corresponding to the current skeleton point and the actual continuous edge specifically includes: Obtain the two ordered endpoints of the tiny local vector line segment, respectively and Establish by parameters Parametric equations of line segments ,in, Represent the parametric equation of the line segment; Solve for the common analytical solution of the parametric equation of the line segment and the corresponding equation of the probe ray, and verify the obtained parameters. Do the constraints meet? : If so, it is determined that the probe ray passes through the tiny local vector line segment, and the coordinates of the common analytical solution are determined as the valid analytical intersection point; If not, the intersection is deemed invalid and no action is taken.
[0015] In conjunction with the first aspect, in one implementation, calculating the geometric measurement width of the object under test at the current skeleton point based on the floating-point coordinates of the effective analytical intersection point specifically includes: Search along the forward region of the probe ray corresponding to the current skeleton point to obtain the corresponding... The positive valid analytical intersection point with the smallest value is taken as the first boundary point, where, This represents a continuous scalar step size parameter extending along the normal direction corresponding to the current skeleton point; Search along the reverse region of the probe ray corresponding to the current skeleton point to obtain the corresponding... The reverse valid analytical intersection point with the smallest absolute value is taken as the second boundary point; Calculate the double-precision Euclidean distance between the first boundary point and the second boundary point to obtain the geometric measurement width of the object under test at the current skeleton point. Specifically:
[0016] in, This represents the geometric width of the object under test at the current skeleton point. Indicates the first boundary point. Indicates the second boundary point. This indicates the calculation of Euclidean distance.
[0017] Secondly, embodiments of this application provide a ranging device for irregular edges in small targets and defects, the ranging device for irregular edges in small targets and defects comprising: The extraction module is used to acquire the initial edge pixel gradient image of the object under test and extract the single-pixel center skeleton representing the direction of the object under test. The construction module is used to traverse each skeleton point of the single pixel center skeleton and calculate the normal direction corresponding to each skeleton point, and construct a probe ray along the normal direction corresponding to the current skeleton point. The generation module is used to perform non-maximum suppression on the initial edge pixel gradient image, locate local gradient extreme points, and calculate and generate the sub-pixel boundary point set of the object to be tested by combining a one-dimensional parabolic interpolation algorithm. The filtering module is used to filter out local point sets that are in the same set of neighborhoods as the detection ray corresponding to the current skeleton point from the sub-pixel boundary point set based on the spatial acceleration retrieval structure, and connect the adjacent floating point coordinates in the local point set into tiny local vector line segments. The solution module is used to perform a two-dimensional vector equation intersection between the probe ray corresponding to the current skeleton point and the tiny local vector line segment to obtain the effective analytical intersection point between the probe ray corresponding to the current skeleton point and the actual continuous edge; The calculation module is used to calculate the geometric measurement width of the object under test at the current skeleton point based on the floating-point coordinates of the effective analytical intersection point.
[0018] The beneficial effects of the technical solutions provided in this application include: By acquiring the initial edge pixel gradient image of the object under test and extracting the single-pixel central skeleton representing the direction of the object, then traversing each skeleton point of the single-pixel central skeleton and calculating the normal direction corresponding to each skeleton point, a probe ray is constructed along the normal direction corresponding to the current skeleton point. Then, non-maximum suppression is applied to the initial edge pixel gradient image to locate local gradient extrema points, and a sub-pixel boundary point set of the object under test is generated by combining a one-dimensional parabolic interpolation algorithm. Then, based on a spatial acceleration retrieval structure, a local point set that is in the same set of neighborhoods as the probe ray corresponding to the current skeleton point is selected from the sub-pixel boundary point set, and the adjacent floating-point coordinates of the local point set are connected into tiny local vector segments. Then, the probe ray corresponding to the current skeleton point and the tiny local vector segments are intersected by a two-dimensional vector equation to obtain the effective analytical intersection point between the probe ray corresponding to the current skeleton point and the actual continuous edge. Then, based on the floating-point coordinates of the effective analytical intersection point, the geometric measurement width of the object under test at the current skeleton point is calculated. This method can significantly reduce the relative error of small defect detection, has extremely high engineering reliability, and can achieve real-time system response through a spatial acceleration structure. Attached Figure Description
[0019] Figure 1 This is a flowchart illustrating the method for ranging irregular edges in small targets and defects according to this application. Figure 2 This is a schematic diagram of sub-pixel boundary point extraction; Figure 3 A geometrical spatial diagram for finding the intersection of a probe ray and a tiny local vector line segment in two dimensions; Figure 4 This is a schematic diagram of the functional modules of the device for measuring irregular edges in small targets and defects according to this application. Detailed Implementation
[0020] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of the present application.
[0021] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0022] In a first aspect, embodiments of this application provide a method for ranging irregular edges in small targets and defects.
[0023] In one embodiment, reference is made to Figure 1 , Figure 1 This is a flowchart illustrating the method for ranging irregular edges in small targets and defects according to this application. Figure 1 As shown, the methods for ranging irregular edges in small targets and defects include: S1: Obtain the initial edge pixel gradient image of the object under test, and extract the single-pixel center skeleton representing the direction of the object under test; S2: Traverse each skeleton point of the single pixel center skeleton and calculate the normal direction corresponding to each skeleton point, and construct a probe ray along the normal direction corresponding to the current skeleton point. S3: Perform non-maximum suppression on the initial edge pixel gradient image, locate local gradient extreme points, and calculate and generate the sub-pixel boundary point set of the object to be tested by combining a one-dimensional parabolic interpolation algorithm. S4: Based on the spatial acceleration retrieval structure, select a set of local points that are in the same set of neighborhoods as the detection ray corresponding to the current skeleton point from the set of sub-pixel boundary points, and connect the adjacent floating point coordinates in the set of local points into tiny local vector line segments. S5: Perform a two-dimensional vector equation intersection between the probe ray corresponding to the current skeleton point and the tiny local vector line segment to obtain the effective analytical intersection point between the probe ray corresponding to the current skeleton point and the actual continuous edge; S6: Calculate the geometric measurement width of the object under test at the current skeleton point based on the floating-point coordinates of the effective analytical intersection point.
[0024] Furthermore, in one embodiment, traversing each skeleton point of the single-pixel central skeleton and calculating the normal direction corresponding to each skeleton point, and constructing a probe ray along the normal direction corresponding to the current skeleton point, specifically includes: S201: Traverse each skeleton point on the central skeleton of the single pixel and calculate the local tangent direction of each skeleton point; S202: Based on the local tangent direction of the current skeleton point, obtain the normal direction corresponding to the current skeleton point, and construct the probe ray along the normal direction corresponding to the current skeleton point.
[0025] Specifically, the process iterates through each skeleton point on the central skeleton of a single pixel, calculates the local tangent direction of the current skeleton point, and solves for the corresponding normal direction based on this. This is then used to construct a probe ray along this normal direction. The equation for the probe ray is specifically expressed as:
[0026] in, This indicates the probe ray corresponding to the current skeleton point. Indicates the coordinates of the current skeleton point. This represents a continuous scalar step size parameter extending along the normal direction corresponding to the current skeleton point. This represents the unit normal vector calculated based on the local tangent direction of the current skeleton point.
[0027] Furthermore, in one embodiment, non-maximum suppression is performed on the initial edge pixel gradient image to locate local gradient extrema points, and a sub-pixel boundary point set of the object to be tested is calculated using a one-dimensional parabolic interpolation algorithm. Specifically, this includes: S301: Perform non-maximum suppression on the initial edge pixel gradient image to locate local gradient extrema. S302: The one-dimensional parabolic interpolation algorithm is used to calculate the continuous sub-pixel offset of the local gradient extreme point in the gradient direction, and then the sub-pixel boundary point set of the object to be tested is extracted; the sub-pixel boundary point set is an ordered set of double-precision floating-point coordinates sorted by the topology of the connected components.
[0028] Specifically, non-maximum suppression is performed on the initial edge pixel gradient image to locate local gradient extrema. Then, a one-dimensional parabolic interpolation algorithm is used to calculate the continuous sub-pixel offset of the local gradient extrema in the gradient direction, thereby extracting and generating the sub-pixel boundary point set of the object under test.
[0029] Among them, see Figure 2 As shown, a one-dimensional parabolic interpolation algorithm is used to calculate the continuous sub-pixel offset of the local gradient extremum point in the gradient direction, specifically including: S3021: Find the integer pixel point with the largest local gradient in the gradient direction of the initial edge pixel gradient image, and obtain the coordinates and gradient magnitude of the integer pixel point; S3022: Obtain the gradient magnitude of the adjacent pixels before and after the integer pixel along the gradient direction; that is, find the integer pixel with the largest local gradient along the gradient direction of the initial edge pixel gradient image, and let its coordinates be... The gradient magnitude is The gradient magnitudes of adjacent pixels before and after it along the gradient direction are respectively and ; S3023: Calculates subpixel offset based on the extreme value differentiation formula. Specifically:
[0030] in, Indicates subpixel offset. This represents the gradient magnitude of the neighboring pixels preceding the integer pixel along the gradient direction. This represents the gradient magnitude of the adjacent pixels following the gradient direction from the integer pixel. Represents the gradient magnitude at integer pixel points; S3024: The calculated sub-pixel offsets are superimposed onto the coordinates of the integer pixel along the corresponding gradient direction vector, thus obtaining the double-precision floating-point sub-pixel boundary point coordinates representing the true physical location. In other words, the sub-pixel offsets... Superimposed along the corresponding gradient direction vector to integer pixel coordinates This allows for the calculation and storage of double-precision floating-point subpixel boundary point coordinates representing the actual physical location.
[0031] Furthermore, in one embodiment, the spatial acceleration retrieval structure is a K-dimensional tree or an R-tree.
[0032] When the spatial acceleration retrieval structure is a K-dimensional tree, the step of filtering out a set of local points within the same defined neighborhood as the probe ray corresponding to the current skeleton point from the sub-pixel boundary point set based on the spatial acceleration retrieval structure specifically includes: S401: Construct a K-dimensional tree index containing the coordinates of all sub-pixel boundary points; S402: Construct a circular space with the current skeleton point as the center and the preset maximum distance measurement error threshold as the radius; S403: Retrieve all local boundary points within the neighborhood of the constructed circular space using a K-dimensional tree index, generating a local point set. In other words, quickly retrieve all local boundary points within the neighborhood of the constructed circular space using a K-dimensional tree index as a local point set.
[0033] Furthermore, in one embodiment, the intersection of the probe ray corresponding to the current skeleton point and the tiny local vector line segment is calculated using a two-dimensional vector equation to obtain the effective analytical intersection point between the probe ray corresponding to the current skeleton point and the actual continuous edge, specifically including: S501: Obtain the two ordered endpoints of the tiny local vector line segment, respectively... and Establish by parameters Parametric equations of line segments ,in, Represent the parametric equation of the line segment; S502: Solve for the common analytical solution of the parametric equation of the line segment and the corresponding equation of the probe ray, and verify the obtained parameters. Do the constraints meet? : If so, it is determined that the probe ray passes through the tiny local vector line segment, and the coordinates of the common analytical solution are determined as the valid analytical intersection point; If not, the intersection is deemed invalid and no action is taken.
[0034] For details, see Figure 3 As shown, let the two ordered endpoints of the tiny local vector line segment be... and Establish by parameters Parametric equations of line segments Solve the parametric equations of the line segment and the equations of the probe ray. Find the common analytical solution and verify the parameters obtained from the solution. Do the preset constraints meet? If the condition is met, it is determined that the probe ray has truly passed through the tiny local vector line segment, and the coordinates of the intersection point are recorded.
[0035] Furthermore, in one embodiment, the geometric measurement width of the object under test at the current skeleton point is calculated based on the floating-point coordinates of the effective analytical intersection point, specifically including: S601: Search along the positive direction region of the detection ray corresponding to the current skeleton point to obtain the corresponding... The positive valid analytical intersection point with the smallest value is taken as the first boundary point, where, This represents a continuous scalar step size parameter extending along the normal direction corresponding to the current skeleton point; S602: Search along the reverse region of the probe ray corresponding to the current skeleton point to obtain the corresponding... The reverse valid analytical intersection point with the smallest absolute value is taken as the second boundary point; S603: Calculate the double-precision Euclidean distance between the first boundary point and the second boundary point to obtain the geometric measurement width of the object under test at the current skeleton point. Specifically:
[0036] in, This represents the geometric width of the object under test at the current skeleton point. Indicates the first boundary point. Indicates the second boundary point. This indicates the calculation of Euclidean distance. Specifically, it calculates the double-precision Euclidean distance between the first boundary point and the second boundary point, and uses this distance as the precise physical width corresponding to the current skeleton point.
[0037] The following section provides a detailed explanation of the method for ranging irregular edges in small targets and defects in this application, based on relevant practical application data.
[0038] See Table 1 below, which is a comparison and verification table of the accuracy of different crack ranging algorithms. The physical resolution is 0.05 mm / pixel.
[0039] Table 1
[0040] In Table 1 above, the absolute error is used to demonstrate the algorithm's ability to approximate physical dimensions to their fullest extent. It is defined as: Absolute Error = |Measured Value by This Method - Manually Measured Value|, reflecting the absolute difference between the physical dimensions output by the algorithm and the actual physical dimensions. The smallest scale of the manual measuring instrument is 0.01 mm, indicating that the combination of sub-pixel interpolation and analytical geometric intersection can effectively overcome the physical resolution limitations of pixel grids and achieve accurate distance measurement.
[0041] Relative error is used to demonstrate the accuracy of an algorithm in detecting extremely small defects. It is defined as: Relative error = (Absolute error / Manual measurement value) * 100. It reflects the proportion of measurement error in the total target size. In the detection of microscopic defects, relative error often has a more significant impact than absolute error.
[0042] As can be seen from Table 1 above, when faced with microcracks of 0.060 mm (such as samples 3, 4, 7, and 8), the traditional method, due to the quantization limitation of the pixel grid (only 1.000 or 1.414 pixels can be identified), calculates the physical size as 0.050 mm or 0.071 mm. Although the absolute error is only about 0.010 mm, the relative error rises to 16.67% or even 18.33%, which is an extremely serious misjudgment in structural safety assessment.
[0043] Faced with the same minute defect of 0.060mm, this application accurately locates the floating-point pixel value of 1.180 to 1.240 through low-level sub-pixel interpolation and analytical intersection, thereby calculating the physical width of 0.059mm to 0.062mm. This not only controls the absolute error to 1~2 micrometers (0.001-0.002mm), but more importantly, it compresses the physical relative error to within 3.33%.
[0044] The method for ranging irregular edges in small targets and defects according to embodiments of this application is as follows: (1) It can significantly reduce the relative error of micro-defect detection and has extremely high engineering reliability: The relative error reflects the proportion of measurement error in the overall target size and is a decisive indicator for evaluating the reliability of micro-defect detection. For extremely small targets (such as micro-crack samples 3, 4, 7, and 8 in Table 1 with a real physical width of only 0.060 mm), traditional methods are limited by the integer matching deadlock effect of pixel grid (can only passively identify 1.000 or 1.414 pixels), and the calculated physical size changes abruptly to 0.050 mm or 0.071 mm. Although its absolute surface error is only about 0.010 mm, its relative error is as high as 16.67% or even 18.33%. In practical structural safety assessments, errors of this magnitude can easily lead to serious misjudgments. In contrast, when faced with tiny defects of the same size (0.060 mm), this application can accurately locate floating-point pixel values of 1.180 to 1.240 by using sub-pixel interpolation and two-dimensional analytical intersection pipelines. This allows for the precise calculation of the actual physical width of 0.059 mm to 0.062 mm. This application not only stably suppresses the absolute error to the 1-2 micrometer level, but also substantially reduces the physical relative error to within 3.33%. This fully demonstrates that this application can effectively resist mesh deformation interference when dealing with extremely small and irregular edges, providing extremely accurate and highly reliable engineering measurement data. (2) Real-time system response achieved through spatial acceleration structure: For high-resolution (e.g., 4K level) engineering slice images containing about 1000 central skeleton points and 5000 sub-pixel edge points, the time complexity of the traditional global traversal intersection algorithm is O(M*N), and the time consumption of a single image is extremely long (about 850ms); after introducing a spatial acceleration retrieval structure (e.g., KD-Tree spatial index) in this application, the time complexity is greatly reduced to O(MlogN). Under the same hardware conditions, the time consumption of single image ranging is significantly shortened to about 15ms, and the processing efficiency is improved by tens of times.
[0045] It should be noted that although this application uses microcracks on the surface of concrete structures as a typical small engineering target and defect for detailed implementation and data verification, the edge ranging method based on sub-pixel interpolation and two-dimensional analytical geometry intersection proposed in this application has mathematical universality.
[0046] Furthermore, the objects to be measured in this application, as well as small engineering targets and defects, should not be simply interpreted as limited to building defects. The algorithm described in this application is also applicable to any other machine vision industrial scenario that requires overcoming digital image raster quantization errors and performing high-precision continuous physical edge measurements, such as, but not limited to: precision width measurement of fatigue scratches on the surface of aerospace devices, high-precision measurement of pin spacing in integrated circuits (ICs), and radial measurement of microvessels in medical microscopic imaging. In other words, the technical solution of this application, which connects discrete sub-pixel points into local vector segments and intersects them with normal rays to achieve irregular edge ranging, has universality.
[0047] Secondly, embodiments of this application also provide a ranging device for irregular edges in small targets and defects.
[0048] In one embodiment, reference is made to Figure 4 , Figure 4 This is a schematic diagram of the functional modules of the ranging device for irregular edges in small targets and defects according to this application. Figure 4 As shown, the ranging device for irregular edges in small targets and defects includes: an extraction module, a construction module, a generation module, a filtering module, a solution module, and a calculation module.
[0049] The extraction module is used to acquire the initial edge pixel gradient image of the object under test and extract the single-pixel central skeleton representing the direction of the object under test; the construction module is used to traverse each skeleton point of the single-pixel central skeleton and calculate the normal direction corresponding to each skeleton point, and construct the probe ray along the normal direction corresponding to the current skeleton point; the generation module is used to perform non-maximum suppression on the initial edge pixel gradient image, locate the local gradient extremum points, and calculate and generate the sub-pixel boundary point set of the object under test by combining a one-dimensional parabolic interpolation algorithm; the filtering module is used to filter out the local point set that is in the same set of neighborhoods as the probe ray corresponding to the current skeleton point from the sub-pixel boundary point set based on the spatial acceleration retrieval structure, and connect the adjacent floating-point coordinates of the local point set into a small local vector line segment; the solving module is used to perform two-dimensional vector equation intersection between the probe ray corresponding to the current skeleton point and the small local vector line segment to obtain the effective analytical intersection point between the probe ray corresponding to the current skeleton point and the actual continuous edge; the calculation module is used to calculate the geometric measurement width of the object under test at the current skeleton point based on the floating-point coordinates of the effective analytical intersection point.
[0050] The terms "comprising" and "having," and any variations thereof, in the specification, claims, and accompanying drawings of this application are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to such process, method, product, or apparatus. The terms "first," "second," and "third," etc., are used to distinguish different objects, etc., and do not indicate a sequence, nor do they limit "first," "second," and "third" to different types.
[0051] In the description of the embodiments of this application, terms such as "exemplary," "for example," or "for instance" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "exemplary," "for example," or "for instance" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary," "for example," or "for instance" is intended to present the relevant concepts in a concrete manner.
[0052] In the description of the embodiments of this application, unless otherwise stated, " / " means "or". For example, A / B can mean A or B. The "and / or" in the text is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of this application, "multiple" means two or more.
[0053] In some processes described in the embodiments of this application, multiple operations or steps are included in a specific order. However, it should be understood that these operations or steps may not be executed in the order they appear in the embodiments of this application, or they may be executed in parallel. The sequence number of the operation is only used to distinguish different operations, and the sequence number itself does not represent any execution order. In addition, these processes may include more or fewer operations, and these operations or steps may be executed sequentially or in parallel, and these operations or steps may be combined.
[0054] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions to cause a terminal device to execute the methods described in the various embodiments of this application.
[0055] The above are merely preferred embodiments of this application and do not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A method for ranging irregular edges in small targets and defects, characterized in that, The method for ranging irregular edges in small targets and defects includes: Obtain the initial edge pixel gradient image of the object under test, and extract the single-pixel center skeleton representing the direction of the object under test; Traverse each skeleton point of the single pixel center skeleton and calculate the normal direction corresponding to each skeleton point to construct a probe ray along the normal direction corresponding to the current skeleton point. Non-maximum suppression is performed on the initial edge pixel gradient image to locate local gradient extrema points, and a sub-pixel boundary point set of the object under test is generated by combining a one-dimensional parabolic interpolation algorithm. Based on the spatial acceleration retrieval structure, a local point set that is in the same set of neighborhoods as the detection ray corresponding to the current skeleton point is selected from the sub-pixel boundary point set, and adjacent floating point coordinates in the local point set are connected into tiny local vector line segments. The intersection of the probe ray corresponding to the current skeleton point and the tiny local vector line segment is obtained by performing a two-dimensional vector equation to find the effective analytical intersection point between the probe ray corresponding to the current skeleton point and the actual continuous edge. Based on the floating-point coordinates of the effective analytical intersection points, the geometric measurement width of the object under test at the current skeleton point is calculated.
2. The method for ranging irregular edges in small targets and defects as described in claim 1, characterized in that, The process of traversing each skeleton point of the single-pixel central skeleton and calculating the normal direction corresponding to each skeleton point to construct a probe ray along the normal direction corresponding to the current skeleton point specifically includes: Traverse each skeleton point on the central skeleton of the single pixel and calculate the local tangent direction of each skeleton point; Based on the local tangent direction of the current skeleton point, the normal direction corresponding to the current skeleton point is obtained, and a probe ray along the normal direction corresponding to the current skeleton point is constructed.
3. The method for ranging irregular edges in small targets and defects as described in claim 2, characterized in that, The equation for the probe ray is specifically expressed as follows: in, This indicates the probe ray corresponding to the current skeleton point. Indicates the coordinates of the current skeleton point. This represents a continuous scalar step size parameter extending along the normal direction corresponding to the current skeleton point. This represents the unit normal vector calculated based on the local tangent direction of the current skeleton point.
4. The method for ranging irregular edges in small targets and defects as described in claim 1, characterized in that, The step of performing non-maximum suppression on the initial edge pixel gradient image, locating local gradient extrema, and calculating and generating the sub-pixel boundary point set of the object under test using a one-dimensional parabolic interpolation algorithm specifically includes: Non-maximum suppression is performed on the initial edge pixel gradient image to locate local gradient extrema. A one-dimensional parabolic interpolation algorithm is used to calculate the continuous sub-pixel offset of the local gradient extremum point in the gradient direction, and then the sub-pixel boundary point set of the object under test is extracted. The sub-pixel boundary point set is an ordered set of double-precision floating-point coordinates sorted by the topology of the connected components.
5. The method for ranging irregular edges in small targets and defects as described in claim 4, characterized in that, The calculation of the continuous sub-pixel offset of the local gradient extremum point in the gradient direction using a one-dimensional parabolic interpolation algorithm specifically includes: Find the integer pixel point with the largest local gradient in the gradient direction of the initial edge pixel gradient image, and obtain the coordinates and gradient magnitude of the integer pixel point; Obtain the gradient magnitude of the adjacent pixels before and after the integer pixel along the gradient direction; The sub-pixel offset is calculated based on the extreme value differentiation formula. Specifically: in, Indicates subpixel offset. This represents the gradient magnitude of the neighboring pixels preceding the integer pixel along the gradient direction. This represents the gradient magnitude of the adjacent pixels following the gradient direction at the integer pixel point. Represents the gradient magnitude at integer pixel points; The calculated subpixel offsets are superimposed onto the coordinates of integer pixels along the corresponding gradient direction vectors to obtain the double-precision floating-point subpixel boundary point coordinates representing the real physical location.
6. The method for ranging irregular edges in small targets and defects as described in claim 1, characterized in that, The spatial acceleration retrieval structure is a K-dimensional tree or an R-tree.
7. The method for ranging irregular edges in small targets and defects as described in claim 6, characterized in that, When the spatial acceleration retrieval structure is a K-dimensional tree, the step of filtering out a set of local points within the same defined neighborhood as the probe ray corresponding to the current skeleton point from the sub-pixel boundary point set based on the spatial acceleration retrieval structure specifically includes: Construct a K-dimensional tree index containing the coordinates of all sub-pixel boundary points; A circular space is constructed with the current skeleton point as the center and the preset maximum allowable distance measurement error threshold as the radius; The local point set is generated by retrieving all local boundary points within the neighborhood of the constructed circular space using a K-dimensional tree index.
8. The method for ranging irregular edges in small targets and defects as described in claim 1, characterized in that, The step of intersecting the probe ray corresponding to the current skeleton point with the tiny local vector line segment using a two-dimensional vector equation to obtain the effective analytical intersection point between the probe ray corresponding to the current skeleton point and the actual continuous edge specifically includes: Obtain the two ordered endpoints of the tiny local vector line segment, respectively and Establish by parameters Parametric equations of line segments ,in, Represent the parametric equation of the line segment; Solve for the common analytical solution of the parametric equation of the line segment and the corresponding equation of the probe ray, and verify the obtained parameters. Do the constraints meet? : If so, it is determined that the probe ray passes through the tiny local vector line segment, and the coordinates of the common analytical solution are determined as the valid analytical intersection point; If not, the intersection is deemed invalid and no action is taken.
9. The method for ranging irregular edges in small targets and defects as described in claim 1, characterized in that, The step of calculating the geometric measurement width of the object under test at the current skeleton point based on the floating-point coordinates of the effective analytical intersection points specifically includes: Search along the forward region of the probe ray corresponding to the current skeleton point to obtain the corresponding... The positive valid analytical intersection point with the smallest value is taken as the first boundary point, where, This represents a continuous scalar step size parameter extending along the normal direction corresponding to the current skeleton point; Search along the reverse region of the probe ray corresponding to the current skeleton point to obtain the corresponding... The reverse valid analytical intersection point with the smallest absolute value is taken as the second boundary point; Calculate the double-precision Euclidean distance between the first boundary point and the second boundary point to obtain the geometric measurement width of the object under test at the current skeleton point. Specifically: in, This represents the geometric width of the object under test at the current skeleton point. Indicates the first boundary point. Indicates the second boundary point. This indicates the calculation of Euclidean distance.
10. A device for ranging irregular edges in small targets and defects, characterized in that, The device for ranging irregular edges of small targets and defects includes: The extraction module is used to acquire the initial edge pixel gradient image of the object under test and extract the single-pixel center skeleton representing the direction of the object under test. The construction module is used to traverse each skeleton point of the single pixel center skeleton and calculate the normal direction corresponding to each skeleton point, and construct a probe ray along the normal direction corresponding to the current skeleton point. The generation module is used to perform non-maximum suppression on the initial edge pixel gradient image, locate local gradient extreme points, and calculate and generate the sub-pixel boundary point set of the object to be tested by combining a one-dimensional parabolic interpolation algorithm. The filtering module is used to filter out local point sets that are in the same set of neighborhoods as the detection ray corresponding to the current skeleton point from the sub-pixel boundary point set based on the spatial acceleration retrieval structure, and connect the adjacent floating point coordinates in the local point set into tiny local vector line segments. The solution module is used to perform a two-dimensional vector equation intersection between the probe ray corresponding to the current skeleton point and the tiny local vector line segment to obtain the effective analytical intersection point between the probe ray corresponding to the current skeleton point and the actual continuous edge; The calculation module is used to calculate the geometric measurement width of the object under test at the current skeleton point based on the floating-point coordinates of the effective analytical intersection point.