An automatic defocusing method based on a binocular fringe projection measurement system
By using an electronically controlled focus lens and a computer to adjust the number of lens rotations in real time in the stripe projection measurement system, the problem of low defocus adjustment efficiency of the projector lens is solved, and a higher accuracy and automated measurement process is achieved.
Patent Information
- Application Number
- CN202211006846.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-22
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2042-08-22
AI Technical Summary
In existing stripe projection measurement systems, defocus adjustment of the projector lens requires manual operation, resulting in low measurement accuracy and low efficiency.
An electronically controlled focus lens is adopted, and the number of revolutions of the lens is adjusted in real time through a computer to establish a functional relationship between the object distance and the number of revolutions of the lens to realize the automatic defocusing of the projector.
The accuracy of stripe projection measurement is improved, the automation of defocus measurement is realized, and the measurement efficiency is improved.
Smart Images

Figure CN115355849B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to an automatic defocusing method based on a binocular fringe projection measurement system, and belongs to the fields of computer vision and advanced manufacturing and automation. Background Art
[0002] Fringe projection measurement is an important research topic in the fields of computer vision and advanced manufacturing and automation. As a dense point cloud measurement method that takes into account both accuracy and efficiency, it is currently a relatively reliable means of precision control for complex workpiece manufacturing, with the characteristics of non-contact, large field of view, and low cost. It has been widely studied and applied in various fields, such as reverse engineering, quality inspection, augmented reality, model testing, and manufacturing of large components. In order to better apply fringe projection measurement to industrial scenarios, it is necessary to focus on the automation of fringe projection measurement.
[0003] A binocular fringe projection measurement system usually consists of two cameras and a projector. The projector usually projects a fringe image with grayscale that changes according to the sine (cosine) law onto the surface of the object to be measured, and the left and right cameras capture the deformed fringe pattern after modulation on the surface of the object; then, the pixel coordinates of the projector image of each point on the surface are obtained by phase solution; finally, the three-dimensional world coordinates are calculated based on the triangulation technology.
[0004] In the fringe projection system, due to the difference between the projection optical characteristics and the development level of basic electronic devices, the performance of the digital projector, an important component in the system, has become the main factor restricting the performance improvement of the fringe projection measurement system. The quality of the projected fringe directly affects the accuracy of the phase solution, and then affects the accuracy of the point cloud. Starting from the phenomenon that the projector defocus can affect the measurement accuracy, due to the limited resolution of the projector, when generating the fringe image, it is equivalent to sampling the sine function. Therefore, properly defocusing the projector can improve the accuracy of phase matching, which in turn affects the accuracy of three-dimensional point cloud measurement. Because the focus distance of the projector needs to be continuously adjusted during the defocusing process, manual focusing will inevitably lead to certain errors and low efficiency. The use of an electrically controlled focusing lens can not only avoid the errors caused by manual focusing, but also avoid the cumbersome procedures of manual focusing. Therefore, in order to realize the experiment and performance evaluation of the automatic defocus projection surface morphology measurement, it is necessary to establish an accurate model of the projection optical focusing process and formulate a set of electrically controlled focusing schemes to achieve real-time focusing of the adjustable focus (zoom) lens group. Summary of the invention
[0005] The present invention aims to provide an automatic defocusing method based on a binocular fringe projection measurement system. In order to solve the phenomenon that the focusing of the projector lens in the fringe projection measurement system causes the measurement accuracy to change, it is proposed to automatically and appropriately defocus the projector during the measurement process to project fringe stripes that are closer to sinusoidal, thereby obtaining better point cloud measurement accuracy.
[0006] In order to achieve the above object, the scheme of the present invention is:
[0007] An automatic defocusing method based on a binocular fringe projection measurement system comprises the following steps:
[0008] Step 1, installing an electrically controlled focusing lens on the projector based on the binocular fringe projection measurement system;
[0009] Step 2, inputting the number of revolutions into the computer to adjust the focus of the electronically controlled focusing lens in real time;
[0010] Step 3, obtaining the optimal defocus degree corresponding to different object distances through experiments, so as to effectively improve the measurement accuracy and realize the automation of defocus measurement.
[0011] Among them, the electrical control system of the electric control focusing lens in step 1 is divided into three parts: a zoom module, a single-chip control module and an MCU firmware program. The zoom module is installed on the electric control focusing lens and is connected to the single-chip control module to control the focal length of the projector; the computer is connected to the single-chip control module to provide power and communicate with the single-chip control module in real time through the MCU firmware program.
[0012] Among them, in the experimental stage of step 3, a plane calibration plate is fixed at different object distances, and then focusing is performed. The object distance represents the focusing distance of the projector, and the number of lens revolutions of the projector at this time is recorded to determine the functional relationship between the focusing distance and the number of lens revolutions.
[0013] Among them, special patterns are designed to determine whether the projectors at different positions are accurately focused.
[0014] Wherein, the special pattern is a "cross" shape and an "X" shape.
[0015] In the experimental stage of step 3, a binocular fringe projection measurement system is built to measure the flatness of the plane calibration plate at different defocus levels.
[0016] The plane calibration plate is placed at an object distance, and the rotation speed of the projector lens is continuously adjusted by a computer to obtain different defocus degrees, and then measurements are performed. After that, the object distance is continuously changed and measurements are performed again at different defocus degrees, while the other parameters remain unchanged.
[0017] Wherein, when measuring the flatness of the plane calibration plate, a calibration plate made of a composite material is used to strictly require the flatness of the flat plate.
[0018] Among them, in step 3, determining the variation rule of the optimal defocus degree at different object distances requires adjusting the projector to the optimal defocus degree at different object distances, recording the number of rotations of the zoom lens at this time, and determining the functional relationship between the object distance and the number of rotations of the lens.
[0019] Among them, step 3 realizes the automation of defocus measurement, calculates the lens rotation number according to the known object distance through the functional relationship between the object distance and the lens rotation number, and inputs this lens rotation number into the MCU firmware program of the computer. At this time, the zoom lens will automatically rotate to the best defocus state, and then perform fringe projection measurement.
[0020] The beneficial result of the present invention is: a method for automatic defocusing of a projector lens is proposed, which can realize the automation of defocus measurement and effectively improve the measurement accuracy. The method has its potential commercial value and provides a high-precision and high-efficiency measurement method for complex surface quality control in intelligent manufacturing. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 It is a system structure diagram of the present invention.
[0022] Figure 2 It is a schematic diagram of the host computer interface of the single-chip control module of the present invention.
[0023] Figure 3 It is a power supply principle diagram of the single chip microcomputer control module of the present invention.
[0024] Figure 4 It is a schematic diagram of the incremental encoder interface of the single chip microcomputer control module of the present invention.
[0025] Figure 5 The invention relates to a real-time electric power detection system for a motor of a single-chip microcomputer control module.
[0026] Figure 6 It is a schematic diagram of the MCU (microcontroller unit) of the present invention.
[0027] Figure 7 It is the flow chart of motor initialization of the present invention.
[0028] Description of reference numerals:
[0029] 1-left camera, 2-right camera, 3-projector, 4-electrically controlled focusing lens, 5-single-chip microcomputer, 6-computer. DETAILED DESCRIPTION
[0030] A specific embodiment and working principle of the automatic defocusing method are further described below in conjunction with the accompanying drawings.
[0031] like Figure 1 As shown, the system of the present invention includes a projector 3 connected to a computer 6 for projecting patterns. An electric focus lens 4 is installed at the front end of the projector 3, and the electric focus lens 4 is connected to the computer 6 through a single chip microcomputer 5 to adjust the focal length of the projector 3.
[0032] The left camera 1 and the right camera 2 are respectively arranged on the left and right sides of the projector 3 and connected to the computer 6 to shoot the projection of the projector 3 and transmit the result to the computer 6 .
[0033] The electric focusing system uses a finished electric focusing lens with a micro zoom ring and a focusing ring, which is suitable for installing a reduction motor. Due to the size limitation, the incremental encoder is unlikely to accumulate too many revolutions, so a micro magnetoelectric encoder with a higher line count is proposed. The QY1503-CDZ mini encoder from Dongguan Aokate was finally used, which has ABZ three-way signal output, single-turn single-phase 1024 lines (AB phase is equivalent to 4096 lines after four-fine resolution circuit), and the equivalent focusing ring angular resolution is about 0.9', which can meet the needs of precise focusing ring positioning.
[0034] To complete the fixation of the high-resolution encoder, it is necessary to comprehensively consider the size of the reduction motor assembly, the gear module and pitch circle diameter of the electric focusing system, the position of the encoder fixing hole and the length of the output shaft, the size of the standard module gears that can be selected, and the existing gear parameters on the reduction motor. Finally, 6063 aluminum alloy was used to make the encoder fixing unit. After mapping and calculating the pitch circle diameter compensation of the gears of the reduction mechanism (there is displacement if the number of teeth is too small), the encoder connection gear is made of 30 teeth and 0.8 module polyformaldehyde resin. In order to ensure the minimum number of teeth without interference and effective meshing, it is finally fixed at an angle with the encoder 3mm output shaft using a top screw.
[0035] The aluminum fixing plate adopts the design of left through hole and right adjustment hole. A certain pressure is applied during installation, and the adjustment hole is pre-tightened and locked with screw glue to ensure the accurate engagement of the encoder gear and the focusing gear.
[0036] This prototype adopts a double-layer stacking design: the upper layer is a four-layer printed circuit board design, which mainly realizes the functions of power supply, MCU, sensor interface and signal conditioning, and host computer communication; the lower layer is a double-sided printed circuit board design that realizes the multi-channel DC motor power drive interface and current monitoring over-current disconnection function. The stacking solution adopts the common 2.54mm pitch double-row pin socket, and uses copper pillars of appropriate height to lock the stack.
[0037] like Figure 2The host computer interface is an integrated design for power supply and communication. The physical interface uses the currently popular simplified USB Type-c connector (USB 2.0). Ordinary Type-c data cables can withstand currents above 1A, which is sufficient for 2 to 3 deceleration and focusing motor control systems. Two USB2.0 data cables are also used to access the CP2102N USB-UART bridge, and connected to the USART1 interface of the MCU as the main communication interface, and the common signal line connection for STM32 Bootloader serial port download is reserved.
[0038] like Figure 3 In addition to direct USB power supply, in order to adapt to motors with more channels in the future, the system also has a spare 5mm coaxial power input interface, which uses automatic disconnection to power the motor separately.
[0039] like Figure 4 The incremental encoder interface is designed with two channels, and a six-pin interface is used to match the encoder. While supplying power to the encoder, the encoder's ABZ three-channel output signals are introduced into the MCU in parallel. The MCU uses the counting mode of the incremental encoder dedicated interface to realize automatic addition and subtraction counting. In order to obtain the absolute amount, the Z phase input microcontroller 5 is also processed by hardware input capture to accurately capture the single-turn starting point of the encoder.
[0040] like Figure 5 The motor real-time power detection system uses multiple integrated single-channel H-bridge driver chips DRV8876 as the driver of the DC reduction motor. The chip itself integrates the current sampling function and has a buffer output interface. After the maximum current is set by connecting a resistor to the ground, the voltage generated represents the real-time current of the motor. Since the pulse width modulation scheme is used to control the DC motor, the real-time current, as an important parameter of the inner control loop, cannot change at high frequency with the pulse width modulation. In addition to driving the analog-to-digital converter module to adopt a long sampling method, the real-time current signal output by the DRV8876 is filtered and buffered with a suitable time constant through a secondary operational amplifier, and finally input into the analog-to-digital converter sampling unit of the MCU.
[0041] like Figure 6The MCU of this design adopts an STM32F446RG, which has a Cortex-M4 core and a main frequency of 168MHz. It has sufficient IO resources and various multi-functional peripherals. The hardware solution mainly uses a 12-bit analog-to-digital converter, which is responsible for current sampling and potentiometer position sampling, counter and encoder automatic counting capture. The solution also adds a CR2032 button battery, and uses the MCU's backup power system to process the encoder data in a non-volatile manner. Each time the system finds the encoder Z-phase zero point position, it is recorded in the backup power area, and there is no need to mechanically reset it after each restart.
[0042] The MCU firmware needs to realize communication with the host computer, real-time acquisition of motor status, and dual closed-loop control. In addition, an independent shell function needs to be added for debugging convenience. For a single-core MCU, there are many tasks to run. Finally, FreeRTOS was used as the real-time operating system of the MCU, and three tasks and high-real-time interrupt processing service programs were abstracted. Among them, the shell task has the lowest priority but runs all the time; the host computer communication task has a slightly higher priority, and is triggered by the serial port to release the blocking condition to run; the motor control task has the highest priority, and the timing mechanism of the operating system's non-shieldable advanced interrupt is used to periodically wake up the task. Other acquisitions include motor position and current, periodic interrupts, and all hardware timers trigger each other to achieve.
[0043] Since two sets of gear meshing mechanisms simultaneously complete the focusing and position measurement of the electric focus lens 4, there is no complex elastic mechanical preload mechanism in the case of only one-stage transmission. Instead, an improvement is made from the positioning motion strategy to approach the required absolute focusing position from only one direction. The positioning strategy of single-direction approach is implemented in the form of a firmware program. After power-on, the system is initialized first. The initialization process is as follows: Figure 7 . First, the system is reset or powered on, then the peripherals are initialized, and the battery backup area is checked for valid data. If so, the backup area data is read and written back to the peripheral registers, and the mechanical limits and zero values are written; if not, the motor test operation is mechanically initialized, the motor turns to the left and right mechanical zero points, and then the mechanical limits are written to the zero point value, and finally the communication side is initialized to output the current register information. The register information is output to the main task loop, and the main task obtains information from the host computer for positioning. After successful positioning, the information is written to the battery backup area and returned to the host computer. The acquisition of motor parameters in the main task loop relies on the dual-loop PID control algorithm.
[0044] Host computer communication and protocol processing are independent tasks, and data exchange is carried out through a unified controller attribute table.
[0045] The communication parameters of the microcontroller USART1 interface are: baud rate 115200, 8 data bits, 1 stop bit, no parity check. The following table is the unified attribute table of the controller.
[0046]
[0047] The following table shows the format of the communication protocol. The communication protocol is drafted using highly readable ASCII code.
[0048] From computer to controller:
[0049]
[0050] Among them, the instruction R is read, W is write, RO is read-only, and D represents data. For example: $R2# means reading the current speed value, $R5# means reading the left limit speed value, $R6# means reading the right limit speed value, and $W3D22000# means writing the speed value to 22000.
[0051] From controller to computer (reply):
[0052] Protocol frame header Response Type Protocol frame tail $ RSE #
[0053] The reply type R is the reply for reading data, and the reply content is the object number and D plus data. S is the asynchronous automatic reply for system status update, which is initialized to 0, 2 in action, and 1 in no action. E is the error number: 0 no error (used to reply to host write command), 1 command error, 2 data limit exceeded, 3 permission error, 4...customized, and # is the end of the protocol frame.
[0054] The control algorithm for the rotation of the focus motor is finally implemented as a double closed loop with a small speed loop and a large position loop. Incremental PID algorithms are used in the implementation, in which the position loop uses a control loop with P combined with a small I dead zone, and the current loop determines the torque of the DC motor. The torque curve is planned at the beginning of each positioning task to form a ramp up and ramp down curve. Only PD parameters are used in the curve approximation to quickly achieve the most appropriate torque output and reduce overshoot to reduce the demand on the power system.
[0055] The system algorithm control cycle is 10ms. The crystal oscillator drives the counter to determine and time the encoder data. The encoder data is stored in advance for the last 10ms to record the increment to reflect the actual running speed. At the same time, the analog-to-digital converter is triggered to sample once every 10ms to obtain the current value represented by the corresponding DRV8876 voltage feedback output. These two sets of data are passed to the motor control task in the form of global variables during this cycle. The task performs output calculations and outputs the final result to the pulse width modulation channel corresponding to the motor channel.
[0056] From the experimental process, it is observed that the final error of the value after the position closed loop adjustment (a dead zone of ±2 counts is set) can reach ±1 encoder count, and the corresponding physical error of the focus ring (the rotation angle of the focus ring, calculated based on the transmission ratio and the rack angle coverage) is less than 1.8′, which meets the expected goal of focus position control.
[0057] The specific steps of automatic defocusing are as follows:
[0058] (1) Build a binocular fringe projection measurement system, install the electric-controlled focusing lens 4 on the projector 3, design special patterns (such as "cross" and "X" shapes) to determine whether the projector 3 is accurately focused, determine the corresponding focusing distance for different rotation speeds of the electric-controlled focusing lens 4 of the projector 3, and establish a relationship function between the rotation speed and the focusing distance.
[0059] The electrical control system of the electric-controlled focusing lens 4 is divided into three parts: a zoom module, a single-chip microcomputer 5 control module and an MCU firmware program. The zoom module is installed on the electric-controlled focusing lens 4 of the projector 3 and is connected to the single-chip microcomputer 5 control module to control the focal length of the projector 3; the computer 6 is connected to the single-chip microcomputer 5 control module to provide power and communicate with the single-chip microcomputer control module in real time through the MCU firmware program.
[0060] (2) The object distance of the fringe projection system is set to 400 mm to 600 mm, with an interval of 50 mm each time. A plane calibration plate is fixed at the object distance, and the flatness of the plane calibration plate is measured at different defocus levels. When measuring the flatness of the plane calibration plate, a composite material calibration plate is used to strictly require the flatness of the flat plate.
[0061] Keeping other parameters of the projector 3 such as brightness, exposure time, number of fringes unchanged, input the number of revolutions into the computer 6, and adjust the focus of the electrically controlled focusing lens 4 of the projector 3 in real time. First, set the focus distance of the projector 3 to the object distance, and then adjust the electrically controlled focusing lens 4, rotating 200 revolutions each time, measure the point cloud of the plane calibration plate, and finally calculate the plane fitting standard error.
[0062] (3) The experiment established a functional relationship between the four revolutions of the electric-controlled focusing lens and the standard error of the plane fitting through third-order polynomial fitting at different object distances, and calculated the minimum value of the polynomial. The four revolutions of the electric-controlled focusing lens corresponding to the minimum value was the optimal defocusing revolution corresponding to the current object distance.
[0063] Then the optimal defocusing rotation number corresponding to each object distance is calculated, and the functional relationship between the object distance and the optimal defocusing rotation number is established by third-order polynomial fitting.
[0064] (4) Finally, in the actual measurement process, the initial object distance is first determined, and then the optimal defocusing speed of the electric-controlled focusing lens 4 is determined based on the functional relationship between the object distance and the optimal defocusing speed in (3). The speed of the electric-controlled focusing lens 4 is input into the MCU firmware program on the computer side, and the electric-controlled focusing lens 4 automatically focuses to the optimal defocusing state, projects a group of fringes, and then performs fringe projection measurement. This achieves high-precision, automated fringe projection measurement.
[0065] As described above, an automatic defocusing method based on a binocular fringe projection measurement system proposed by the present invention has been clearly described in detail.
[0066] It should be noted that the above is only an embodiment of the present invention, which is only to explain the present invention and does not limit the patent scope of the present invention. Any obvious changes that belong to the technical concept of the present invention are also within the protection scope of the present invention.
Claims
1. An automatic defocusing method based on a binocular fringe projection measurement system, characterized in that: The steps include: Step 1, installing an electrically controlled focusing lens on the projector based on the binocular fringe projection measurement system; Step 2, inputting the number of revolutions into the computer to adjust the focus of the electronically controlled focusing lens in real time; Step 3, obtaining the optimal defocus degree corresponding to different object distances through experiments, so as to effectively improve the measurement accuracy and realize the automation of defocus measurement; In the experimental stage of step 3, a plane calibration plate is fixed at different object distances, and then focusing is performed. The object distance represents the focusing distance of the projector, and the number of lens revolutions of the projector at this time is recorded to determine the functional relationship between the focusing distance and the number of lens revolutions.
2. The automatic defocusing method based on the binocular fringe projection measurement system according to claim 1, characterized in that: The electrical control system of the electric control focusing lens in step 1 is divided into three parts: a zoom module, a single-chip control module and an MCU firmware program, wherein the zoom module is installed on the electric control focusing lens and is connected to the single-chip control module to control the focal length of the projector; The computer is connected to the single-chip microcomputer control module to provide power and communicate with the single-chip microcomputer control module in real time through the MCU firmware program.
3. The automatic defocusing method based on the binocular fringe projection measurement system according to claim 1, characterized in that Special patterns are designed to determine whether the projector is accurately focused at different positions.
4. The automatic defocusing method based on the binocular fringe projection measurement system according to claim 3, characterized in that: The special patterns are "cross" and "X" shapes.
5. The automatic defocusing method based on the binocular fringe projection measurement system according to claim 1, characterized in that: In the experimental stage of step 3, a binocular fringe projection measurement system is built to measure the flatness of the planar calibration plate at different defocus levels.
6. The automatic defocusing method based on the binocular fringe projection measurement system according to claim 5, characterized in that: The plane calibration plate is placed at an object distance, and the rotation speed of the projector lens is continuously adjusted by a computer to obtain different defocus degrees, and then measurements are performed. After that, the object distance is continuously changed and measurements are performed again at different defocus degrees, while the other parameters remain unchanged.
7. The automatic defocusing method based on the binocular fringe projection measurement system according to claim 5, characterized in that: When measuring the flatness of the plane calibration plate, a calibration plate made of a composite material is used to strictly require the flatness of the plane calibration plate.
8. The automatic defocusing method based on the binocular fringe projection measurement system according to claim 1, characterized in that: To determine the variation rule of the optimal defocus degree at different object distances in step 3, it is necessary to adjust the projector to the optimal defocus degree at different object distances, record the number of rotations of the zoom lens at this time, and determine the functional relationship between the object distance and the number of rotations of the lens.
9. The automatic defocusing method based on the binocular fringe projection measurement system according to claim 1, characterized in that: Step 3 realizes the automation of defocus measurement. The lens rotation number is calculated based on the known object distance through the functional relationship between the object distance and the lens rotation number, and the lens rotation number is input into the MCU firmware program of the computer. At this time, the zoom lens will automatically rotate to the best defocus state, and then the fringe projection measurement is performed.
Citation Information
Patent Citations
Novel projector automatic focusing control system
CN103324019A
Fringe projection measurement method based on dynamic focusing principle
CN111750803A