Three-dimensional shape measurement method of metal materials based on stereo vision and model recovery

By using color structured light dot matrix projection and model recovery technology in binocular stereoscopic vision imaging system, the problem of inaccurate stereoscopic matching relationship in the measurement of reflective objects is solved, and high-precision three-dimensional morphological measurement is achieved, which significantly improves measurement efficiency and accuracy.

CN115265407BActive Publication Date: 2025-03-18CHINA UNIV OF PETROLEUM (EAST CHINA)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210893547.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-27
Publication Date
2025-03-18
Estimated Expiration
2042-07-27

AI Technical Summary

Technical Problem

When measuring reflective objects, existing stereo vision measurement methods are difficult to establish an accurate stereo matching relationship between the two camera views, resulting in insufficient reconstruction accuracy and resolution.

Method used

Using a three-dimensional morphological measurement method based on stereo vision and model recovery, a high-precision three-dimensional measurement of the reflective surface is achieved by building a binocular stereo vision imaging system, using color structured light dot matrix projection, combined with floating glass materials checkerboard calibration, polar line correction, slope difference threshold segmentation, area constraint corrosion, stripe fitting and model recovery technologies.

Benefits of technology

It realizes efficient and accurate three-dimensional morphology measurement of metal reflective surfaces, overcomes the problems of insufficient reconstruction resolution and low stereo matching efficiency in traditional methods, and significantly improves the calculation speed and accuracy of measuring reflective objects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115265407B_ABST
    Figure CN115265407B_ABST
Patent Text Reader

Abstract

The present invention discloses a three-dimensional shape measurement method of metal materials based on stereo vision and model recovery. By projecting colored RGB dot matrix structured light with geometric constraints onto the object to be measured to modulate the light field of the object to be measured, it is easier to perform stereo matching on the object to be measured without texture or with less texture. Projection points are extracted from the collected image by using a threshold segmentation method based on slope difference and regional constraint corrosion. The regional constraint corrosion can effectively solve the problem of projection point adhesion caused by insufficient projector resolution and camera imaging resolution. A line clustering stereo matching method is used for coarse stereo matching. Accurate stereo matching is performed based on the structured light dot matrix with geometric constraints. A model recovery method is used to restore and constrain the dot matrix that cannot be imaged. The three-dimensional world coordinates of the object to be measured are solved by a space vector method, and finally the measurement of a high-precision metal block is completed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of optical measurement, and in particular relates to a three-dimensional shape measurement method of metal materials based on stereoscopic vision and model recovery. Background Art

[0002] Active stereo vision is a non-contact 3D measurement method that realizes stereo matching and 3D reconstruction by calculating the same-name points in the two images of the left and right cameras. It is a very important technology in other industrial fields such as optical morphology measurement and free-form surface measurement. At present, many commercial stereo sensors use the stereo vision method of speckle projection. The light field can be modulated by projecting laser speckles on the surface of the object to be measured, and the same-name matching points in the two views are calculated by epipolar constraints to obtain the stereo matching relationship. Although it has a high reconstruction resolution and the ability to resist ambient light interference, its matching accuracy and efficiency are low, which fundamentally limits the reconstruction accuracy of speckle projection. The fringe projection method can establish higher reconstruction accuracy and resolution than speckle projection because of its continuous pixel distribution. However, when this method measures reflective objects, it is difficult to establish an accurate stereo matching relationship between the two camera views, which easily causes phase discontinuity. On this basis, the proposed stereo vision measurement method of color dot matrix structured light projection can effectively solve the problems of insufficient reconstruction resolution and low stereo matching efficiency. The color structured light projection stereo vision measurement method usually uses a dual camera to form a binocular imaging system. The projector projects a pre-designed structured light dot pattern onto the object to be measured, and then the binocular camera collects images of the object to be measured modulated by the structured light pattern. The three-dimensional information of the object to be measured is obtained through the proposed three-dimensional reconstruction method. However, the problem of using stereo vision to measure reflective objects has not been widely discussed. The usual method to solve the measurement of reflective objects is to change the exposure time or use the polarization method. It is an ideal measurement method to complete the measurement of reflective objects without changing the hardware system parameters. In order to achieve this measurement, we propose a new three-dimensional measurement method to maximize the advantages of stereo matching and color structured light, and make it a mature measurement method for reflective surfaces. Summary of the invention

[0003] The purpose of the present invention is to provide a method with high efficiency and high precision capable of measuring the reflective surface of metal materials, which mainly utilizes a measurement method using color structured light dot matrix projection under a binocular measurement system.

[0004] In order to achieve the purpose of the invention, the technical solution provided by the present invention is:

[0005] A three-dimensional shape measurement method of metal materials based on stereo vision and model recovery includes the following steps: building a binocular stereo vision imaging system, including a binocular imaging module, a structured light projection module 4, and an equipment fixing module; the structured light projection module includes a digital projector 4; the binocular imaging module includes a left camera 2 and a right camera 3; the equipment fixing module includes a left camera fixing plate 5 for fixing the left camera 2, a right camera fixing plate 6 for fixing the right camera 3, a left fixing frame 7 for fixing the structured light projection module 4, and a right fixing frame 8;

[0006] The structured light projection module 4 projects a pre-designed structured light dot matrix with geometric constraints onto the surface of the object 1. The binocular imaging module synchronously collects the object 1 modulated by the structured light dot matrix and performs three-dimensional reconstruction. The steps of three-dimensional reconstruction are as follows:

[0007] Step S1, calibrating the binocular imaging module using a chessboard made of float glass to obtain the intrinsic and extrinsic parameters of the left and right cameras respectively;

[0008] Step S2, performing epipolar correction on the captured left and right perspective images by using the calibrated intrinsic and extrinsic parameters, so as to make subsequent stereo matching and 3D world coordinates more accurate;

[0009] Step S3, using the slope difference threshold segmentation method to segment the image in the HSV domain of the collected image, obtaining all the projected RGB points, and using the region constrained erosion to perform morphological processing on the segmented RGB points to separate the adhered segmentation points, and calculate the coordinates of all the RGB points;

[0010] Step S4, after obtaining the coordinates of all RGB points, perform stripe fitting on the central red point located on the same vertical line. The mean vertical coordinate of the central red point inside the same stripe can be calculated through the fitted stripes. The mean vertical coordinate of the central red point of the two stripes before and after is also calculated. The deviation of the vertical coordinate of the central red point in the same stripe and the deviation of the horizontal coordinate of the central red point of the two stripes before and after are calculated. The Huber penalty scoring mechanism is used to constrain the loss of the central red point.

[0011] Step S5, marking all fitted stripes and obtaining the coordinates of the centroid points, calculating the average value of the horizontal coordinate differences of all adjacent stripes, and clustering them into the same category if the horizontal coordinate difference of the adjacent stripes currently marked is less than the clustering threshold. Finally, after all stripes of the left and right images are clustered, the left and right images are roughly matched according to the clustering results, and the Euclidean distance is calculated as the search distance for the rough match;

[0012] Step S6: Since the coordinates of the reflective part cannot be correctly extracted, the segmented RGB points are restored and corrected using a model recovery method. The projected central red point is used as the basis for model recovery. The green points, blue points, and red points around the central red point are used as basic sub-arrays. The model is restored based on the number and position consistency of the green points, blue points, and red points in the sub-arrays.

[0013] Step S7, according to the prior rough matching relationship and the model recovery result, the rough matching results of the central red points in the left and right images are matched accurately based on the structured photon array;

[0014] Step S8, obtain the three-dimensional coordinates of the stereo matching results, through the linear propagation equation of the spatial light path, take the coordinate points of the same matching relationship in the left and right images as the starting points of the two spatial rays, and solve the minimum value of the intersection of the two rays in space, which is the three-dimensional world coordinates of the object being measured.

[0015] The preferred technical solution provided by the present invention is:

[0016] The step S1 also includes step S101. In step S101, a projected structured light pattern is generated by tiling the dot matrix structured photon array image. The resolution of the pattern is consistent with the resolution of the projector. A single structured light pattern is projected onto the surface of the object to be measured. The left and right cameras synchronously capture and obtain a left-view image and a right-view image.

[0017] The further preferred technical solution provided by the present invention is:

[0018] The calibration in step S1 uses a checkerboard pattern of float glass material. The calibration process uses Zhang Zhengyou's calibration method. The pixel coordinate system and the world coordinate system have the following mapping relationship:

[0019]

[0020] Among them, X u is the horizontal coordinate in the pixel coordinate system, X v is the ordinate in the pixel coordinate system, X W , Y W , Z W , is the world coordinate of the object being measured, P In is the camera intrinsic parameter matrix, R is the rotation matrix, and T is the translation matrix.

[0021] Another preferred technical solution provided by the present invention is:

[0022] In the step S3, the slope difference threshold segmentation method is specifically used to segment the image in the HSV domain of the collected image:

[0023] Step S301, performing overall contour segmentation on the S domain image in the HSV domain by using the slope difference threshold segmentation method to obtain the ROI region of the object to be tested.

[0024] Step S302, intersecting the ROI area with the image in the H domain and the V domain to filter out background noise;

[0025] Step S303, calculating the histogram distribution in the H domain and the V domain by using the slope difference threshold segmentation method to obtain the clustering relationship of points of different colors;

[0026] Step S304: Obtain projected points of different colors P through clustering relationships r ,P g ,P b .

[0027] The further preferred technical solution provided by the present invention is:

[0028] The specific steps of performing morphological treatment by regional constrained corrosion include:

[0029] Step S311: mark all connected domains after segmentation of the V domain as L i ,i=1,2,…,N,In the subsequent processing, one of the connected domains will be processed separately;

[0030] Step S312, morphological corrosion is applied to one of the connected domains, and the corroded structural element (D) N A square structure with a side length of 1 pixel is used, and the morphological corrosion adopts the following formula:

[0031]

[0032] Step S313, repeating step S312 continuously until the number of connected domains corroded is less than the number of connected domains corroded last time, that is, the following formula is satisfied, then step S312 is stopped:

[0033]

[0034] in, Represents the number of connected domains after the i-th connected domain is eroded k times;

[0035] Step S314, while completing step S313, perform regional constraints on the size of the corroded connected domain. If the area of ​​the current corroded connected domain is larger than the area constraint threshold, continue to repeat steps S312 and S313. If the area of ​​the current corroded connected domain is smaller than the area constraint threshold, the corrosion ends, and all the connected domains that have completed the corrosion are added together to generate a seed image.

[0036] The further preferred technical solution provided by the present invention is:

[0037] In step S4, the specific steps of constraining the loss of the central red dot through the Huber penalty scoring mechanism are:

[0038] The penalty score is compared with the given penalty threshold. If the penalty score is greater than the penalty threshold, the central red dot is restored and constrained. If the penalty score is less than the penalty threshold, the central red dot is not restored and constrained. The Huber penalty score is calculated using the following formula:

[0039] h i =W1·d1+W2·d2

[0040] where h i is the distance error penalty score of the i-th central red dot in the k-th stripe. Its size is determined by the penalty weight and the distance error. The distance error is calculated using the following formula:

[0041]

[0042]

[0043] in represents the horizontal coordinate of the i-th central red point in the k-th stripe, It represents the ordinate of the i-th central red dot in the k-th stripe, L is the number of central red dots in the stripe, and M is the number of stripes.

[0044] The further preferred technical solution provided by the present invention is:

[0045] In step S6, the model restoration method for restoring and correcting the segmented RGB points specifically includes:

[0046] Step S601, first use the least square fitting equation for the red points, calculate the position deviation through the fitted straight line and the red points, if the number of red points is more than the pre-designed number of red points, remove the red points with larger deviations and retain the red points with smaller deviations, the deviation calculation adopts the following formula:

[0047]

[0048] Among them, a1, a2 are the coefficients in the least squares fitting equation, s q is the number of least squares fitted straight line equations, x i ,y i is the coordinates of the point in time when the deviation is calculated;

[0049] Step S602, after the red points are corrected, the same operation as in S5 is repeated for the green points and the blue points in the sub-array in turn. Due to the principle of consistency in the number and position of the green points, the blue points and the red points, the model can be restored.

[0050] The further preferred technical solution provided by the present invention is:

[0051] In step S8, the specific method for obtaining the three-dimensional coordinates of the stereo matching result is:

[0052] Through the linear propagation equation of the spatial light path, the coordinate points of the same matching relationship in the left and right images are taken as the starting points P0 and Q0 of the two spatial rays. The equations of the two rays in space are assumed to be:

[0053]

[0054]

[0055] The distance between points on two rays is found using the following formula:

[0056]

[0057] Solve the minimum value of the intersection of the two rays in space, which is the three-dimensional world coordinates of the object being measured. Therefore, make the above formula equal to 0, and you can get the two parameters k when the two rays intersect. p , k q , that is, satisfying the following formula:

[0058]

[0059]

[0060] Finally, by bringing the parameters back into the ray equation, the three-dimensional coordinates of the object being measured can be obtained.

[0061] Compared with the prior art, the present invention has the following beneficial effects:

[0062] 1. It overcomes the problem of insufficient efficiency in searching for the optimal matching point using only limit constraints. Line clustering coarse stereo matching can effectively and quickly search for the optimal stereo matching point while maintaining the accuracy of stereo matching.

[0063] 2. It makes up for the lack of technology in measuring reflective objects using stereo vision, and can significantly improve the calculation speed and accuracy of measuring reflective objects. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] Figure 1 It is a schematic diagram of the measurement method flow of the present invention;

[0065] Figure 2It is a schematic diagram of the hardware structure of the binocular measurement system of the present invention;

[0066] Figure 3 A schematic diagram of a structured photon array used in the three-dimensional measurement method of the present invention;

[0067] Figure 4 A schematic diagram of model recovery comparison in the three-dimensional measurement method of the present invention;

[0068] Figure 5 Schematic diagram of a method for calculating world coordinates in a three-dimensional measurement method of the present invention;

[0069] Figure 6 This is a graph of the experimental results. DETAILED DESCRIPTION

[0070] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings, and the present invention will be further described in detail in conjunction with a flow chart of the measurement method.

[0071] A method for measuring the three-dimensional shape of metal materials based on stereo vision and model recovery, characterized in that it includes the following steps:

[0072] First, if Figure 2 As shown, a binocular stereoscopic vision imaging system is constructed, including a binocular imaging module, a structured light projection module 4, and an equipment fixing module; the structured light projection module includes a digital projector 4; the binocular imaging module includes a left camera 2 and a right camera 3; the equipment fixing module includes a left camera fixing plate 5 for fixing the left camera 2, a right camera fixing plate 6 for fixing the right camera 3, a left fixing frame 7 for fixing the structured light projection module 4, and a right fixing frame 8;

[0073] The structured light projection module 4 projects a pre-designed structured light dot matrix with geometric constraints onto the surface of the object 1. The binocular imaging module synchronously collects the object 1 modulated by the structured light dot matrix and performs three-dimensional reconstruction. The three-dimensional reconstruction and specific measurement steps are as follows:

[0074] Figure 1 The measurement method of the present invention is shown in the flow chart. Figure 1 The following are explained:

[0075] Step S1, using a chessboard made of float glass to calibrate the binocular imaging module, using Zhang Zhengyou binocular stereo vision calibration tool, to obtain the intrinsic parameters and extrinsic parameters of the left and right cameras respectively, where the pixel coordinate system and the world coordinate system have the following coordinate mapping relationship:

[0076]

[0077] Among them, X uis the horizontal coordinate in the pixel coordinate system, X v is the ordinate in the pixel coordinate system, P In is the camera intrinsic parameter matrix, R is the rotation matrix, and T is the translation matrix.

[0078] Step S101, by Figure 3 The dot matrix structured photon array image shown is tiled to generate a projected structured light pattern. The resolution of the pattern is consistent with the projector resolution. The projector resolution used in the present invention is 1920*1200. By projecting a single structured light pattern onto the surface of the object to be measured, the left and right cameras are synchronously captured to obtain the left and right perspective images.

[0079] Step S2, performing epipolar correction on the captured left and right perspective images through calibrated camera intrinsics and extrinsics, can make subsequent stereo matching and three-dimensional world coordinates more accurate.

[0080] Step S3, using the slope difference threshold segmentation method to segment the image in the HSV domain of the collected image, obtaining all the projected RGB points, and using the region constrained erosion to perform morphological processing on the segmented RGB points to separate the adhered segmentation points, and calculate the coordinates of all the RGB points;

[0081] The slope difference threshold segmentation method is specifically used to segment the image in the HSV domain of the acquired image:

[0082] Step S301, performing overall contour segmentation on the S domain image in the HSV domain by using the slope difference threshold segmentation method to obtain the ROI region of the object to be tested.

[0083] Step S302, intersecting the ROI area with the image in the H domain and the V domain to filter out background noise;

[0084] Step S303, calculating the histogram distribution in the H domain and the V domain by using the slope difference threshold segmentation method to obtain the clustering relationship of points of different colors;

[0085] Step S304: Obtain projected points of different colors P through clustering relationships r ,P g ,P b .

[0086] Since the reconstruction resolution of dot matrix structured light is limited by the resolution of the projector, the projected color dots will appear to be stuck during the segmentation process. At this time, a regional constrained erosion is proposed to perform morphological processing on the segmented color points to separate the stuck segmentation points.

[0087] The specific steps of performing morphological treatment by regional constrained corrosion include:

[0088] Step S311: mark all connected domains after segmentation of the V domain as L i ,i=1,2,…,N,In the subsequent processing, one of the connected domains will be processed separately.

[0089] Step S312, morphological corrosion is applied to one of the connected domains, and the corroded structural element (D) N A square structure with a side length of 1 pixel is used, and the morphological corrosion adopts the following formula:

[0090]

[0091] Step S313, repeating step S312 continuously until the number of connected domains corroded is less than the number of connected domains corroded last time, that is, the following formula is satisfied, then step S312 is stopped:

[0092]

[0093] in, Represents the number of connected domains after the i-th connected domain is eroded k times.

[0094] Step S314, while completing step S313, perform regional constraints on the size of the corroded connected domain. If the area of ​​the current corroded connected domain is larger than the area constraint threshold, continue to repeat steps S312 and S313. If the area of ​​the current corroded connected domain is smaller than the area constraint threshold, the corrosion ends, and all the connected domains that have completed the corrosion are added together to generate a seed image.

[0095] Step S4, after obtaining the coordinates of all RGB points, perform stripe fitting on the central red point located on the same vertical line. The mean vertical coordinate of the central red point inside the same stripe can be calculated through the fitted stripes. The mean vertical coordinate of the central red point of the two stripes before and after is also calculated. The deviation of the vertical coordinate of the central red point in the same stripe and the deviation of the horizontal coordinate of the central red point of the two stripes before and after are calculated. The Huber penalty scoring mechanism is used to constrain the loss of the central red point.

[0096] Specifically, the different color points P obtained by segmentation r ,P g ,P b After intersecting with the eroded seed image, all RGB point coordinates are obtained, and then stripe fitting is performed on the central red point on the same vertical line. k The vertical coordinate mean of the central red point in the same stripe can be calculated, and the vertical coordinate mean of the two stripes L can also be calculated. k-1 ,L k+1 Calculate the mean of the vertical coordinates of the central red point of the same stripe L k The vertical coordinate deviation of the central red dot in the image is different from the two stripes Lk-1 ,L k+1 The horizontal coordinate deviation of the central red point is calculated, and the Huber penalty score mechanism is used to constrain the loss of the central red point. The size of the penalty score is compared with the given penalty threshold. If the penalty score is greater than the penalty threshold, the central red point is restored and constrained. If it is less than the penalty threshold, it is not restored and constrained. The Huber penalty score is calculated using the following formula:

[0097] h i =W1·d1+W2·d2

[0098] where h i is the distance error penalty score of the i-th central red dot in the k-th stripe. Its size is determined by the penalty weight and the distance error. The distance error is calculated using the following formula:

[0099]

[0100]

[0101] in represents the horizontal coordinate of the i-th central red point in the k-th stripe, It represents the ordinate of the i-th central red dot in the k-th stripe, L is the number of central red dots in the stripe, and M is the number of stripes.

[0102] Step S5: Mark all fitted stripes and obtain the centroid coordinates, and calculate the average value d of the horizontal coordinate difference of all adjacent stripes. L , if the horizontal coordinate difference of the adjacent stripes marked currently is less than the clustering threshold t L , cluster them into the same category. If the horizontal coordinate difference of the adjacent stripes marked by the current mark is greater than the clustering threshold t L , it is clustered into the next category, where the clustering threshold is calculated using the following formula:

[0103]

[0104] Among them B L is the distance difference weight, is the horizontal coordinate of the centroid of the ith stripe, is the ordinate of the centroid of the i-th stripe;

[0105] After all stripes in the left and right images are clustered, the left and right images are roughly matched based on the clustering results. Select the right camera view with Cluster images of stripes with the same stripe value And calculate the Euclidean distance as the search distance for rough matching;

[0106] Step S6: Since the coordinates of the reflective part cannot be correctly extracted, the segmented RGB points are restored and corrected using a model recovery method, with the projected central red point as the benchmark for model recovery, and the green points, blue points, and red points around the central red point as the basic sub-arrays;

[0107] The model restoration method for restoring and correcting the segmented RGB points specifically includes:

[0108] Step S601, first use the least square fitting equation for the red points, calculate the position deviation through the fitted straight line and the red points, if the number of red points is more than the pre-designed number of red points, remove the red points with larger deviations and retain the red points with smaller deviations, the deviation calculation adopts the following formula:

[0109]

[0110] Among them, a1, a2 are the coefficients in the least squares fitting equation, s q is the number of least squares fitted straight line equations, x i ,y i is the coordinate of the point at which the deviation is calculated.

[0111] Step S602, after the red points are corrected, the same operation as in S5 is repeated for the green points and the blue points in the sub-array in turn. Due to the principle of consistency in the number and position of the green points, the blue points and the red points, the model can be restored; Figure 4 This is a schematic diagram of model restoration comparison in the three-dimensional measurement method of the present invention. The specific restoration results are as follows: Figure 4 As shown.

[0112] Step S7, based on the prior rough matching relationship and the model recovery result, the center red point in the left and right images is matched with the rough matching result to perform precise stereo matching. The matching process searches for the best match between the horizontal line constrained by the same epipolar line and the rough matching search distance. The process of searching for the best match adopts the following formula:

[0113]

[0114] Among them, c is the stripe of the current cluster, are the horizontal coordinates of the same polar line constraint in the cth stripe in the left and right views, respectively. are the ordinates of the same polar line constraint in the cth stripe in the left and right views respectively, Δx is the minimum step size of iterative optimization, and the process of finding the optimal match is the process of minimizing the above formula.

[0115] Step S8, obtain the three-dimensional coordinates of the stereo matching results, and use the linear propagation equation of the spatial light path to take the coordinate points of the same matching relationship in the left and right images as the starting points P0 and Q0 of the two spatial rays. Suppose the equations of the two rays in space are:

[0116]

[0117]

[0118] The distance between points on two rays is found using the following formula:

[0119]

[0120] Solve the minimum value of the intersection of the two rays in space, which is the three-dimensional world coordinates of the object being measured. Therefore, make the above formula equal to 0, and you can get the two parameters k when the two rays intersect. p , k q , that is, satisfying the following formula:

[0121]

[0122]

[0123] Finally, the parameters are brought back to the ray equation to obtain the three-dimensional coordinates of the object being measured. The principle diagram is as follows Figure 5 shown.

[0124] like Figure 6 As shown, the present invention measures a high-precision metal block with a length of 100 mm ( Figure 6 .1), and further curve characterization comparison was performed on the cross section ( Figure 6 .2).

[0125] The above description of the disclosed embodiments enables professionals in the field to implement or use the present application. The described embodiments are only part of the embodiments of the present application, not all of them. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.

Claims

1. A method for measuring the three-dimensional shape of metal materials based on stereo vision and model recovery, characterized in that: The method comprises the following steps, and constructing a binocular stereoscopic vision imaging system, comprising a binocular imaging module, a structured light projection module (4), and an equipment fixing module; the structured light projection module comprises a digital projector (4); the binocular imaging module comprises a left camera (2) and a right camera (3); the equipment fixing module comprises a left camera fixing plate (5) for fixing the left camera (2), a right camera fixing plate (6) for fixing the right camera (3), a left fixing frame (7) for fixing the structured light projection module (4), and a right fixing frame (8); The structured light projection module (4) projects a pre-designed structured light dot matrix with geometric constraints onto the surface of the object to be measured (1), and the binocular imaging module synchronously collects the object to be measured (1) modulated by the structured light dot matrix and performs three-dimensional reconstruction. The steps of three-dimensional reconstruction are as follows: Step S1, calibrating the binocular imaging module using a chessboard made of float glass to obtain the intrinsic and extrinsic parameters of the left and right cameras respectively; Step S2, performing epipolar correction on the captured left and right perspective images by using the calibrated intrinsic and extrinsic parameters, so as to make subsequent stereo matching and three-dimensional world coordinates more accurate; Step S3, using the slope difference threshold segmentation method to segment the image in the HSV domain of the collected image, obtaining all the projected RGB points, and using the region constrained erosion to perform morphological processing on the segmented RGB points to separate the adhered segmentation points, and calculate the coordinates of all the RGB points; Step S4, after obtaining the coordinates of all RGB points, perform stripe fitting on the central red point located on the same vertical line. The mean vertical coordinate of the central red point inside the same stripe can be calculated through the fitted stripes. The mean vertical coordinate of the central red point of the two stripes before and after is also calculated. The deviation of the vertical coordinate of the central red point in the same stripe and the deviation of the horizontal coordinate of the central red point of the two stripes before and after are calculated. The Huber penalty scoring mechanism is used to constrain the loss of the central red point. The Huber penalty score mechanism is used to constrain the loss of the central red point. The penalty score is compared with the given penalty threshold. If the penalty score is greater than the penalty threshold, the central red point is restored and constrained. If the penalty score is less than the penalty threshold, the central red point is not restored and constrained. The Huber penalty score is calculated using the following formula: h i =W1·d1+W2·d2 where h i is the distance error penalty score of the i-th central red dot in the k-th stripe. Its size is determined by the penalty weight and the distance error. The distance error is calculated using the following formula: in represents the horizontal coordinate of the i-th central red point in the k-th stripe, represents the ordinate of the i-th central red dot in the k-th stripe, L is the number of central red dots in the stripe, and M is the number of stripes; Step S5, marking all fitted stripes and obtaining the coordinates of the centroid points, calculating the average value of the horizontal coordinate differences of all adjacent stripes, and clustering them into the same category if the horizontal coordinate difference of the adjacent stripes currently marked is less than the clustering threshold. Finally, after all stripes of the left and right images are clustered, the left and right images are roughly matched according to the clustering results, and the Euclidean distance is calculated as the search distance for the rough match; Step S6: Since the coordinates of the reflective part cannot be correctly extracted, the segmented RGB points are restored and corrected using a model recovery method. The projected central red point is used as the basis for model recovery. The green points, blue points, and red points around the central red point are used as basic sub-arrays. The model is restored based on the number and position consistency of the green points, blue points, and red points in the sub-arrays. In step S6, the model restoration method for restoring and correcting the segmented RGB points specifically includes: Step S601, first use the least square fitting equation for the red points, calculate the position deviation through the fitted straight line and the red points, if the number of red points is more than the pre-designed number of red points, remove the red points with larger deviations and retain the red points with smaller deviations, the deviation calculation adopts the following formula: Among them, a1, a2 are the coefficients in the least squares fitting equation, s q is the number of least squares fitted straight line equations, x i ,y i is the coordinates of the point in time when the deviation is calculated; Step S602, after the red points are corrected, the same operation as in S5 is repeated for the green points and the blue points in the sub-array in turn. Due to the principle of consistency in the number and position of the green points, the blue points and the red points, the model can be restored; Step S7, according to the prior rough matching relationship and the model recovery result, the rough matching results of the central red points in the left and right images are matched accurately based on the structured photon array; Step S8, obtain the three-dimensional coordinates of the stereo matching results, through the linear propagation equation of the spatial light path, take the coordinate points of the same matching relationship in the left and right images as the starting points of the two spatial rays, and solve the minimum value of the intersection of the two rays in space, which is the three-dimensional world coordinates of the object being measured.

2. The method for measuring the three-dimensional shape of metal materials based on stereo vision and model recovery according to claim 1, characterized in that: The step S1 also includes step S101. In step S101, a projected structured light pattern is generated by tiling the dot matrix structured photon array image. The resolution of the pattern is consistent with the resolution of the projector. A single structured light pattern is projected onto the surface of the object to be measured. The left and right cameras synchronously capture and obtain a left-view image and a right-view image.

3. The method for measuring the three-dimensional shape of metal materials based on stereo vision and model recovery according to claim 1 is characterized in that: The calibration in step S1 uses a checkerboard pattern of float glass material. The calibration process uses Zhang Zhengyou's calibration method. The pixel coordinate system and the world coordinate system have the following mapping relationship: Among them, X u is the horizontal coordinate in the pixel coordinate system, X v is the ordinate in the pixel coordinate system, X W , Y W , Z W , is the world coordinate of the object being measured, P In is the camera intrinsic parameter matrix, R is the rotation matrix, and T is the translation matrix.

4. The method for measuring the three-dimensional shape of metal materials based on stereo vision and model recovery according to claim 1, characterized in that: In the step S3, the slope difference threshold segmentation method is specifically used to segment the image in the HSV domain of the collected image: Step S301, performing overall contour segmentation on the S domain image in the HSV domain by using the slope difference threshold segmentation method to obtain the ROI region of the object to be tested. Step S302, intersecting the ROI area with the image in the H domain and the V domain to filter out background noise; Step S303, calculating the histogram distribution in the H domain and the V domain by using the slope difference threshold segmentation method to obtain the clustering relationship of points of different colors; Step S304: Obtain projected points of different colors P through clustering relationships r ,P g ,P b .

5. The method for measuring the three-dimensional shape of metal materials based on stereo vision and model recovery according to claim 1, characterized in that: In the step S3, the specific steps of performing morphological treatment by regional constrained corrosion include: Step S311: mark all connected domains after segmentation of the V domain as L i ,i=1,2,…,N,In the subsequent processing, one of the connected domains will be processed separately; Step S312, morphological corrosion is applied to one of the connected domains, and the corroded structural element (D) N A square structure with a side length of 1 pixel is used, and the morphological corrosion adopts the following formula: Step S313, repeating step S312 continuously until the number of connected domains corroded is less than the number of connected domains corroded last time, that is, the following formula is satisfied, then step S312 is stopped: in, Represents the number of connected domains after the i-th connected domain is eroded k times; Step S314, while completing step S313, perform regional constraints on the size of the corroded connected domain. If the area of ​​the current corroded connected domain is larger than the area constraint threshold, continue to repeat steps S312 and S313. If the area of ​​the current corroded connected domain is smaller than the area constraint threshold, the corrosion ends, and all the connected domains that have completed the corrosion are added together to generate a seed image.

6. The method for measuring the three-dimensional shape of metal materials based on stereo vision and model recovery according to claim 1, characterized in that: In step S8, the specific method for obtaining the three-dimensional coordinates of the stereo matching result is: Through the linear propagation equation of the spatial light path, the coordinate points of the same matching relationship in the left and right images are taken as the starting points P0 and Q0 of the two spatial rays. The equations of the two rays in space are assumed to be: The distance between points on two rays is found using the following formula: Solve the minimum value of the intersection of the two rays in space, which is the three-dimensional world coordinates of the object being measured. Therefore, make the above formula equal to 0, and you can get the two parameters k when the two rays intersect. p , k q , that is, satisfying the following formula: Finally, by bringing the parameters back into the ray equation, the three-dimensional coordinates of the object being measured can be obtained.

Citation Information

Patent Citations

  • Three-dimensional reconstruction method based on coding structured light

    CN101667303A

  • Structured light vision measurement method for 3D surface profiles of objects on the basis of K-means color clustering

    CN103292741A