A method for measuring focal length of laser marking machine
By using the focal length measurement method based on the super pixel -based motion statistical characteristic matching algorithm in the laser marker, the problem of low accuracy and efficiency of low accuracy in existing technologies is solved. A variety of marked objects.
Patent Information
- Application Number
- CN202111432019.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-29
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2041-11-29
AI Technical Summary
The existing laser marking machine focal length measurement methods have problems of low accuracy and low efficiency, especially when the texture information of the marked object is not obvious or there are too many homogeneous areas.
Adopt the focal length measurement method based on super pixel grid motion statistical characteristic matching algorithm, collect images through the two -eyed camera, use the SLIC ultra -pixel segmentation method to divide the image into the super pixel area Point match, calculate the vision diagram and get depth information.
Improve the accuracy and efficiency of the ranging, be able to adapt to different types of marked objects, single or complex texture, realize real -time measurement output, and meet the actual needs of laser marking machines.
Smart Images

Figure CN114187246B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of laser marking, and relates to a method for measuring the focal length of a laser marking machine, in particular to a method for measuring the focal length of a laser marking machine based on a superpixel grid motion statistical feature matching algorithm. Background Art
[0002] Laser marking machines use laser beams to mark the surfaces of various materials permanently. The marking method is to expose the deep material through the evaporation of the surface material, thereby engraving exquisite patterns, trademarks and texts. At present, the focal length measurement methods of laser marking machines are all lacking, which affects the marking accuracy and efficiency. In order to achieve accurate distance measurement, people have proposed various distance measurement methods: Chinese patent CN111780715A discloses a visual distance measurement method, which creates a camera feature database, that is, the robot takes pictures of navigation signs of known sizes from different distances under the fixed focus or zoom mode of the camera. The robot identifies the navigation sign from the picture, measures the size of the navigation sign in the picture, establishes a corresponding relationship table between the different distances between the robot and the navigation sign and the size of the navigation sign in the picture under the fixed focus or zoom mode, and calculates the distance between the robot and the navigation sign. The gradient of the corresponding relationship table in this patent method has a direct impact on the measurement accuracy. When the interval difference between adjacent data in the relationship table is large, it will have a greater impact on the measurement accuracy. Chinese patent CN109520480B discloses a ranging method and ranging system based on binocular stereo vision. First, the original reference image and the original target image are obtained, and the original reference image and the original target image are corrected according to the camera parameters to obtain the corresponding corrected reference image and the corrected target image. The matching cost is calculated for the corrected reference image and the corrected target image to obtain the matching cost between each pixel in the corrected reference image and the corresponding point in the corrected target image. The matching cost includes a feature matching cost and a divergent matching cost. The matching cost is aggregated to obtain the corresponding cumulative cost, and the disparity value corresponding to each pixel in the corrected reference image is calculated according to the cumulative cost to complete the ranging. The feature matching algorithm in the patent method calculates the feature matching cost between each pixel in the corrected reference image and the corresponding point in the corrected target image. This full calculation method will take a lot of time and reduce the ranging efficiency. In addition, the feature point matching will be affected by too many homogeneous areas, reducing the matching accuracy.
[0003] Laser marking machines are widely used in real production and life, and the types of workpieces being marked are becoming increasingly diverse. Improving the marking efficiency and accuracy of laser marking machines is an industrial problem that needs to be solved urgently. At present, the requirements for the focusing speed and marking accuracy of laser marking machines are increasing, and the existing distance measurement methods cannot meet the actual needs. Summary of the invention
[0004] In view of the above-mentioned prior art, the technical problem to be solved by the present invention is to provide a method for measuring the focal length of a laser marking machine based on a superpixel grid motion statistics feature matching algorithm. The SLIC superpixel segmentation method is used to perform superpixel segmentation on the collected left and right images respectively, and the feature matching algorithm based on superpixel grid motion statistics is used to match feature points of the segmented binocular images, thereby improving the matching accuracy and efficiency and thus achieving the purpose of improving the ranging accuracy and efficiency.
[0005] In order to solve the above technical problems, a method for measuring the focal length of a laser marking machine of the present invention comprises the following steps:
[0006] S1: Use a binocular camera to collect left and right camera images of the target object;
[0007] S2: After calibrating the camera, obtain the camera focal length and baseline parameters;
[0008] S3: Segment the collected image into super-pixel regions using super-pixel segmentation method;
[0009] S4: feature point matching using superpixel grid motion statistics;
[0010] S5: Calculate the disparity maps of the matching feature points respectively and then average them to obtain the average disparity, and finally calculate the depth map.
[0011] Furthermore, in step S3, the superpixel segmentation method is used to segment the collected image into superpixel regions, including:
[0012] S3-1: Initialize cluster centers;
[0013] S3-2: reselect the cluster center within the selected neighborhood of the cluster center;
[0014] S3-3: Update the reselected cluster center to the mean of all pixels in this class;
[0015] S3-4: Determine whether the location information of the cluster center has changed. If so, return to step S3-2; otherwise, execute step S3-5;
[0016] S3-5: Use the connectivity algorithm to merge isolated points and evenly divide the left and right images into K1 and K2 non-overlapping and irregular superpixel regions respectively.
[0017] Furthermore, initializing the cluster center in S3-1 includes:
[0018] Construct a vector for each pixel of the image obtained by S1
[0019]
[0020] Among them, B is the number of bands, (x, y) is the coordinate of the pixel point in the image, and R xy is the spectral information at the pixel point (x, y), with B pixel values, η is the parameter for balancing spatial and spectral information, Where S is the size of the search window, and the weights of spatial and spectral information are controlled by adjusting the value of m;
[0021] By step length Initialize a series of cluster centers C i =Φ(x i ,y i ), K is the expected number of superpixels in the input, and N is the total number of pixels in each image.
[0022] Furthermore, in S3-2, the cluster center is reselected within the selected neighborhood of the cluster center as follows:
[0023] Each pixel is located in its 2S×2S neighborhood according to the Euclidean distance ||Φ(x,y)-Φ(x i ,y i )||Search for the cluster center that is closest to it and cluster them into one category.
[0024] Furthermore, S4 uses superpixel grid motion statistics to perform feature point matching, including:
[0025] S4-1: Using feature matching algorithm ORB to detect feature points in two images, given an image pair {I a ,I b} respectively have {N,M} features;
[0026] S4-2: Match feature points using the BF brute force matching algorithm to obtain a To I b The set of all nearest neighbor feature matches X = {x1, x2, ..., x i ,…,x N}, where x i Indicates the i-th feature matching;
[0027] S4-3: For any superpixel region block a in the left image i , find the superpixel region b with the most matching pairs in the right image j , and recorded as {a i ,b j};
[0028] S4-4: For any superpixel region {a i ,b j}, and record the feature point matching subset contained in it as F ij , the number of matches is |Fij |, according to the smoothness of motion, the superpixel region pair {a i ,b j The superpixel region around {a ir ,b jr}, r∈[1,R], R is the number of surrounding neighborhood superpixel regions, then the unit pair {a i ,b j} is scored as a correct match:
[0029]
[0030] S4-5: Determine a match f ij ∈F ij Whether it is a correct match, remove the wrong matching points and get the final matching feature points.
[0031] Further, in S4-5, a matching f is determined ij ∈F ij Whether it is a correct match is as follows:
[0032]
[0033] Among them, α is a set constant, T i is the average number of feature points in each superpixel area, T represents a correct match, and F represents an incorrect match.
[0034] Furthermore, in S5, the disparity maps of the matched feature points are calculated respectively and then the average disparity is calculated, and the depth map finally calculated includes:
[0035] Average parallax is the average value of the disparity of all feature matching points on the left and right images, satisfying:
[0036]
[0037] Among them, the corresponding position of the left and right cameras in the digital image is x r 、x l , the parallax is the difference between the horizontal coordinates of the corresponding image points on the two projected images: d = x r -x l , h is the number of matching point pairs between the left and right images;
[0038] The depth of field Z is the distance from the object point to the baseline in the three-dimensional world. The depth of field Z is calculated according to the following formula:
[0039]
[0040]
[0041] Where b is the baseline length of the two cameras and f is the focal length of the cameras.
[0042] The beneficial effects of the present invention are as follows: in view of the problem that the texture information of the marked object is not obvious and there are too many homogeneous areas, the existing automatic focusing method has low precision. The present invention uses a binocular camera to collect the image of the marked object below the laser marking machine, and divides the collected image into pixel blocks based on the superpixel segmentation method to complete the image homogeneous area division; and uses a feature matching algorithm based on superpixel grid motion statistics to match feature point pairs, and uses the principle of similar triangles to obtain depth information through the parallax of feature point pairs, so as to achieve the distance measurement between the marked object and the laser emission position. The present invention has the advantages of having good ranging accuracy for the marked workpiece with strong texture and being able to handle the problem that the image of the marked workpiece with weak texture is inaccurately matched due to too many homogeneous areas, thereby affecting the marking accuracy. The automatic focusing method of the laser marking machine is universal and can adapt to most types of marked objects. Whether the texture of the marked workpiece is single or complex, the present invention can achieve the required ranging accuracy. Compared with the traditional binocular ranging method, the present invention has obvious improvements in both ranging accuracy and efficiency, and can better meet the actual needs of the laser marking machine. The present invention can achieve the effect of real-time measurement output and can provide a solution for the streamlined marking operation of laser marking machines. The present invention can solve the problem of low precision of existing automatic focusing methods caused by unclear texture information of the marked object and too many homogeneous areas. At the same time, the present invention only needs to know the focal length and baseline parameters of the binocular camera, eliminating the step of recalibration required every time the camera position changes in the traditional method, and has universal applicability. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 is a process flow chart of the present invention;
[0044] Figure 2 A checkerboard captured by a binocular camera;
[0045] Figure 3 is the calibration diagram;
[0046] Figure 4 Some parameters of the camera, such as focal length and baseline;
[0047] Figure 5 To collect left and right images of the target object;
[0048] Figure 6 It is the flow chart of superpixel segmentation algorithm;
[0049] Figure 7 are the left and right images after superpixel segmentation;
[0050] Figure 8 It is a flowchart of feature point matching based on superpixel grid motion statistics;
[0051] Fig. 9 It is a block diagram of feature point matching based on superpixel grid motion statistics;
[0052] Fig.10 It is the feature point matching result based on superpixel grid motion statistics. DETAILED DESCRIPTION
[0053] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0054] The hardware experimental platform of the present invention includes a laser marking machine, a true color binocular camera and a computer. The software experimental scheme includes the following four parts: binocular camera parameter determination, binocular image superpixel segmentation, feature point matching, and feature point pair output disparity. Binocular camera parameter determination is to obtain the binocular camera baseline and focal length parameters; binocular image superpixel segmentation is to use the SLIC superpixel segmentation method to perform superpixel segmentation on the left and right images of the acquired binocular image; feature matching is to use the feature matching algorithm based on superpixel grid motion statistics to match feature points on the binocular image after segmentation; feature point pair output disparity is to determine its disparity according to the position relationship of the matched feature point pair, and then obtain the depth information according to the principle of similar triangles. The binocular camera is fixed above the laser emission position, the midpoint of the baseline of the binocular camera is at the central axis position of the laser head, and the binocular camera is parallel to the horizontal direction of the workbench. Based on the binocular stereo vision theory, the Zhang Zhengyou calibration method is used to determine the camera baseline length and focal length parameters.
[0055] Combination Figure 1 , the present invention comprises the following steps:
[0056] S1: Use a binocular camera to collect left and right camera images of the target object;
[0057] S2: After calibrating the camera, obtain the camera focal length and baseline parameters;
[0058] S3: Segment the collected image into super-pixel regions based on the super-pixel segmentation method, specifically:
[0059] S3-1: Initialize cluster centers.
[0060] Construct a vector containing spatial and spectral information for each pixel of the image (B is the number of bands)
[0061]
[0062] Where η is a constant that can balance spatial and spectral information. The value of η is usually set to Where S is the size of the search window, and the weight of spatial and spectral information can be controlled by adjusting the value of m. Where (x, y) is the coordinate of the pixel in the image, R xy is the spectral information at the pixel point (x, y), which generally has B pixel values.
[0063] The number of cluster centers and the step size S are determined based on the expected number of superpixels K input. N is the total number of pixels in the image. Initialize a series of cluster centers C i =Φ(x i ,y i ).
[0064] S3-2: Reselect the cluster center within a certain range of the neighborhood of the cluster center.
[0065] Each pixel is located in its 2S×2S neighborhood according to the Euclidean distance ||Φ(x,y)-Φ(x i ,y i )||Search for the cluster center that is closest to it and cluster them into one category.
[0066] S3-3: The cluster center is updated to the mean of all pixels in this class.
[0067] S3-4: Repeat the above two steps until the location information of the cluster center no longer changes.
[0068] S3-5: Use the connectivity algorithm to merge isolated points so that the pixels inside each superpixel are interconnected and the number of pixels is uniform.
[0069] S4: Feature point matching based on superpixel grid motion statistics, using the classic feature matching algorithm ORB to detect feature points in the two images and calculate descriptors; feature point matching through the BF brute force matching algorithm; for any superpixel area block in the left image, find the superpixel area block with the most matching pairs in the right image; based on the best matching superpixel pair, calculate a corresponding statistic and compare it with the threshold. If it is greater than the threshold, it is a correct match, and if it is less than the threshold, it is an incorrect match; use motion smoothness to eliminate incorrect matching points and obtain the final matching feature points, where motion smoothness means that there are a corresponding number of supporting matching points near the correctly matched feature points, and a certain number of supporting matching points cannot be found near the incorrectly matched feature points. Specifically including:
[0070] S4-1: For the given images taken by the left and right cameras, the classic feature matching algorithm ORB is used to detect the feature points in the two images and calculate the descriptors. It can be set that there are {N, M} feature points in the two images respectively.
[0071] S4-2: After the ORB algorithm, we get the given image pair {I a ,I b} respectively have {N,M} features, and then the feature points are matched by BF brute force matching algorithm to obtain a To I b The set of all nearest neighbor feature matches X = {x1, x2, ..., x i ,...,x N}, where x i Represents the i-th feature match. Since the ORB algorithm is a fast but relatively inaccurate feature detection algorithm, there are certain false matching feature points in the X set. The goal of this algorithm is to distinguish true matches from false matches in the set X.
[0072] S4-3: Superpixel Segmentation SLIC divides the left and right images into K1 and K2 non-overlapping and irregular superpixel regions respectively. The superpixel regions in the left and right images are represented as: {a1, a2, ..., a k1}, {b1,b2,...,b k2 For any superpixel block a in the left image i , all feature points in the superpixel area are recorded as {x a1 ,x a2 ,...,x ak}, there are k feature points in total. Find all the superpixel area blocks a i The best matching superpixel region of each superpixel region in the left image is determined according to the number of matching points in each superpixel region in the right image, and is recorded as {a i ,b j};
[0073] S4-4: In order to express the probability of correct matching of feature points in superpixel region a to superpixel region b, we use Represents the feature point f a The nearest neighbor match of is in region b, Represents the feature point f a Match error. You can get When it happens The probability of occurrence is:
[0074]
[0075] Where m is the number of features in region b, and β is a factor added to accommodate violations of the repetitive structure assumption. a If one of the matches is wrong, then it may match I b Any feature point in .
[0076] Assume T ab Indicates that the given region {a, b} points to the same location, then It means that when the given area {a, b} points to the same position, the feature point f a The probability that the nearest neighbor of is in region b. Furthermore, a The probability of having a correct match With size t, we get:
[0077]
[0078]
[0079] in, Represents the feature point f a Matching error, so we can get p t for:
[0080]
[0081] Similarly, It means that if the region {a, b} points to different positions, the feature point f a The probability that the nearest neighbor matches in region b, where F ab Indicates that the area {a,b} points to different locations. Then:
[0082]
[0083] Since each match is independent of each other, it can be approximated as a binomial distribution according to equations (5) and (6):
[0084]
[0085] Assume that each region pair has {n,m} feature points, S i The binomial distribution of can be approximately expressed as:
[0086]
[0087] Where L is the number of regions that do not intersect with the matching region.
[0088] So, S i The standard deviation and variance are:
[0089]
[0090]
[0091] Therefore, the ability to distinguish true and false matches is expressed by dividing the difference in means by the sum of standard deviations, which is defined as follows:
[0092]
[0093] The goal of the algorithm is to maximize P. From the above formula, we can see that:
[0094]
[0095] In order to improve the robustness of the algorithm, we can increase L or n. The algorithm uses superpixel grids to implement an efficient scoring mechanism with a time complexity of O(N), where N is the number of features. This conflicts between having as many features as possible and real-time calculations.
[0096] Formulas (5) and (6) show that combining regions can increase the separability of true and false matches, so we can choose a neighboring region that is connected. i ,b j}, and record the feature point matching subset contained in it as F ij , the number of matches is |F ij |. According to the smoothness of motion, if the superpixel region is {a i ,b j} is a correct match, then the superpixel area a i With b j The surrounding corresponding super pixel region pairs are also likely to be correctly matched. i ,b j The superpixel region around {a ir ,b jr}, where r∈[1,R], R is the number of surrounding neighborhood superpixel regions, then the unit pair {a i ,b j} is scored as a correct match:
[0097]
[0098] S4-5: The algorithm gives the following formula to determine a match f ij ∈F ij Is it a correct match?
[0099]
[0100] Where α is a constant, f ij F ij Match a feature point in T i is the average number of feature points in each superpixel area, T represents a correct match, and F represents an incorrect match. The wrong matching points are eliminated to obtain the final matching feature points.
[0101] S5: Calculate the disparity maps of the matching feature points respectively and then average them to obtain the average disparity, and finally calculate the depth map, which is specifically:
[0102] The difference in projection when the left and right cameras observe the same scene is called parallax. According to the principle of triangulation, it can be concluded that:
[0103]
[0104]
[0105]
[0106] Among them, the corresponding position of the left and right cameras in the digital image is x r 、x l , the parallax is the difference between the horizontal coordinates of the corresponding image points on the two projected images: d = x r -x l h is the number of matching point pairs between the left and right images. is the average parallax of all feature matching points on the left and right images. The baseline length of the two cameras is b, the depth of field Z is the distance from the object point to the baseline in the three-dimensional world, and the focal length of the camera is f. Under the ideal binocular vision model, the imaging planes of the left and right cameras are parallel to the baseline. The average parallax depth of field is proportional to the focal length of the camera and the baseline length, and inversely proportional to the parallax.
[0107] The following is an example with specific parameters:
[0108] The algorithm proposed in the present invention is written in Python language, and the algorithm runs on the following hardware platforms: CPU: i5-9400F, GPU: GTX-1650, memory: 16G. The binocular camera has a resolution of 1600×600, a horizontal resolution of 96dpi, a vertical resolution of 96dpi, and a bit depth of 24. In this example, the binocular camera needs to manually adjust the focal length during the early shooting so that the left and right images captured retain the edge detail information as much as possible. The processing flow chart of the present invention is shown in FIG. Figure 1 The specific steps of this example are as follows:
[0109] S1: Connect the binocular camera to the host via a USB-typeC cable, adjust the focal length, and set the initial shooting parameters. First, calibrate the camera by shooting a chessboard. In this example, 30 chessboards are shot at different angles. The examples of the chessboards shot are as follows: Figure 2 shown.
[0110] S2: Using 30 chessboards taken at different angles, the camera is calibrated using the calibration toolbox to obtain the camera's focal length, baseline and other parameters, and determine the camera's internal geometric parameters and optical properties. The calibration diagram and some parameters are as follows Figure 3 ,4 shown.
[0111] S3: Connect the binocular camera to the host via a USB-typeC cable, and collect images of the target object with the left and right cameras. The collected images are as follows: Figure 5 shown.
[0112] S4: Perform superpixel segmentation on the collected left and right images. The number of superpixel regions can be determined based on the size of the image and the object details contained in the image. The flow chart of the superpixel segmentation algorithm is as follows: Figure 6 As shown. Image segmentation based on the SLIC superpixel segmentation method is divided into the following five steps: (1) Initialize the cluster center 1. (2) Reselect the cluster center 2 within the 2S×2S neighborhood of the cluster center. (3) Update the cluster center to the mean of all pixels in the class. (4) Repeat the above two steps until the location information of the cluster center no longer changes 4. (5) Enhance connectivity and merge isolated points 5.
[0113] In this example, the number of superpixel regions for the left and right images is set to 2000. The number of superpixel regions obtained by SLIC segmenting the left and right images is 2120 and 2125 respectively. The segmented images are as follows: Figure 7 shown.
[0114] S5: Feature point matching flow chart and block diagram based on superpixel grid motion statistics Figure 8 , 9 As shown in the figure, the feature matching algorithm based on superpixel grid motion statistics matches pixel pairs in the following five steps: (1) Use the classic feature matching algorithm ORB to detect feature points in the two images and calculate descriptors 1. (2) Use the BF brute force matching algorithm to match feature points 2. (3) Find the superpixel area block with the most matching pairs in the left and right images 3. (4) According to the probability characteristic distribution, calculate a statistic 4. (5) Eliminate the wrong matching points and output the final matching result 5.
[0115] In this example, the ORB feature point detection algorithm uses the ORB_create function in the OpenCV library and sets 10,000 detection points. The feature point matching is then performed using the BF brute force matching algorithm. After obtaining the matching feature points, the matching feature points that do not meet the conditions are removed using the superpixel area and motion smoothness characteristics to obtain 154 remaining matching feature points, as shown below: Fig.10 shown.
[0116] S6: Obtain the disparity of the matching feature point pair, and then obtain the depth information;
[0117] Use two or more different viewpoints to observe the same scene and obtain pictures from different perspectives. Then use the visual ranging model to measure the position offset between the picture pixels, that is, the parallax between the two pictures, to obtain the three-dimensional information of the object.
[0118] The difference in projection when the left and right cameras observe the same scene is called parallax. According to the principle of triangulation, it can be concluded that:
[0119]
[0120]
[0121] The baseline length of the two cameras is b, the depth of field Z is the distance from the object point to the baseline in the three-dimensional world, and the focal length of the camera is f. The corresponding position of the left and right cameras in the digital image is x r 、x l .
[0122] In the ideal binocular vision model, the imaging planes of the left and right cameras are parallel to the baseline, and the parallax is the difference between the horizontal coordinates of the corresponding image points on the two projected images: d = x r -x l The depth of field is proportional to the camera focal length and the baseline length, and inversely proportional to the parallax.
Claims
1. A method for measuring the focal length of a laser marking machine, characterized in that: The following steps are involved: S1: Use a binocular camera to collect left and right camera images of the target object; S2: After calibrating the camera, obtain the camera focal length and baseline parameters; S3: Segment the collected image into super-pixel regions using a super-pixel segmentation method; S4: feature point matching using superpixel grid motion statistics; S4-1: Using feature matching algorithm ORB to detect feature points in two images, given an image pair {I a ,I b } respectively have {N,M} features; S4-2: Match feature points using the BF brute force matching algorithm to obtain a To I b The set of all nearest neighbor feature matches X = {x1, x2, ..., x i ,...,x N }, where x i Indicates the i-th feature matching; S4-3: For any superpixel region block a in the left image i , find the superpixel region b with the most matching pairs in the right image j , and recorded as {a i ,b j }; S4-4: For any superpixel region {a i ,b j }, and record the feature point matching subset contained in it as F ij , the number of matches is |F ij |, according to the smoothness of motion, the superpixel region pair {a i ,b j The superpixel region around {a ir ,b jr }, r∈[1,R], R is the number of surrounding neighborhood superpixel regions, then the unit pair {a i ,b j } is scored as a correct match: S4-5: Determine a match f ij ∈F ij Whether it is a correct match, remove the wrong matching points and obtain the final matching feature points; Among them, α is a set constant, T i is the average number of feature points in each superpixel area, T represents a correct match, and F represents an incorrect match; S5: Calculate the disparity maps of the matching feature points respectively and then average them to obtain the average disparity, and finally calculate the depth map.
2. A method for measuring focal length of a laser marking machine according to claim 1, characterized in that: The step S3 of segmenting the collected image into super-pixel regions using the super-pixel segmentation method includes: S3-1: Initialize cluster centers; S3-2: reselect the cluster center within the selected neighborhood of the cluster center; S3-3: Update the reselected cluster center to the mean of all pixels in this class; S3-4: Determine whether the location information of the cluster center has changed. If so, return to step S3-2; otherwise, execute step S3-5; S3-5: Use the connectivity algorithm to merge isolated points and evenly divide the left and right images into K1 and K2 non-overlapping and irregular superpixel regions respectively.
3. A method for measuring focal length of a laser marking machine according to claim 2, characterized in that: S3-1 Initializing the cluster center includes: Construct a vector for each pixel of the image obtained by S1 Among them, B is the number of bands, (x, y) is the coordinate of the pixel point in the image, and R xy is the spectral information at the pixel point (x, y), with B pixel values, η is the parameter for balancing spatial and spectral information, Where S is the size of the search window, and the weights of spatial and spectral information are controlled by adjusting the value of m; By step length Initialize a series of cluster centers C i =Φ(x i ,y i ), K is the expected number of superpixels in the input, and N is the total number of pixels in each image.
4. The method for measuring focal length of a laser marking machine according to claim 2, characterized in that: S3-2 The reselection of the cluster center within the selected neighborhood of the cluster center is specifically as follows: Each pixel is located in its 2S×2S neighborhood according to the Euclidean distance ||Φ(x,y)-Φ(x i ,y i )||Search for the cluster center that is closest to it and cluster them into one category.
5. The method for measuring focal length of a laser marking machine according to claim 1, characterized in that: S5 calculates the disparity maps of the matching feature points respectively and then calculates the average disparity, and finally calculates the depth map including: Average parallax is the average value of the disparity of all feature matching points on the left and right images, satisfying: Among them, the corresponding position of the left and right cameras in the digital image is x r 、x l , the parallax is the difference between the horizontal coordinates of the corresponding image points on the two projected images: d = x r -x l , h is the number of matching point pairs between the left and right images; The depth of field Z is the distance from the object point to the baseline in the three-dimensional world. The depth of field Z is calculated according to the following formula: Where b is the baseline length of the two cameras and f is the focal length of the cameras.
Citation Information
Patent Citations
Binocular stereo vision-based ranging methods and systems
CN109520480B
Visual ranging method
CN111780715A
Parallax correction method based on super pixel segmentation
CN106651897A
Quick binocular stereo matching method based on superpixel segmentation
CN106709948A