Hole measurement method and device based on binocular stereo vision, electronic equipment and medium

By acquiring epipolar images of holes using binocular stereo vision technology and performing fitting processing, the problem of low hole measurement efficiency in existing technologies is solved, and efficient and accurate hole measurement is achieved.

CN116091528BActive Publication Date: 2026-07-03ZG TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
ZG TECH CO LTD
Filing Date
2023-02-08
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Existing hole measurement methods have low measurement efficiency, making it difficult to meet the needs of mass production.

Method used

A hole measurement method based on binocular stereo vision is adopted. The first and second epipolar images of the hole are acquired, combined and paired to determine the epipolar image pair of the hole. The three-dimensional edge point coordinates of the hole are determined according to the epipolar image pair. The hole type and size are obtained by fitting the image with the preset target type of hole.

Benefits of technology

It improves the efficiency and accuracy of hole measurement, avoids the shortcomings of contact measurement, and the epipolar line images obtained based on binocular stereo vision technology are more reliable, ensuring the accuracy of measurement results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116091528B_ABST
    Figure CN116091528B_ABST
Patent Text Reader

Abstract

This application discloses a method, apparatus, electronic device, and medium for hole measurement based on binocular stereo vision. On one hand, the method analyzes hole parameters using epipolar images to determine the hole type and size. Since contact measurement is avoided and the time required to acquire the epipolar images of the hole is short, the measurement efficiency is effectively improved. On the other hand, because binocular stereo vision technology has low illumination requirements, the epipolar images of holes acquired using this technology are more reliable, better ensuring the accuracy of the hole measurement results. Furthermore, fitting the coordinates of three-dimensional edge points based on a preset target hole type maximizes the digital characteristics of the epipolar images, improving the accuracy of the final acquired hole type and size information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of industrial measurement technology, and in particular to a hole measurement method, apparatus, electronic device, and medium based on binocular stereo vision. Background Technology

[0002] Holes are common structures in sheet metal parts, castings, etc., used for positioning and connection during assembly. Therefore, the machining accuracy of holes has a significant impact on the quality of finished products.

[0003] However, current common hole measurement methods are mainly contact-based methods such as coordinate measuring machines and articulated arms, whose measurement efficiency is insufficient to meet production efficiency requirements. In other words, current contact-based measurement methods are unable to meet the production needs of large-scale measurement.

[0004] Therefore, existing technologies suffer from low measurement efficiency during hole measurement. Summary of the Invention

[0005] In view of this, it is necessary to provide a hole measurement method, device, electronic device and medium based on binocular stereo vision to solve the problem of low measurement efficiency in the hole measurement process in the prior art.

[0006] To address the above problems, this invention provides a hole measurement method based on binocular stereo vision, comprising:

[0007] Based on binocular stereo vision technology, the first and second core line images of the aperture are acquired;

[0008] The first and second epipolar images are combined and paired to determine the epipolar image pairs of the apertures;

[0009] Based on the epipolar image pairs, determine the three-dimensional edge point coordinates of the borehole;

[0010] The coordinates of three-dimensional edge points are fitted based on the preset target type of hole to obtain the type and size of the hole.

[0011] Furthermore, based on binocular stereo vision technology, the first and second epipolar line images of the aperture are acquired, including:

[0012] The first and second core line images of the aperture are obtained by taking pictures with a binocular camera, wherein the binocular camera includes a first camera and a second camera;

[0013] The first core line image is obtained by capturing the first core line image using the first camera, and the second core line image is obtained by capturing the second core line image using the second core line image.

[0014] Further, the first and second epipolar images are combined and paired to determine the epipolar image pairs of the apertures, including:

[0015] Edge detection is performed on the first and second epipolar images to determine the first and second closed edge curves of the aperture.

[0016] Based on the first closed edge curve and the second closed edge curve, determine the maximum and minimum values ​​of the first edge row direction of the first closed edge curve and the maximum and minimum values ​​of the second edge row direction of the second closed edge curve, respectively.

[0017] The epipolar image pairs of the apertures are determined based on the maximum and minimum values ​​of the first and second edge directions.

[0018] Further, edge detection is performed on the first and second epipolar images to determine the first and second closed edge curves of the aperture, including:

[0019] Based on the subpixel edge algorithm, the first subpixel edge points of the first epipolar image and the second subpixel edge points of the second epipolar image are calculated respectively.

[0020] Based on the first sub-pixel edge point and the second sub-pixel edge point, the first closed edge curve and the second closed edge curve of the hole are determined accordingly.

[0021] Furthermore, based on the epipolar image pairs, the three-dimensional edge point coordinates of the apertures are determined, including:

[0022] Obtain the first principal distance of the first camera, the second principal distance of the second camera, and the coordinates of the corresponding point pairs of the epipolar image pairs;

[0023] Based on the first principal distance, the second principal distance, and the coordinates of corresponding point pairs, the three-dimensional edge point coordinates of the hole are obtained through the principle of perspective imaging.

[0024] Furthermore, the preset target type holes include square holes, round holes, polygonal holes, and arc-shaped holes, wherein the edges of the preset target type holes are all in a closed mode.

[0025] Furthermore, the coordinates of the three-dimensional edge points are fitted based on the preset target type of hole to obtain the type and size of the hole, including:

[0026] Based on the preset target type of hole, multiple matching equations are determined accordingly;

[0027] Substitute the coordinates of the three-dimensional edge points into multiple matching equations to determine the multiple sets of fitting types, fitting sizes and fitting errors corresponding to the holes;

[0028] Determine the fitting type and fitting size corresponding to the minimum fitting error, using the type and size of the hole as the fitting dimensions.

[0029] To address the aforementioned problems, the present invention also provides a hole measurement device based on binocular stereo vision, comprising:

[0030] The epipolar line image acquisition module is used to acquire the first and second epipolar line images of the aperture based on binocular stereo vision technology.

[0031] The epipolar image pair determination module is used to combine and pair the first epipolar image and the second epipolar image to determine the epipolar image pair of the aperture;

[0032] The three-dimensional edge point coordinate determination module is used to determine the three-dimensional edge point coordinates of the borehole based on the epipolar image pair;

[0033] The hole measurement module is used to fit the coordinates of three-dimensional edge points based on a preset target hole type to obtain the hole type and size.

[0034] To address the aforementioned problems, the present invention also provides an electronic device, including a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, it implements the hole measurement method based on binocular stereo vision as described above.

[0035] To address the aforementioned problems, the present invention also provides a storage medium storing computer program instructions, which, when executed by a computer, cause the computer to perform the hole measurement method based on binocular stereo vision as described above.

[0036] The beneficial effects of adopting the above technical solution are as follows: This invention provides a hole measurement method, device, electronic device, and medium based on binocular stereo vision. On the one hand, this method analyzes the parameters of the hole through epipolar images to determine the type and size of the hole. Since contact measurement is avoided and the time required to acquire the epipolar images of the hole is short, the measurement efficiency of the hole can be effectively improved. On the other hand, since binocular stereo vision technology has low illumination requirements, the epipolar images of the hole acquired based on binocular stereo vision technology are more reliable and can better ensure the accuracy of the hole measurement results. Furthermore, fitting the coordinates of three-dimensional edge points based on the preset target type of hole can maximize the digital characteristics of the epipolar images and improve the accuracy of the final acquired hole type and size information. Attached Figure Description

[0037] Figure 1 This is a flowchart illustrating an embodiment of the hole measurement method based on binocular stereo vision provided by the present invention.

[0038] Figure 2 A schematic flowchart illustrating an embodiment of the epipolar image for determining apertures provided by the present invention;

[0039] Figure 3 This is a schematic diagram showing the results of an embodiment of the first and second epipolar image coordinate systems and some aperture parameters provided by the present invention.

[0040] Figure 4 A schematic diagram showing the results of an embodiment of the present invention for determining the three-dimensional edge point coordinates of a hole;

[0041] Figure 5 A flowchart illustrating an embodiment of the present invention for determining the type and size of a hole;

[0042] Figure 6 A schematic diagram of an embodiment of the hole measuring device based on binocular stereo vision provided by the present invention;

[0043] Figure 7 A structural block diagram of an embodiment of the electronic device provided by the present invention. Detailed Implementation

[0044] Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form part of this application and are used together with the embodiments of the present invention to illustrate the principles of the present invention, but are not intended to limit the scope of the present invention.

[0045] Before describing the embodiments, we will first explain binocular stereo vision, perspective imaging, and epipolar imaging:

[0046] Binocular stereo vision is an important form of machine vision. It's based on the principle of parallax and uses imaging devices to acquire two images of an object from different positions. By calculating the positional deviation between corresponding points in the images, it obtains the object's three-dimensional geometric information. Depth measurement based on binocular stereo vision is similar to human eyes. Unlike depth cameras based on Time-of-Flight (TOF) or structured light, it doesn't actively project a light source; it relies entirely on two captured images (color RGB or grayscale) to calculate depth. Therefore, it is sometimes called a passive binocular depth camera.

[0047] Perspective imaging is the material imaging principle of photography, which is essentially the same as the visual principle of the human eye. The design of a camera is a direct imitation of the visual perspective capabilities of the human eye.

[0048] Epipolar imagery is a digital image generated from oblique images based on the geometric relationship of the epipolar lines, arranged along the direction of the epipolar lines (the row direction of the digital image is the direction of the epipolar lines).

[0049] Currently, common hole measurement methods mainly consist of contact-based methods such as coordinate measuring machines (CMMs) and articulated arms, but their measurement efficiency is insufficient to meet production efficiency requirements. Therefore, existing technologies suffer from low measurement efficiency during hole measurement.

[0050] To address the aforementioned problems, this invention provides a method, apparatus, electronic device, and medium for hole measurement based on binocular stereo vision, which will be described in detail below.

[0051] like Figure 1 As shown, Figure 1 A flowchart illustrating an embodiment of the hole measurement method based on binocular stereo vision provided by the present invention includes:

[0052] Step S101: Based on binocular stereo vision technology, acquire the first and second core line images of the aperture.

[0053] Step S102: Combine and pair the first and second nuclear line images to determine the nuclear line image pairs of the apertures.

[0054] Step S103: Determine the three-dimensional edge point coordinates of the borehole based on the epipolar image pair.

[0055] Step S104: Fit the coordinates of the three-dimensional edge points based on the preset target type hole to obtain the hole type and size.

[0056] In this embodiment, firstly, based on binocular stereo vision technology, a first epipolar line image and a second epipolar line image of the hole are acquired; then, the first epipolar line image and the second epipolar line image are combined and paired to determine the epipolar line image pair of the hole; next, based on the epipolar line image pair, the three-dimensional edge point coordinates of the hole are determined; finally, based on a preset target type hole, the three-dimensional edge point coordinates are fitted to obtain the type and size of the hole.

[0057] Understandably, in this embodiment, on the one hand, the parameters of the hole are analyzed using epipolar images to determine the type and size of the hole. Since contact measurement is avoided and the time required to acquire the epipolar images of the hole is short, the measurement efficiency of the hole can be effectively improved. On the other hand, since binocular stereo vision technology has low lighting requirements, the epipolar images of the hole acquired based on binocular stereo vision technology are more reliable and can better ensure the accuracy of the hole measurement results. Furthermore, fitting the coordinates of three-dimensional edge points based on the preset target type of hole can maximize the digital characteristics of the epipolar images and improve the accuracy of the final acquired hole type and size information.

[0058] In a preferred embodiment, in step S101, the binocular stereo vision technology refers to taking pictures of the hole using a binocular camera. In order to obtain the first and second core line images of the hole, the first and second cameras in the binocular camera are numbered or sorted. Then, correspondingly, the first core line image is obtained by taking pictures of the first camera, and the second core line image is obtained by taking pictures of the second core line image.

[0059] Furthermore, since no external light source needs to be actively projected during the acquisition of epipolar line images using binocular stereo vision technology, the accuracy of the first and second epipolar line images of the aperture can be effectively guaranteed.

[0060] In a preferred embodiment, in step S102, in order to determine the epipolar image pairs of the apertures, such as... Figure 2 As shown, Figure 2 A flowchart illustrating an embodiment of the method for determining the epipolar image of the aperture provided by the present invention includes:

[0061] Step S121: Perform edge detection on the first and second epipolar images to determine the first and second closed edge curves of the hole.

[0062] Step S122: Based on the first closed edge curve and the second closed edge curve, determine the maximum and minimum values ​​of the first edge direction of the first closed edge curve and the second edge direction of the second closed edge curve, respectively.

[0063] Step S123: Determine the epipolar image pair of the aperture based on the maximum and minimum values ​​of the first edge row direction and the second edge row direction.

[0064] In this embodiment, firstly, edge detection is performed on the first and second epipolar images to determine the first and second closed edge curves of the aperture; then, based on the first and second closed edge curves, the maximum and minimum values ​​of the first edge direction of the first closed edge curve and the maximum and minimum values ​​of the second edge direction of the second closed edge curve are determined respectively; finally, based on the maximum and minimum values ​​of the first and second edge directions, the epipolar image pair of the aperture is determined.

[0065] In this embodiment, since the aperture is closed, edge detection is performed on the epipolar image to discard the non-closed parts, eliminate external interference, and reduce unnecessary subsequent workload. By processing the data of the first closed edge curve and the second closed edge curve respectively, the maximum and minimum values ​​of the first edge row direction and the second edge row direction are obtained respectively, thereby achieving a preliminary matching of the first closed edge curve and the second closed edge curve. That is, by calculating the maximum and minimum points of the first closed edge curve and the second closed edge curve, the corresponding matching of the first closed edge curve and the second closed edge curve is achieved, thereby determining the epipolar image pair of the aperture.

[0066] In a preferred embodiment, in step S121, in order to determine the first closed edge curve and the second closed edge curve of the hole, during the edge detection process of the first epipolar image and the second epipolar image, non-closed edges are first removed; then, according to the sub-pixel edge algorithm, the first sub-pixel edge point of the first epipolar image and the second sub-pixel edge point of the second epipolar image are calculated respectively; finally, the first closed edge curve and the second closed edge curve of the hole are determined according to the first sub-pixel edge point and the second sub-pixel edge point.

[0067] In order to obtain a smooth closed edge curve, for each remaining point, its gradient value is fitted along the gradient direction within a local window centered on that point, and its gradient maxima are calculated as sub-pixel edge points.

[0068] Specifically, sub-pixel edge calculation methods include:

[0069] For a point p(x, y) on the edge, its gradient direction is d(dx, dy).

[0070] Among them, dx=I(x+1,y)-I(x,y), dy=I(x,y+1)-I(x,y);

[0071] Then normalize d to d = d / ||d||.

[0072] Furthermore, calculate the absolute value of the gradient g(t) at p+td, t∈[-n, -n+1, ​​..., n], and fit the curve using (t, g(t)). Taking the Gaussian function as an example, the Gaussian function model is:

[0073]

[0074] Where A is the gradient magnitude, σ is the standard deviation, and μ is the mean.

[0075] Taking the logarithm of both sides, we get:

[0076]

[0077] remember The linear equations for a, b, and c are as follows:

[0078] lng(t) = at 2 +bt+c

[0079] For each pair (t, g(t)), an equation can be written, and when n≥1, we can obtain...

[0080]

[0081] remember We get Mv = l, v = (MT M) -1 (M T l), The final subpixel edge point is p+μd.

[0082] In this embodiment, subpixel edge calculation is performed on each point in the epipolar image to calculate the subpixel edge position, thereby smoothing the epipolar image and finally obtaining a smooth first closed edge curve and a second closed edge curve.

[0083] In one specific embodiment, edge detection is performed on the epipolar image using the Canny operator.

[0084] In a preferred embodiment, in step S123, the first nuclear line image and the second nuclear line image are matched in order to determine the nuclear line image pair of the aperture.

[0085] Specifically, the matching method is as follows: First, calculate the maximum and minimum values ​​of the row direction for each edge of the first and second epipolar images respectively. Due to the characteristics of epipolar images, the maximum and minimum values ​​of the row direction formed by the same edge in both the first and second epipolar images are equal. Based on this feature, edges whose difference between the maximum and minimum values ​​of the row direction of the first and second epipolar images is less than a preset difference threshold are considered as candidate matching pairs. The preset difference threshold is determined based on actual needs and experience, and can also be adjusted as needed.

[0086] Specifically, to select candidate matching pairs, based on the characteristics of perspective projection, it is known that the image point coordinates of points on the plane, as formed by the first and second epipolar images, satisfy a homogeneous coordinate transformation relationship. That is, a 3×3 homography matrix can be used to represent the relationship between corresponding points at the aperture edges of the first and second epipolar images:

[0087]

[0088] Where y l =y r It can be simply written as y = y l =y r Expanding on this, we get:

[0089]

[0090] From formula (2), we get h 21 x l +h 23 =y(1-h) 22 ),

[0091] If the y-values ​​are equal in the same row, a hole has multiple edge points, i.e., x... l The equation remains true even if the right side of the equation takes different values, so the sum of the values ​​on the right side of the equation and x is the sum of the values ​​on the left side and x.l The value of h is irrelevant. 21 =0.

[0092] The equation still holds true for different rows with different y values, so we have 1-h 22 =0, that is, h 22 =1, and h 23 =0.

[0093] Similarly, the value on the right side of formula (3) does not change with the value on the left side x. l h changes with the changes in y, therefore 31 =0,h 32 =0,h 33 =1.

[0094] The only remaining unknown is h. 11 h 12 and h 13 For each candidate matching edge pair, use multiple sets of x l x r Solve for y using least squares.

[0095] After calculation, the error v = x is obtained by comparing corresponding points. r -(h 11 x l +h 12 y+h 13 The matching error of candidate matching edge pairs in the first and second epipolar images is used to delete matching pairs whose error exceeds the preset corresponding point comparison error threshold.

[0096] In this embodiment, by comparing the relationship of corresponding points and using the corresponding point comparison error as the judgment basis and the preset corresponding point comparison error threshold as the judgment benchmark, the matching results of the epipolar image pairs of the hole are further compared to improve the accuracy of the final hole measurement results.

[0097] In a preferred embodiment, in step S103, after determining the epipolar image pair, in order to determine the three-dimensional edge point coordinates of the hole, it is first necessary to obtain the first principal distance of the first camera, the second principal distance of the second camera, and the coordinates of the corresponding point pairs of the epipolar image pair as initial data; then, based on the first principal distance, the second principal distance, and the coordinates of the corresponding point pairs, the three-dimensional edge point coordinates of the hole are obtained through the perspective imaging principle.

[0098] In one specific embodiment, to clearly represent the first and second epipolar images and some parameters of the aperture, such as... Figure 3 As shown, Figure 3This is a schematic diagram of an embodiment of the coordinate system and partial aperture parameters of the first and second epipolar images provided by the present invention. In this embodiment, the maximum value of the edge of the first epipolar image along the row direction is ymaxl and the minimum value is yminl, and the maximum value of the edge of the second epipolar image along the row direction is ymaxr and the minimum value is yminr.

[0099] In one embodiment, when abs(ymaxl-ymaxr) is less than a preset extreme value deviation threshold and abs(yminl-yminr) is less than a preset extreme value deviation threshold, then the two edges in the first epipolar image and the second epipolar image constitute a pair of candidate matching edges.

[0100] Furthermore, for a pair of candidate matching edges, it is also necessary to determine their corresponding points. Along the same row yl = yr, the edge point that is crossed for the i-th time from left to right is considered a pair of points with the same name. For example, the point (xl1, yl) in the left figure and the point (xr1, yr) in the right figure are a pair of points with the same name, and (xl2, yl) and the point (xr2, yr) in the right figure are a pair of points with the same name.

[0101] h is obtained through formula (2) 21 x l +h 23 =y(1-h) 22 ), where y = yl = yr, x l It can take either xl1 or xl2, therefore, h 21 The value should be 0 to ensure that x l The formula holds true for all different values.

[0102] h was calculated 11 h 12 h 13 Then, for any point pl(x) on the left image edge l y l For each of these, its corresponding point pr(x) on the right image can be calculated. r =h 11 x l +h 12 y l +h 13 y r =y l ).

[0103] Finally, in order to determine the coordinates of its three-dimensional edge points, such as Figure 4 As shown, Figure 4 This is a schematic diagram illustrating the results of an embodiment of the present invention for determining the three-dimensional edge point coordinates of an aperture. Assuming the first camera image space coordinate system after epipolar correction is used as the world coordinate system, a point P(X, Y, Z) on the aperture edge is imaged as point p1(x, y, Z) on the first and second epipolar images. ly l ), pr(x r y r The image points (x, y) are located in the same row as the first and second epipolar images, respectively; that is, the principal point of the first camera image (x) 0l y 0l The second camera image principal point (x) 0r y 0r ) are in the same row, major distance f l and f r equal.

[0104] Among them, f l Corresponding to the principal distance of the first camera, f r Corresponding to the principal distance of the second camera, the distance from the center of the objective lens to the film surface is called the principal distance of the camera.

[0105] In one specific embodiment, (x 0l y 0l ), (x 0r y 0r ), f l f r , (x l y l ), (x r y r All of these are known quantities, and according to the principle of perspective imaging, we can obtain...

[0106]

[0107]

[0108] Equations (2) and (4) are equivalent. Let f be an expression. l =f r =f, rearranged to

[0109] fX-(x l -x 0l Z = 0

[0110] fY-(y l -y 0l Z = 0

[0111] fX-(x r -x 0r Z = fB

[0112] Solving

[0113]

[0114]

[0115]

[0116] For all points on the edge of the first epipolar image, their three-dimensional coordinates can be calculated using the above method, denoted as edge E = {P1, P2, ..., Pm}, where m is the number of points, and the center of set E is denoted as CT. PCA is used to calculate the normal n and the two directions major and minor perpendicular to the normal of edge E. The points in E are projected onto a plane centered at CT with normal n, resulting in a two-dimensional edge set e = {p1, p2, ..., pm}. The projection calculation method is as follows:

[0117]

[0118] pi(u i ,v i )∈e,P i ∈E, i=1,2,…,m.

[0119] In this embodiment, by matching points on the first and second epipolar images and combining the principle of perspective imaging, the coordinates of the three-dimensional edge points corresponding to each point are determined.

[0120] In a preferred embodiment, in step S104, since this application mainly targets closed holes, the preset target type holes include square holes, circular holes, polygonal holes and arc-shaped holes, wherein the edges of the preset target type holes are all closed.

[0121] In other embodiments, the parameters of the preset target type hole can be set according to actual needs, such as: pentagonal star hole, flower-shaped hole, etc.

[0122] Furthermore, in order to determine the type and size of the hole, such as Figure 5 As shown, Figure 5 A flowchart illustrating an embodiment of the present invention for determining the type and size of a hole includes:

[0123] Step S141: Determine multiple matching equations according to the preset target type of hole.

[0124] Step S142: Substitute the coordinates of the three-dimensional edge points into multiple matching equations to determine the multiple sets of fitting types, fitting sizes and fitting errors corresponding to the holes.

[0125] Step S143: Determine the fitting type and fitting size corresponding to the minimum fitting error, which are the type and size of the hole.

[0126] In this embodiment, firstly, multiple matching equations are determined according to the preset target type of hole; then, the coordinates of the three-dimensional edge points are substituted into the multiple matching equations to determine multiple sets of fitting types, fitting sizes and fitting errors corresponding to the hole; finally, the fitting type and fitting size corresponding to the smallest fitting error are determined as the type and size of the hole.

[0127] In this embodiment, by sequentially substituting the coordinates of the three-dimensional edge points into multiple matching equations corresponding to the preset target type of hole, the degree of conformity between the three-dimensional edge point coordinates of the hole and each matching equation is determined. The fitting error parameter is used as the effectiveness of the matching, and the fitting type and fitting size corresponding to the minimum fitting error are determined as the type and size of the hole.

[0128] In one specific embodiment, a fitting error threshold can also be set. When the fitting error obtained from the data is less than the fitting error threshold, the final hole type and size are determined to be the fitting type and fitting size corresponding to the fitting error.

[0129] In one specific embodiment, assuming that edge e is the edge of the circular hole, the center of the circle is (u0, v0), and the radius is r, then, for each point pi within e, based on the circular hole matching equation:

[0130] (u i -u0) 2 +(v i -v0) 2 =r 2

[0131] Expanded to:

[0132] -2u i u0-2v i v0+u0 2 +v0 2 -r 2 =--u i 2 -v i 2

[0133] Let c = u0 2 +v0 2 -r 2 ,have to:

[0134]

[0135] remember:

[0136]

[0137]

[0138]

[0139] We can find that: x = (M) T M) -1 (M T l),

[0140] The center coordinates are: CT+u0·major+v0·minor.

[0141] Furthermore, to determine the validity of the fitting results, the fitting error rms of the fitted circle with edge e is set as:

[0142]

[0143] In one specific embodiment, the upper limit of rms is set to 0.15 mm, that is, when rms is greater than 0.15 mm, the fitting process is determined to be invalid.

[0144] In other embodiments, when multiple RMS values ​​meet the upper limit of RMS, the fitting type and fitting size corresponding to the smallest fitting error RMS are taken as the type and size of the hole.

[0145] The above methods achieve the following: First, by analyzing the parameters of the boreholes using epipolar images, the type and size of the boreholes can be determined. This avoids contact measurement and reduces the time required to acquire epipolar images, thus effectively improving the measurement efficiency. Second, because binocular stereo vision technology has low lighting requirements, the epipolar images of boreholes acquired using this technology are more reliable, ensuring better accuracy of the measurement results. Furthermore, fitting the coordinates of three-dimensional edge points based on a preset target type of borehole maximizes the digital characteristics of the epipolar images, improving the accuracy of the final acquired information on the type and size of the boreholes.

[0146] To address the aforementioned problems, the present invention also provides a hole measurement device based on binocular stereo vision, such as... Figure 6 As shown, Figure 6 This is a schematic diagram of an embodiment of the hole measuring device based on binocular stereo vision provided by the present invention. The hole measuring device 600 based on binocular stereo vision includes:

[0147] The epipolar line image acquisition module 601 is used to acquire the first epipolar line image and the second epipolar line image of the aperture based on binocular stereo vision technology.

[0148] The epipolar image pair determination module 602 is used to combine and pair the first epipolar image and the second epipolar image to determine the epipolar image pair of the aperture;

[0149] The three-dimensional edge point coordinate determination module 603 is used to determine the three-dimensional edge point coordinates of the hole based on the epipolar image pair;

[0150] The hole measurement module 604 is used to fit the coordinates of three-dimensional edge points based on a preset target type hole to obtain the hole type and size.

[0151] The present invention also provides an electronic device, such as... Figure 7 As shown, Figure 7 This is a structural block diagram of an embodiment of the electronic device provided by the present invention. The electronic device 700 can be a computing device such as a mobile terminal, desktop computer, laptop, handheld computer, and server. The electronic device 700 includes a processor 701 and a memory 702, wherein the memory 702 stores a hole measurement program 703 based on binocular stereo vision.

[0152] In some embodiments, memory 702 may be an internal storage unit of a computer device, such as a hard disk or memory. In other embodiments, memory 702 may be an external storage device of a computer device, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc. Further, memory 702 may include both internal and external storage units of the computer device. Memory 702 is used to store application software and various types of data installed on the computer device, such as program code for installing the computer device. Memory 702 can also be used to temporarily store data that has been output or will be output. In one embodiment, a binocular stereo vision-based hole measurement program 703 may be executed by processor 701 to implement the binocular stereo vision-based hole measurement method of the various embodiments of the present invention.

[0153] In some embodiments, processor 701 may be a central processing unit (CPU), microprocessor, or other data processing chip, used to run program code stored in memory 702 or process data, such as executing a hole measurement program based on binocular stereo vision.

[0154] This embodiment also provides a computer-readable storage medium storing a hole measurement program based on binocular stereo vision. When the computer processor executes the program, it implements the hole measurement method based on binocular stereo vision as described in any of the above technical solutions.

[0155] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, database, or other storage media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM), etc.

[0156] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.

Claims

1. A hole measuring method based on binocular stereo vision, characterized in that, include: Based on binocular stereo vision technology, the first and second core line images of the aperture are acquired; The process of combining and pairing the first epipolar image and the second epipolar image to determine the epipolar image pair of the aperture includes: calculating the first sub-pixel edge point of the first epipolar image and the second sub-pixel edge point of the second epipolar image according to a sub-pixel edge algorithm; determining the first closed edge curve and the second closed edge curve of the aperture according to the first sub-pixel edge point and the second sub-pixel edge point; determining the first edge row direction maximum and minimum value of the first closed edge curve and the second edge row direction maximum and minimum value of the second closed edge curve according to the first edge row direction maximum and minimum value of the second edge row direction; and determining the epipolar image pair of the aperture according to the first edge row direction maximum and minimum value and the second edge row direction maximum and minimum value. Based on the epipolar image pair, determine the three-dimensional edge point coordinates of the aperture; The coordinates of the three-dimensional edge points are fitted based on the preset target type hole to obtain the type and size of the hole.

2. The bore measurement method based on binocular stereo vision according to claim 1, characterized in that, Based on binocular stereo vision technology, the first and second epipolar line images of the aperture are acquired, including: The first and second core line images of the aperture are obtained by capturing images with a binocular camera, wherein the binocular camera includes a first camera and a second camera; The first core line image is obtained by capturing the first core line image using the first camera, and the second core line image is obtained by capturing the second core line image using the second core line image.

3. The hole measurement method based on binocular stereo vision according to claim 2, characterized in that, Based on the epipolar image pair, the three-dimensional edge point coordinates of the aperture are determined, including: Obtain the first principal distance of the first camera, the second principal distance of the second camera, and the coordinates of the corresponding point pairs of the epipolar image pair; Based on the first principal distance, the second principal distance, and the coordinates of the corresponding point pairs, the three-dimensional edge point coordinates of the hole are obtained through the principle of perspective imaging.

4. The hole measurement method based on binocular stereo vision according to claim 1, characterized in that, The preset target type holes include square holes, circular holes, polygonal holes, and arc-shaped holes, wherein the edges of the preset target type holes are all closed.

5. The hole measurement method based on binocular stereo vision according to claim 4, characterized in that... The coordinates of the three-dimensional edge points are fitted based on a preset target type hole to obtain the type and size of the hole, including: Based on the preset target type of hole, multiple matching equations are determined accordingly; Substitute the coordinates of the three-dimensional edge points into the multiple matching equations to determine the multiple sets of fitting types, fitting sizes and fitting errors corresponding to the holes; The fitting type and fitting size corresponding to the minimum fitting error are determined as the type and size of the hole.

6. A hole measuring device based on binocular stereo vision, characterized in that, include: The epipolar line image acquisition module is used to acquire the first and second epipolar line images of the aperture based on binocular stereo vision technology. An epipolar image pair determination module is used to combine and pair the first epipolar image and the second epipolar image to determine the epipolar image pair of the aperture, including: calculating the first sub-pixel edge point of the first epipolar image and the second sub-pixel edge point of the second epipolar image according to a sub-pixel edge algorithm; determining the first closed edge curve and the second closed edge curve of the aperture according to the first sub-pixel edge point and the second sub-pixel edge point; determining the first edge row direction maximum and minimum value of the first closed edge curve and the second edge row direction maximum and minimum value of the second closed edge curve according to the first edge row direction maximum and minimum value; and determining the epipolar image pair of the aperture according to the first edge row direction maximum and minimum value and the second edge row direction maximum and minimum value. A three-dimensional edge point coordinate determination module is used to determine the three-dimensional edge point coordinates of the hole based on the epipolar image pair; The hole measurement module is used to fit the coordinates of the three-dimensional edge points based on a preset target type hole to obtain the type and size of the hole.

7. An electronic device, characterized in that, It includes a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, it implements the hole measurement method based on binocular stereo vision as described in any one of claims 1-5.

8. A storage medium, characterized in that, The storage medium stores computer program instructions, which, when executed by a computer, cause the computer to perform the hole measurement method based on binocular stereo vision as described in any one of claims 1 to 5.