A method for extracting sub-pixel center of light stripes based on FPGA

By improving the gray center of gravity method and combining it with the row coordinate tracking algorithm on the FPGA platform, the problem of difficulty in balancing light strip center extraction accuracy and real-time performance in the existing technology is solved, and high-precision and fast light strip center sub-pixel coordinate extraction is achieved. .

CN114723808BActive Publication Date: 2024-09-24HEFEI UNIV OF TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210231080.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-10
Publication Date
2024-09-24
Estimated Expiration
2042-03-10

AI Technical Summary

Technical Problem

It is difficult for the existing technology to meet the accuracy requirements of light strip center extraction while ensuring real-time performance. Traditional algorithms such as the extreme value method, gray gravity center method and Steger method have their own shortcomings and cannot achieve fast and high-precision light strip center extraction in industrial sites. .

Method used

The FPGA-based light strip sub-pixel center extraction method is used to filter out noise through the image preprocessing module, and increase the weight of the light strip center area based on the gray center of gravity method. Combined with the row coordinate tracking algorithm, the sub-pixel center of the light strip is achieved. Pixel coordinate extraction improves extraction accuracy and speed.

Benefits of technology

On the basis of ensuring real-time performance, the accuracy and speed of light strip center extraction are improved, achieving more accurate light strip center coordinate acquisition, and meeting the high-precision requirements of industrial sites.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114723808B
    Figure CN114723808B
Patent Text Reader

Abstract

The present invention discloses a method for extracting the sub-pixel center of a light stripe based on FPGA, comprising the following steps: obtaining an image containing a light stripe and saving it to the on-chip ROM of the FPGA; filtering the image using a median filtering algorithm to remove interference noise, and obtaining the row coordinates of the center of the light stripe using an improved grayscale centroid method; designing a row coordinate tracking algorithm to obtain the column coordinates of the center of the light stripe, that is, obtaining the specific coordinates of the center of the light stripe; performing a comparative experiment, outputting and comparing the extraction results of the light stripe center coordinates, and the improved grayscale centroid method can obtain a more accurate optical center of the light stripe image, and the extraction result is more accurate. The present invention can improve the sub-pixel extraction accuracy of the center of the light stripe in the FPGA, and meet the accuracy requirements of the light stripe center extraction on the basis of ensuring real-time performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the field of visual measurement technology, and in particular to a method for extracting sub-pixel centers of light stripes based on FPGA. Background Art

[0002] As one of the hot research fields in industrial inspection, visual measurement is widely used in quality inspection, large-size measurement and other scenarios. Line structured light is widely used in the field of visual measurement because of its strong anti-interference ability and high precision. The line structured light three-dimensional scanning measurement system based on the laser triangulation measurement principle is widely used because of its simple structure and high precision. The extraction accuracy of the center of the light strip is an important indicator for evaluating the accuracy of a measurement system. At the same time, with the increasing complexity of industrial sites, the requirements for the accuracy and real-time performance of the measurement system are also increasing. Therefore, improving the measurement accuracy while ensuring the real-time requirements has become an important research direction.

[0003] With the development of digital image processing technology, various image acquisition and processing systems have emerged one after another. The image processing technology based on PC has the longest development time and is the most mature, but due to the limitation of hardware system, it has defects such as poor portability and low processing speed, and cannot guarantee the real-time performance of the measurement system. Although the emergence of DSP-based image processing technology has solved the problem of portability, due to the limited hardware modules inside it, it is still not usable in scenarios where the amount of data to be processed is large and there are certain requirements for processing speed. With the emergence of FPGA (Field Programmable Gate Array) and the continuous improvement of manufacturing technology, FPGA has the advantages of high speed, programmability and large capacity, and has become a new solution in the field of image acquisition and processing. Light stripe center extraction generally includes processes such as image filtering and sub-pixel precision extraction of light stripe center. Traditional light stripe center extraction algorithms include extreme value method, grayscale centroid method and Steger algorithm based on Hessian matrix. The extreme value method is simple in concept and has a fast calculation speed, but it is very susceptible to noise and has low extraction accuracy. The grayscale centroid method has improved accuracy and is more efficient, but it still cannot meet the accuracy requirements in industrial sites. The Steger method has the advantages of high accuracy and good robustness, but due to the large amount of calculation, it is difficult to quickly extract the center of the light stripe and cannot guarantee the real-time measurement. How to meet the accuracy requirements of the light stripe center extraction while ensuring real-time performance has become a difficulty. Summary of the invention

[0004] In view of the above technical difficulties, the purpose of the present invention is to provide a method for extracting the sub-pixel center of a light stripe based on FPGA, which improves the speed and accuracy of extracting the center of a line structured light stripe.

[0005] To achieve the above object, the technical solution of the present invention is:

[0006] A method for extracting sub-pixel centers of light stripes based on FPGA includes the following steps:

[0007] Step 1: Use a laser to project laser onto the object to be measured, and use an industrial camera to take pictures to obtain an image containing light strips, and save it to the FPGA on-chip ROM as a MIF file;

[0008] Step 2: Use FPGA to process the laser stripe image obtained in step 1. The processing system mainly includes an image preprocessing module and a light stripe center extraction module. The image preprocessing module is used to filter out the interference noise of the image, thereby reducing the impact of noise on the measurement results; the light stripe center extraction module increases the weight of the light stripe center area by designing an improved grayscale centroid method, and finally obtains the row coordinates of the light stripe center;

[0009] Step 3, design a row coordinate tracking algorithm to obtain the column coordinates that correspond one-to-one to the row coordinates of the center point obtained in step 2, and combine the two to obtain the specific coordinates of the center point of the light strip;

[0010] Step 4: Conduct experiments to obtain and compare the light bar center coordinate extraction results.

[0011] Furthermore, the step 1 specifically includes:

[0012] Step 1.1, build a line structured light measurement system based on optical triangulation, including laser, industrial camera and system bracket;

[0013] Step 1.2, use a laser to illuminate the surface of the workpiece, and an industrial camera captures and collects the light strip image modulated by the workpiece;

[0014] Step 1.3, convert the captured image into a memory initialization file (MIF) on the PC, set the width of the MIF file to 8 and the depth to 16384. After the conversion is completed, write the file into the FPGA on-chip ROM through Quartus.

[0015] Furthermore, in step 2, the light strip center extraction module increases the weight of the light strip center area by an improved grayscale centroid method, and the improved grayscale centroid method is specifically:

[0016] Suppose a light strip image of size M*N, its first i Line j The pixel coordinates corresponding to the column are (u i ,v j ) The gray value corresponding to this pixel is f(ui ,v j ) ;

[0017] Step 2.1, define the register to wait in real time to receive the gray value data of the image pixel in the FPGA on-chip ROM f (u i ,v j ) and the corresponding coordinates (u i ,v j ) ;

[0018] Step 2.2: When data transmission starts, the gray value of each pixel is f(u i ,v j ) Input the value in the register and perform cubic processing on the value in the register to obtain f(u i ,v j ) 3 , so that the pixel with larger gray value has a greater weight in subsequent calculations;

[0019] Step 2.3: After each pixel is processed, f(u i ,v j ) 3 and the corresponding coordinate values u i Input the multiplier, and then input the output of the multiplier into the accumulator to get the output P n ;

[0020] Step 2.4: After each pixel is processed, f(u i ,v j ) 3 Input into the accumulator and get the output Q n ;

[0021] Step 2.5, P n is the dividend, Q nis the divisor, which is input into divider 1 to obtain the quotient and remainder of divider 1;

[0022] Step 2.6, enlarge the remainder obtained by divider 1 by 100 times and input it as the dividend to divider 2. Q n The divisor is input into divider 2 to obtain the quotient of divider 2;

[0023] Step 2.7, take the quotient of divider 1 as the integer part of the coordinate, and the quotient of divider 2 as the decimal part of the coordinate, and combine the two to get the sub-pixel coordinates of the center point of the light strip X i ;

[0024] After the above steps, we can get i The coordinate formula of the center point corresponding to the row is shown in the following formula (1):

[0025] (1).

[0026] Furthermore, the row coordinate tracking algorithm in step 3 is specifically as follows:

[0027] Step 3.1, first clear the row coordinates to zero, determine whether there is data read in, and if no data is read in, continue the determination process;

[0028] Step 3.2, when data is read in, the row coordinate is increased by 1, and it is determined whether a row of image data has been read in. If not, the determination process continues;

[0029] Step 3.3, when a row of image data is finished being read, determine whether a pair of images has been finished being read, if not, repeat step 3.2;

[0030] Step 3.4: If one image is read in, the program ends.

[0031] Furthermore, the step 4 is specifically as follows:

[0032] Step 4.1, compile and debug the algorithms in step 2 and step 3;

[0033] Step 4.2, use ModelSim to write a program, set the clock cycle to 20ns, the total time to 1ms, and conduct the experiment after the settings are completed;

[0034] Step 4.3: Output the structured light strip center extraction results and compare the results before and after the improvement.

[0035] The beneficial effects of the present invention are:

[0036] The present invention uses FPGA as the processing core and improves on the principle of grayscale centroid method to achieve sub-pixel coordinate extraction of the center of the light stripe and improve the accuracy of coordinate extraction. On this basis, a row coordinate tracking program is designed to accurately obtain the two-dimensional coordinates of the center of the light stripe, which meets the requirements of light stripe extraction accuracy while ensuring real-time performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 It is a schematic diagram of the structure of the line structured light three-dimensional measurement system of the present invention;

[0038] Figure 2 This is the flow chart of the center coordinate extraction algorithm;

[0039] Figure 3 It is the flow chart of row coordinate tracking algorithm;

[0040] Figure 4 This is a comparison chart of the structured light center extraction results;

[0041] in, Figure 4 a is the extraction result of traditional grayscale centroid method; Figure 4 b is the extraction result of the inventive method; Figure 4 c is the comparison of the results of the two methods. DETAILED DESCRIPTION

[0042] The technical solutions in the embodiments of the present invention will be described clearly and completely below with reference to the accompanying drawings.

[0043] As shown in the accompanying drawings, a method for extracting sub-pixel centers of light stripes based on FPGA of the present invention comprises the following steps:

[0044] Step 1.1: Build Figure 1 The line structured light 3D measurement system based on optical triangulation shown in the figure includes a laser, an industrial camera and a system bracket; step 1.2, using a laser to illuminate the surface of a workpiece, and the industrial camera to capture and collect the light strip image modulated by the workpiece; step 1.3, converting the collected image into a memory initialization file (MIF) on the PC side, setting the width of the MIF file to 8 and the depth to 16384, and after the conversion is completed, writing the file into the FPGA on-chip ROM through Quartus.

[0045] Step 2: Use FPGA to process the laser stripe image obtained in step 1. The processing system mainly includes an image preprocessing module and a light stripe center extraction module. The image preprocessing module is used to filter out the interference noise of the image, thereby reducing the impact of noise on the measurement results; the light stripe center extraction module increases the weight of the light stripe center area by designing an improved grayscale centroid method, and finally obtains the row coordinates of the light stripe center. The light stripe center extraction algorithm flow is as follows: Figure 2 shown.

[0046] Suppose a light strip image of size M*N, its first i Line j The pixel coordinates corresponding to the column are (u i ,v j ) The gray value corresponding to this pixel is f(u i ,v j ) :

[0047] Step 2.1, define the register to wait in real time to receive the gray value data of the image pixel in the FPGA on-chip ROM f (u i ,v j ) and the corresponding coordinates (u i ,v j ) ;

[0048] Step 2.2: When data transmission starts, the gray value of each pixel is f(u i ,v j ) Input the value in the register and perform cubic processing on the value in the register to obtain f(u i ,v j ) 3 , so that the pixel with larger gray value has a larger weight ratio in the subsequent calculation, thereby improving the accuracy of the calculation result;

[0049] Step 2.3: After each pixel is processed, f(u i ,v j ) 3 and the corresponding coordinate values u i Input the multiplier, and then input the output of the multiplier into the accumulator to get the output P n ;

[0050] Step 2.4: After each pixel is processed, f(u i ,vj ) 3 Input into the accumulator and get the output Q n ;

[0051] Step 2.5, P n is the dividend, Q n is the divisor, which is input into divider 1 to obtain the quotient and remainder of divider 1;

[0052] Step 2.6, enlarge the remainder obtained by divider 1 by 100 times and input it as the dividend to divider 2. Q n The divisor is input into divider 2 to obtain the quotient of divider 2;

[0053] Step 2.7, take the quotient of divider 1 as the integer part of the coordinate, and the quotient of divider 2 as the decimal part of the coordinate, and combine the two to get the sub-pixel coordinates of the center point of the light strip X i .

[0054] Step 2.8, after the above steps, we can get i The coordinate formula of the center point corresponding to the row is shown in the following formula (1):

[0055] (1).

[0056] Step 3: Design Figure 3 The row coordinate tracking algorithm shown in the figure obtains the column coordinates corresponding to the row coordinates of the center point obtained in step 2, and the two are combined to obtain the specific coordinates of the center point of the light strip:

[0057] Step 3.1, first clear the row coordinates to zero, determine whether there is data read in, and if no data is read in, continue the determination process;

[0058] Step 3.2, when data is read in, the row coordinate is increased by 1, and it is determined whether a row of image data has been read in. If not, the determination process continues;

[0059] Step 3.3, when a row of image data is finished being read, determine whether a pair of images has been finished being read, if not, repeat the previous process;

[0060] Step 3.4: If the image reading is completed, the program ends.

[0061] Step 4: Conduct experiments to obtain and compare the light bar center coordinate extraction results.

[0062] Specifically:

[0063] Step 4.1, compile and debug the algorithms in steps 2 and 3,

[0064] Step 4.2, use ModelSim to write a program, set the clock cycle to 20ns, and the time to 1ms.

[0065] Step 4.3, after the settings are completed, conduct experiments, output and compare the results of structured light strip center extraction, such as Figure 4 As shown. At the same time, the comparison of the extraction results of the traditional grayscale centroid method and the improved grayscale centroid method with the light stripe center extraction results of the Steger method is shown in Table 1. From the comparison results, the root mean square error of the extraction results of the improved grayscale centroid method is smaller than that of the traditional grayscale centroid method, indicating that the light stripe center obtained by the former is closer to the true value and the extraction effect is better. The comparison effect is shown in Table 1 below, which is significantly improved.

[0066] Table 1 Comparison of the results of two light stripe center extraction methods

[0067] Traditional grayscale centroid method Improved grayscale centroid method Root mean square error 0.9039 0.7891

[0068] The embodiments described in the present invention are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.

Claims

1. A method for extracting sub-pixel centers of light stripes based on FPGA, characterized in that: The following steps are involved: Step 1: Use a laser to project laser onto the object to be measured, and use an industrial camera to take pictures to obtain an image containing light strips, and save it to the FPGA on-chip ROM as a MIF file; Step 2: Process the laser bar image acquired in step 1 by using FPGA. The processing system includes an image preprocessing module and a light bar center extraction module. The image preprocessing module is used to filter out the interference noise of the light bar image to reduce the influence of the noise on the measurement result. The light bar center extraction module is used to increase the weight of the laser bar center area and finally obtain the row coordinates of the light bar center. In step 2, the light strip center extraction module increases the weight of the light strip center area by an improved grayscale centroid method, and the improved grayscale centroid method is specifically: Suppose a light stripe image of size M*N, the pixel coordinates corresponding to the i-th row and j-th column are (u i ,v j ), the gray value corresponding to the pixel is f(u i ,v j ); Step 2.1, define the register to wait in real time to receive the gray value data f(u i ,v j ) and the corresponding coordinates (u i ,v j ); Step 2.2: When data transmission starts, the gray value f(u i ,v j ) is input into the register, and the value in the register is processed cubically to obtain f(u i ,v j ) 3 , so that the pixel with larger gray value has a greater weight in subsequent calculations; Step 2.3: f(u i ,v j ) 3 and the corresponding coordinate value u i Input the multiplier, and then input the output of the multiplier into the accumulator to get the output P n ; Step 2.4: f(u i ,v j ) 3 Input to the accumulator and get the output Q n ; Step 2.5, with P n is the dividend, Q n is the divisor, which is input into divider 1 to obtain the quotient and remainder of divider 1; Step 2.6, enlarge the remainder obtained by divider 1 by 100 times and input it as the dividend to divider 2. n The divisor is input into divider 2 to obtain the quotient of divider 2; Step 2.7, the quotient of divider 1 is used as the integer part of the coordinate, and the quotient of divider 2 is used as the decimal part of the coordinate. The two are combined to obtain the sub-pixel coordinate X of the center point of the light strip. i ; After the above steps, the coordinate formula of the center point corresponding to the i-th row can be obtained as shown in the following formula (1): Step 3, design a row coordinate tracking algorithm to obtain the column coordinates that correspond one-to-one to the row coordinates of the center point obtained in step 2, and combine the two to obtain the specific coordinates of the center point of the light strip; The coordinate tracking algorithm in step 3 is specifically as follows: Step 3.1, clear the row coordinates to zero, determine whether there is data read in, and if no data is read in, continue the determination process; Step 3.2, when data is read in, the row coordinate is increased by 1, and it is determined whether a row of image data has been read in. If not, the determination process continues; Step 3.3, when a row of image data is finished being read, determine whether a pair of images has been finished being read, if not, repeat step 3.2; Step 3.4, if one image is read in, the program ends; Step 4: Conduct experiments to obtain and compare the light bar center coordinate extraction results.

2. The method for extracting sub-pixel centers of light stripes based on FPGA according to claim 1, characterized in that: The step 1 is specifically as follows: Step 1.1, build a line structured light measurement system based on optical triangulation, including laser, industrial camera and system bracket; Step 1.2, use a laser to illuminate the surface of the workpiece, and an industrial camera captures and collects the light strip image modulated by the workpiece; Step 1.3, convert the collected light bar image into a memory initialization file MIF on the PC, set the width of the MIF file to 8 and the depth to 16384. After the conversion is completed, write the file into the FPGA on-chip ROM through Quartus.

3. The method for extracting sub-pixel centers of light stripes based on FPGA according to claim 1, characterized in that: Furthermore, the step 4 is specifically as follows: Step 4.1, compile and debug the algorithms in step 2 and step 3; Step 4.2, use ModelSim to write a program, set the clock cycle to 20ns, the total time to 1ms, and conduct the experiment after the settings are completed; Step 4.3: Output the structured light strip center extraction results and compare the results before and after the improvement.