A method for calculating the sub-pixel center of light stripes on the surface of large workpieces
Through mean filtering and grayscale center of gravity method, the accuracy and stability problems of the calculation of subpixel center of the light bar on the surface of large workpieces are solved, and high-precision determination of subpixel center of the light bar on the light bar on the surface of large workpieces is achieved.
Patent Information
- Application Number
- CN202311156659.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-08
- Publication Date
- 2025-08-26
- Estimated Expiration
- 2043-09-08
AI Technical Summary
The prior art is difficult to calculate the subpixel center of the light strips on the surface of large workpieces with high accuracy, resulting in unstable measurements.
Image filter is used for image filtering, combined with the grayscale center of gravity method, through coarse positioning and precise positioning, the pixel-level and sub-pixel-level center of the light bar are gradually determined.
High-precision and stable light bar subpixel center calculation are achieved, improving the accuracy and reliability of measurement.
Smart Images

Figure CN117315004B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of visual inspection technology, and in particular to a method for calculating sub-pixel centers of light stripes on the surface of a large workpiece. Background Art
[0002] Large workpieces, weighing tens or even hundreds of tons, are the blanks for manufacturing key components of major equipment. Computer vision, as a non-contact measurement method, can be used to measure workpiece dimensions. During measurement, a projector, laser, or other device projects a light strip onto the workpiece surface, which is then captured. To calculate the workpiece's dimensions, the sub-pixel center of the light strip in the image must be determined. Summary of the Invention
[0003] The purpose of the present invention is to provide a method for calculating the sub-pixel center of light stripes on the surface of a large workpiece, which has the characteristics of high calculation accuracy and stable calculation process.
[0004] To achieve the above objectives, the technical solution of this application is: a method for calculating the sub-pixel center of light stripes on the surface of a large workpiece, comprising:
[0005] The initial position of the light strips on the surface of the large workpiece is roughly located on the structured light image of the large workpiece, and the pixel-level center of each light strip on the l1th and l2th lines of the image is preliminarily obtained;
[0006] Accurately obtain the pixel-level center of each light strip on the l1th line of the image;
[0007] Get the sub-pixel center of each light strip through the sub-pixel center of the light strip on the l1th row.
[0008] Furthermore, the initial positions of the light stripes on the surface of the workpiece are roughly located on the large workpiece structured light image, specifically: the workpiece structured light image is mean filtered using a mean filter; when the light stripes in the image are vertical, two rows of pixels of the image are taken in the horizontal direction, and the initial positions of the two rows of light strips are determined based on the peak value of the light strip position and the characteristics of decreasing pixel grayscale values on both sides of the peak value.
[0009] Furthermore, there is a certain interval between the two rows of pixels, which is represented by l1 and l2 respectively.
[0010] Furthermore, the method for determining the pixel-level center of each light strip on the l1th and l2th lines of the image is: taking the maximum grayscale value on the light strip as the starting point, take 5-8 pixels on both sides of the point; if the grayscale values of the pixels on the left and right sides decrease successively, it is preliminarily considered that the grayscale maximum point is on the light strip, otherwise it is interference light.
[0011] Furthermore, the method for accurately obtaining the pixel-level center of each light strip on the l1th line of the image is: preliminarily determine that there are n1 pixel-level centers of the light strips on the l1th line, take the pixel-level centers of the light strips in turn, then take 8-12 pixels on the l1+1th line and obtain the first pixel position with the largest grayscale value; if the grayscale values of the pixels on both sides decrease in sequence, then take 8-12 pixels on the l1+2th line and obtain the second pixel position with the largest grayscale value, and so on; if it ends at the l2th line and coincides with the position of the pixel with the largest grayscale value on the l2th line, then the pixel-level center of the light strip on the l1th line is obtained.
[0012] Furthermore, the pixel center of the light strip on the l1th row is n 11 , n 11 ≤n1.
[0013] Furthermore, the sub-pixel center of the light strip on the l1th row is determined as follows: the pixel center point of the kth light strip on the l1th row is Centered, k≤n 11 , take 8-12 pixels on both sides of the pixel-level center point of the light strip in the horizontal direction, and use the grayscale centroid method to obtain the sub-pixel center point based on the position and grayscale value of 17-25 pixels
[0014] Furthermore, the sub-pixel center of each light strip is obtained by taking the pixel-level center point of the k-th light strip on the l1-th row. Get the sub-pixel center of the light strip upward and downward respectively: When getting the sub-pixel center of the light strip upward, get the pixel-level center point on the l1-1 line Pixel-level center point As the center, along the horizontal direction at the pixel level center point Take 8-12 pixels on each side and use the grayscale centroid method to get the sub-pixel center point based on the position and grayscale value of 17-25 pixels. Until the l1-r u Until the grayscale values of the pixels on the row do not decrease in sequence, r u =2, 3, ...; when obtaining the sub-pixel center of the light strip downward, the k-th light strip l1-r is obtained by the above method d The subpixel center of the row, r d =2, 3,….
[0015] By adopting the above technical solution, the present invention can achieve the following technical effects: the present invention can effectively determine the initial position of the light strip; and can obtain the sub-pixel center of gravity of the light strip using the grayscale center of gravity method based on the initial position of the light strip, with the characteristics of high calculation accuracy and stable calculation process. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1Polishing strip images for large workpieces;
[0017] Figure 2 is the grayscale value of each pixel on the l1th and l2th rows in the image. DETAILED DESCRIPTION
[0018] In order to help those skilled in the art better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.
[0019] This embodiment provides a method for calculating the sub-pixel center of a light stripe on the surface of a large workpiece, specifically comprising the following steps:
[0020] Step 1: Capture structured light images of large workpieces;
[0021] Specifically, a projector or laser transmitter is used to project a light bar onto the surface of a large workpiece, and a black and white camera with a pixel size of 2048×2048 is used to capture an image of the large workpiece, such as Figure 1 shown.
[0022] Step 2: Roughly locate the initial position of the light stripes on the surface of the workpiece on the structured light image of the large workpiece, and preliminarily obtain the pixel-level center of each light stripe on the l1th and l2th rows of the image;
[0023] Specifically, a 7×7 mean filter is used to perform mean filtering on the structured light image of a large workpiece. When the light stripes in the image are vertical, two rows of pixels are taken in the horizontal direction. The interval between the two rows of pixels can be 100 pixels; the two rows of pixels are represented by l1 and l2 respectively. The grayscale value of each pixel between the two rows of the image is as follows: Figure 2 The initial positions of the light stripes on lines l1 and l2 are determined based on the peak value of the light stripe position in the image and the decreasing grayscale values of the pixels on both sides of the peak value. Figure 2 Where θ is the pixel position and δ is the grayscale value of the pixel.
[0024] Starting from the maximum grayscale value on the light strip, select 5-8 pixels on both sides of the point. If the grayscale values of the pixels on the left and right decrease in sequence, it is preliminarily considered that the grayscale maximum point is on the light strip, otherwise it is interference light.
[0025] Step 3: Accurately obtain the pixel-level center of each light strip on the l1th line of the image;
[0026] Specifically, if there are n1 pixel-level centers of the light strip on the l1th row that are initially determined, the pixel-level centers of the light strip are taken in sequence, and the first pixel position with the largest grayscale value is obtained by taking 8-12 pixels on the l1+1th row; if the grayscale values of the pixels on both sides decrease in sequence, the second pixel position with the largest grayscale value is obtained by taking 8-12 pixels on the l1+2th row, and so on; until the l2th row is reached, and it coincides with the position of the pixel with the largest grayscale value on the l2th row, then the pixel-level center of the light strip on the l1th row is obtained. The obtained pixel-level center of the light strip on the l1th row is n 11 , n 11 ≤n1.
[0027] Step 4: Obtain the sub-pixel center of each light strip through the sub-pixel center of the light strip on row l1;
[0028] Specifically, the pixel-level center point of the k-th light strip on line l1 Take 8-12 pixels on both sides of the center point in the horizontal direction, and use the grayscale centroid method to find the sub-pixel center point according to the position and grayscale value of 21 pixels.
[0029] Take the pixel-level center of the kth light strip on line l1 Get the sub-pixel center of the light strip upward and downward respectively. When getting the sub-pixel center of the light strip upward: get the pixel-level center point on line l1-1 Pixel-level center point Take 8-12 pixels on both sides of the center point in the horizontal direction, and use the grayscale centroid method to get the sub-pixel center point according to the position and grayscale value of 17-25 pixels. Until the l1-r u The grayscale values of the pixels taken on the row do not decrease in sequence. When obtaining the sub-pixel center of the light strip downward, the same method is used to obtain the k-th light strip l1-r d The subpixel center of the row.
[0030] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for calculating the sub-pixel center of light stripes on the surface of a large workpiece, characterized in that: include: The initial position of the light stripes on the surface of the workpiece is roughly located on the structured light image of the large workpiece, and the pixel-level center of each light stripe on the l1th and l2th rows of the image is preliminarily obtained; Accurately obtain the pixel-level center of each light strip on the l1th line of the image; Obtain the sub-pixel center of each light strip through the sub-pixel center of the light strip on row l1; The initial positions of the light stripes on the surface of the workpiece are roughly located on the structured light image of the large workpiece, specifically by using a mean filter to perform mean filtering on the structured light image of the large workpiece; when the light stripes in the image are vertical, two rows of pixels of the image are taken in the horizontal direction, and the initial positions of the two rows of light stripes are determined based on the peak position of the light stripes and the characteristics of decreasing grayscale values of pixels on both sides of the peak; There is a certain interval between the two rows of pixels, which are represented by l1 and l2 respectively; The method for determining the pixel center of each light strip on the l1th and l2th lines of the image is as follows: starting from the maximum grayscale value on the light strip, take 5-8 pixels on both sides of the point; if the grayscale values of the pixels on the left and right sides decrease in sequence, it is preliminarily considered that the grayscale maximum point is on the light strip; otherwise, it is interference light; The method for accurately obtaining the pixel-level center of each light stripe on the l1th row of the image is as follows: preliminarily determine that there are n1 pixel-level centers of light stripes on the l1th row, take the pixel-level center of the light stripe in sequence, then take 8-12 pixels on the l1+1th row and obtain the first pixel position with the largest grayscale value; if the grayscale values of the pixels on both sides decrease in sequence, then take 8-12 pixels on the l1+2th row and obtain the second pixel position with the largest grayscale value, and so on; if it ends at the l2th row and coincides with the position of the pixel with the largest grayscale value on the l2th row, then the pixel-level center of the light stripe on the l1th row is obtained; The pixel center of the light strip on the l1th row is n 11 , n 11 ≤n1; The sub-pixel center of the light strip on the l1th row is determined as follows: the pixel center point of the kth light strip on the l1th row is Centered, k≤n 11 , take 8-12 pixels on both sides of the pixel-level center point of the light strip in the horizontal direction, and use the grayscale centroid method to obtain the sub-pixel center point based on the position and grayscale value of 17-25 pixels 2. The method for calculating the sub-pixel center of a light stripe on the surface of a large workpiece according to claim 1, characterized in that: The method to obtain the sub-pixel center of each light strip is: take the pixel-level center point of the k-th light strip on the l1-th row Get the sub-pixel center of the light strip upward and downward respectively: When getting the sub-pixel center of the light strip upward, get the pixel-level center point on the l1-1 line Pixel-level center point As the center, along the horizontal direction at the pixel level center point Take 8-12 pixels on each side and use the grayscale centroid method to get the sub-pixel center point based on the position and grayscale value of 17-25 pixels. Until the l1-r u Until the grayscale values of the pixels on the row do not decrease in sequence, r u =2, 3, ...; when obtaining the sub-pixel center of the light strip downward, the k-th light strip l1-r is obtained by the above sub-pixel center obtaining method d The subpixel center of the row, r d =2, 3,….
Citation Information
Patent Citations
Light stripe center rapid extraction method based on gray centroid method
CN105300316A
Hierarchical processing based sub-pixel center extraction method
CN105335988A