A method for spatial positioning using a single camera with three targets
By employing a three-target single-camera method, spatial positioning calculations are performed using a liquid crystal light valve and a single camera, solving the problem of high hardware costs and achieving high-precision and real-time spatial positioning calculations.
Patent Information
- Application Number
- CN202311287551.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-08
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2043-10-08
AI Technical Summary
In existing technologies, the use of multiple cameras or multiple targets leads to high hardware costs. How can spatial positioning calculation be achieved while reducing hardware configuration?
The method employs a three-target single-camera approach, using an ultra-low power microcontroller to control a liquid crystal light valve and a reflector to form alternating bright and dark light spots. This is combined with a visible light industrial camera for high-frequency photography, and a computer is used to calculate the three-dimensional coordinates of the target in the world coordinate system.
It achieves high-precision spatial positioning with the most economical hardware configuration, simplifies positioning calculation requirements, reduces hardware costs, and has real-time calculation capabilities.
Smart Images

Figure CN117191043B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of optical positioning measurement, and more specifically, to a method for achieving spatial positioning using a single camera with three targets. Background Technology
[0002] With the development of camera technology, the pixel count and functionality of our everyday mobile phones are constantly increasing; industrial cameras are also becoming increasingly sophisticated. Furthermore, with the advancement of electronic technology, the cost of liquid crystal light valves and microcontrollers is decreasing; these products are readily available on Taobao and JD.com at increasingly lower prices. Therefore, the overall cost of using liquid crystal light valves and microcontrollers to drive target fabrication is very low. Based on these reasons, using liquid crystal light valve targets and visible light industrial cameras to achieve optical positioning of objects has increasing advantages. However, considering the physical limitations and geometric relative position limitations in the calculation process, the mainstream methods are currently based on a multi-camera architecture, requiring at least two or three cameras for easier calculation. Furthermore, using a single camera requires multiple targets, generally six or eight or more; the more targets, the simpler the calculation method. How to reduce hardware configuration, the number of cameras, and the number of targets to maximize economic savings while still achieving optical positioning calculation is undoubtedly a highly valuable problem. Based on the above reasons, this invention proposes a spatial positioning optical solution method under a simplified hardware configuration of a three-target single camera, which has high economic value and market application value.
[0003] It should be noted that the information in the background section above is only used to enhance the understanding of the background of the present invention, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0004] The purpose of this invention is to provide a method for spatial positioning using a three-target single camera, thereby overcoming the problem of excessive hardware costs caused by the large number of targets and camera devices required for visible light positioning calculations due to limitations in related technologies.
[0005] According to one aspect of the present invention, a method for spatial positioning using a three-target single camera is provided, comprising the following five steps:
[0006] Step S10: A control circuit is composed of an ultra-low power microcontroller. A target module system is composed of a button battery, a liquid crystal light valve, a reflector, and a control circuit. The microcontroller program sets the target flashing period and controls the target to form alternating bright and dark light spots for output.
[0007] Step S20: According to the design method of the target module system described above, three targets are fabricated and adhered to predetermined positions on the moving object being tested using strong adhesive. The first target is located at the center of the object, and the other two targets are arbitrarily selected and offset by a certain distance. Then, the spatial distance between the three targets is measured. Based on the target flashing cycle, a visible light industrial camera is set up at a predetermined location, and the continuous shooting frequency of a single industrial camera is set. The industrial camera is connected to a computer to read the image data, and the pixel positions of the three targets in the image are located based on the target highlights in the camera image. Then, the pixel positions of the three targets in the image are detected.
[0008] Step S30: Based on the pixel positions of the three targets in the camera image, calculate the relative distance between the camera's horizontal pixels and the relative distance between the camera's vertical pixels for the three targets respectively; calculate the camera's horizontal comprehensive coefficient and the camera's vertical comprehensive coefficient based on the known calibrated internal and external parameters of the industrial camera lens; finally, calculate the comprehensive position coefficient of the three targets related to the camera based on the aforementioned relative distance between the camera's horizontal pixels and the relative distance between the camera's vertical pixels, as well as the camera parameters.
[0009] Step S40: Based on the comprehensive position coefficients of the first, second, and third targets related to the camera, solve the six linear position relationship equations for the three targets; then, based on the spatial position relationship of the three targets, form three nonlinear spatial distance relationship equations; finally, combine them into a nonlinear equation set for solving the spatial positioning of the three targets with a single camera.
[0010] Step S50: Based on the nonlinear equations of the three-target single-camera spatial positioning, the computer is used to solve the equations to obtain the three-dimensional coordinates of the three targets in the world coordinate system; then, the three-dimensional coordinates of the first target in the world coordinate system are selected as the spatial positioning coordinates of the object being measured, and the computer camera captures images at the specified frequency to output the final spatial position coordinates of the moving body.
[0011] Furthermore, the target module system consists of a liquid crystal light valve (including a reflector and a button battery) and a control circuit board. The liquid crystal light valve and the control circuit board are flexibly connected, and the liquid crystal light valve is located on the underside of the control circuit board.
[0012] Furthermore, the control circuit board controls the intermittent bright and dark light spot output of the liquid crystal shutter in the following way: according to the characteristics of the liquid crystal shutter, the power input terminal of the liquid crystal shutter is set to a high level, and a low level is set when a light spot needs to be formed and maintained for a period of time, thus forming a stroboscopic light spot similar to an active light emission.
[0013] Furthermore, the spatial distance between the three targets is measured, and the three-dimensional spatial distance between the first target and the second target is denoted as d.12 The three-dimensional spatial distance between the first target and the third target is denoted as d. 13 The three-dimensional spatial distance between the second and third targets is denoted as d. 23 .
[0014] Furthermore, the pixel position of the first target captured by the camera in the photograph is denoted as (u). 1i ,v 1i ), where i is an integer representing the pixel position at a time interval of T, which is (u 1i ,v 1i Let (u) represent the pixel position of the first target in the camera image at time t = Ti. Similarly, the pixel position of the second target in the image obtained by the camera is denoted as (u). 2i ,v 2i ), that is (u 2i ,v 2i The value represents the pixel position of the second target in the camera image at time t = Ti.
[0015] In one exemplary embodiment of the present invention, the relative distance between the horizontal pixels of the three targets and the relative distance between the vertical pixels of the three targets are calculated based on the pixel positions of the three targets in the camera image. The relative distance between the horizontal pixels and the relative distance between the vertical pixels of the camera are calculated based on the known calibrated internal and external parameters of the industrial camera lens, including:
[0016] m a1i =(u 1i -u 10 );
[0017] n a1i =(v 1i -v 10 );
[0018] m a2i =(u 2i -u 10 );
[0019] n a2i =(v 2i -v 10 );
[0020] m a3i =(u 3i -u 10 );
[0021] n a3i =(v 3i -v 10 );
[0022]
[0023]
[0024] Where u 10 v 10 This represents the x and y coordinates of the pixel position in the pixel coordinate system, indicating the center of the camera's image coordinate system. These are internal parameters of the camera, obtainable from the camera manufacturer or through self-measurement and calibration; the acquisition process will not be elaborated upon here. a1i n is the relative distance between the camera's horizontal pixels to the first target; a1i The vertical pixel distance between the first target and the camera is m. a2i n is the relative distance between the camera's horizontal pixels to the first target; a2i The vertical pixel distance between the camera and the second target is m. a3i n is the relative distance between the camera's lateral pixels to the third target; a3i The vertical pixel distance between the camera and the third target is given. Here, f1 is the camera focal length, and c... x1 c y1 The parameters are the actual physical dimensions of each pixel in the x and y directions of the camera image. These parameters are internal camera parameters, which can be obtained from the camera manufacturer or through self-measurement and calibration. The acquisition process will not be elaborated here. m1 is the camera's horizontal composite coefficient, and n1 is the camera's vertical composite coefficient.
[0025] In one exemplary embodiment of the present invention, the calculation of the comprehensive position coefficient of the camera related to the three targets based on the relative horizontal pixel distance, the relative vertical pixel distance, and camera parameters of the three targets includes:
[0026] g 11i =m a1i r 31 -m1r 11 ;
[0027] g 12i =m a1i r 32 -m1r 12 ;
[0028] g 13i =m a1i r 33 -m1r 13 ;
[0029] g 14i =-m a1i t3+m1t1;
[0030] g 15i =n 1ai r 31 -n1r 21 ;
[0031] g 16i =n 1ai r 32 -n1r 22 ;
[0032] g 17i =n 1ai r 33 -n1r 23 ;
[0033] g 18i =-n 1ai t3+n1t2;
[0034] g 21i =m a2i r 31 -m1r 11 ;
[0035] g 22i =m a2i r 32 -m1r 12 ;
[0036] g 23i =m a2i r 33 -m1r 13 ;
[0037] g 24i =-m a2i t3+m1t1;
[0038] g 25i =n 2ai r 31 -n1r 21 ;
[0039] g 26i =n 2ai r 32 -n1r 22 ;
[0040] g 27i =n 2ai r 33 -n1r 23 ;
[0041] g 28i =-n 2ai t3+n1t2;
[0042] g 31i =m a3i r 31 -m1r 11 ;
[0043] g32i =m a3i r 32 -m1r 12 ;
[0044] g 33i =m a3i r 33 -m1r 13 ;
[0045] g 34i =-m a3i t3+m1t1;
[0046] g 35i =n 3ai r 31 -n1r 21 ;
[0047] g 36i =n 3ai r 32 -n1r 22 ;
[0048] g 37i =n 3ai r 33 -n1r 23 ;
[0049] g 38i =-n 3ai t3+n1t2;
[0050] Where t1, t2, and t3 are three axial translation parameters between the camera's camera coordinate system and the world coordinate system; r 11 ,r 12 ,r 13 ,r 21 ,r 22 ,r 23 ,r 31 ,r 32 ,r 33 These are the nine rotational parameters of the camera. The above 12 parameters are the external parameters of the camera, which can be obtained through measurement and calibration. Since there are many related general calibration methods, and they are not the focus of this invention, they will not be elaborated here. 11i g 12i g 13i g 14i g 15i g 16i g 17i g 18i This is the overall position coefficient of the first target related to the camera. 21i g 22i g 23i g 24ig 25i g 26i g 27i g 28i This refers to the combined position coefficient of the second target related to the camera. 31i g 32i g 33i g 34i g 35i g 36i g 37i g 38i This is the comprehensive position coefficient of the third target related to the camera.
[0051] In one exemplary embodiment of the present invention, based on the camera-related first target comprehensive position coefficient, camera-related second target comprehensive position coefficient, and camera-related third target comprehensive position coefficient, a system of six linear positional relationship equations for the three targets is solved; then, based on the spatial positional relationship of the three targets, a system of three nonlinear spatial distance relationship equations is formed, including:
[0052]
[0053]
[0054]
[0055] (x w1 -x w2 ) 2 +(y w1 -y w2 ) 2 +(z w1 -z w2 ) 2 =d 12 ;
[0056] (x w1 -x w3 ) 2 +(y w1 -y w3 ) 2 +(z w1 -z w3 ) 2 =d 13 ;
[0057] (x w2 -x w3 ) 2 +(y w2 -y w3 ) 2 +(z w2 -z w3 ) 2 =d23 ;
[0058] Where x w1 ,y w1 ,z w1 Let x, y, and z be the coordinates of the first target in the world coordinate system; x w2 ,y w2 ,z w2 Let x, y, and z be the coordinates of the second target in the world coordinate system; x w3 ,y w3 ,z w3 Let x, y, and z be the coordinates of the third target in the world coordinate system.
[0059] Beneficial effects
[0060] This invention provides a method for spatial positioning using a single camera with three targets, and its main innovations are as follows:
[0061] Firstly, a system architecture method is proposed that uses a three-target liquid crystal light valve and a single camera to achieve high-precision spatial positioning and measurement. Because it uses a single camera, the overall system construction cost is the lowest. Simultaneously, the three targets, operating under a single camera, can achieve positioning calculations, complete all parameter calculations, and determine the minimum number of targets required for positioning. Therefore, the configuration of three targets and a single camera represents the most economical and optimal implementation solution currently available. Due to its optimal hardware architecture and cost-effectiveness, this technical solution possesses high innovative value, engineering practical value, and market application and promotion value.
[0062] Secondly, this invention proposes a complementary algorithm for spatial positioning calculation, based on a three-target single-camera external hardware and reliant on solving a system of nine unknown nonlinear equations. This algorithm is highly innovative, leveraging the powerful computational capabilities of computers to solve complex positioning problems. Therefore, this invention has minimal hardware requirements but high algorithmic requirements. Current traditional positioning methods either employ more targets or two or more cameras, simplifying the calculation; or they use multi-point data fusion to approximate a single point, which significantly reduces positioning accuracy and fails to meet real-time calculation requirements. Furthermore, these methods often fail to complete the calculation correctly due to unsolvable equations. Therefore, the method provided in this invention offers a novel approach and possesses significant innovative value.
[0063] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description
[0064] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention. It is obvious that the drawings described below are merely some embodiments of the invention, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0065] Figure 1 This is a flowchart of a method for spatial positioning using a single camera with three targets, provided by the present invention.
[0066] Figure 2 This is a schematic diagram of the target module system device structure of the method provided in the embodiment of the present invention;
[0067] Figure 3 This is a schematic diagram of the liquid crystal light valve of the method provided in the embodiment of the present invention;
[0068] Figure 4 This is a schematic diagram of the liquid crystal light valve flickering method provided in the embodiments of the present invention;
[0069] Figure 5 This is a physical experimental image of the liquid crystal light valve flickering experiment provided by the embodiment of the present invention;
[0070] Figure 6 This is a graph showing the motion displacement of the tested object along the x-axis of the world coordinate system within 1 second, as provided in the embodiments of the present invention.
[0071] Figure 7 This is a graph showing the motion displacement of the tested object along the y-axis in the world coordinate system within 1 second, as provided in the embodiments of the present invention.
[0072] Figure 8 This is a graph showing the motion displacement of the tested object along the y-axis in the world coordinate system within 1 second, as provided in the embodiments of the present invention. Detailed Implementation
[0073] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make the invention more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art. The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a full understanding of embodiments of the invention. However, those skilled in the art will recognize that the technical solutions of the invention may be practiced with one or more of these specific details omitted, or other methods, components, apparatus, steps, etc., may be employed. In other instances, well-known technical solutions are not shown or described in detail to avoid obscuring various aspects of the invention.
[0074] This invention provides a method for spatial positioning using a three-target single-camera system. A microcontroller controls a target system consisting of a liquid crystal light valve, a button battery, and a reflector to actively flash light. Three targets are then fixed to the object being measured, and an industrial camera continuously captures high-frequency images of the three targets. By extracting the target position pixels from the images and calculating the combined position coefficients of the three targets based on the camera's internal and external parameters, six linear positional relationship equations for the three targets are constructed. Based on the spatial positional relationships of the three targets, three sets of nonlinear spatial distance equations are formed. These equations are then combined to form the nonlinear equations for three-target single-camera spatial positioning. A computer is used to solve these nonlinear equations to obtain the target position coordinates. Finally, the computer outputs the final position coordinates of the moving object according to the camera's shooting frequency, thus completing the entire optical positioning calculation.
[0075] Below, we will combine the appendix Figure 1 The present invention provides a further explanation and description of a method for spatial positioning using a three-target single camera. (See references) Figure 1 As shown, this method for spatial positioning using a three-target single camera includes the following steps:
[0076] Step S10: A control circuit is composed of an ultra-low power microcontroller. A target module system is composed of a button battery, a liquid crystal light valve, a reflector, and a control circuit. The microcontroller program sets the target flashing period and controls the target to form alternating bright and dark light spots for output.
[0077] Specifically, the target module system equipment structure diagram is as follows: Figure 2 As shown in the diagram. The target module consists of two parts: a liquid crystal light valve (including a reflector and a button battery) and a control circuit board. A schematic diagram of the key component, the liquid crystal light valve, is shown below. Figure 3 As shown.
[0078] A button cell battery is used as the power source; preferably, a CR2032 button cell battery is selected in this case. A control circuit composed of an ultra-low-power microcontroller controls the liquid crystal shutter to output intermittent bright and dark light spots. Based on the characteristics of the liquid crystal shutter, the power input terminal is set to a high level, and a low level is set at the moment when a light spot needs to be formed, and maintained for a period of time, thus creating a strobe effect similar to active light emission. Figure 4 As shown. Preferably, in this example, the target flashing period is selected to be 5ms; the actual experimental image of the liquid crystal light valve flashing is shown below. Figure 5 As shown, there are general methods and programs for controlling the liquid crystal light valve to output light spots using a microcontroller, which are not the focus of this invention and will not be elaborated here.
[0079] Step S20: According to the design method of the target module system described above, three targets are fabricated and adhered to predetermined positions on the moving object being tested using strong adhesive. The first target is located at the center of the object, and the other two targets are arbitrarily selected and offset by a certain distance. Then, the spatial distance between the three targets is measured. Based on the target flashing cycle, a visible light industrial camera is set up at a predetermined location, and the continuous shooting frequency of a single industrial camera is set. The industrial camera is connected to a computer to read the image data, and the pixel positions of the three targets in the image are located based on the target highlights in the camera image. Then, the pixel positions of the three targets in the image are detected.
[0080] Specifically, it can be broken down into the following four steps. First, based on the design method of the target module system described above, three targets are fabricated and attached to the predetermined positions of the moving object being tested using strong adhesive.
[0081] The second step is to measure the spatial distance between the three targets, and denote the three-dimensional spatial distance between the first target and the second target as d. 12 The three-dimensional spatial distance between the first target and the third target is denoted as d. 13 The three-dimensional spatial distance between the second and third targets is denoted as d. 23 .
[0082] The third step is to set up a visible light industrial camera at a predetermined location according to the target flashing cycle, and set the continuous shooting frequency of a single industrial camera.
[0083] Preferably, in this example of the invention, the continuous shooting frequency is selected as 400 frames per second, that is, one shot is taken every 2.5ms. In this case, T=0.0025 is selected, so that two shots are taken in the 5ms target flashing cycle. Therefore, the target flashing spot bright spot can be captured in the two 10ms target flashing cycles.
[0084] The fourth step is to connect the industrial camera to the computer to read the photo data. Based on the target highlights in the camera photo, the pixel positions of the three targets in the photo are located and the pixel positions of the three targets in the photo are detected.
[0085] Since the target bright spot is circular, there are already mature and universal methods for locating the target pixel position in the photo based on the target flashing light spot bright spot in the camera photo, and the technical difficulty is not high; it is not the focus of protection and attention of this invention patent, so it will not be elaborated here.
[0086] In this case, T = 0.0025, and the pixel position of the first target captured by the camera in the photo is denoted as (u). 1i ,v 1i ), where i is an integer representing the pixel position at a time interval of 2.5ms, which is (u 1i ,v 1i () represents the pixel position of the first target in the camera image at time t = 0.0025i. Similarly, the pixel position of the second target in the image obtained by the camera is denoted as (u). 2i ,v 2i ), that is (u 2i ,v 2i The value represents the pixel position of the second target in the camera image at time t = 0.0025i.
[0087] Similarly, the pixel position of the third target obtained by the camera in the photo is denoted as (u). 3i ,v 3i ), that is (u 3i ,v 3i The value represents the pixel position of the third target in the camera image at time t = 0.0025i.
[0088] In this case, d is selected. 12 =3,d 13 =3,d 23 =3, forming an equilateral triangle with three target positions.
[0089] Step S30: Based on the pixel positions of the three targets in the camera image, calculate the relative distance between the camera's horizontal pixels and the relative distance between the camera's vertical pixels for the three targets respectively; calculate the camera's horizontal comprehensive coefficient and the camera's vertical comprehensive coefficient based on the known calibrated internal and external parameters of the industrial camera lens; finally, calculate the comprehensive position coefficient of the three targets related to the camera based on the aforementioned relative distance between the camera's horizontal pixels and the relative distance between the camera's vertical pixels, as well as the camera parameters.
[0090] Specifically, this can be broken down into the following five steps. Step 1: Based on the known calibrated internal and external parameters of the industrial camera lens and the pixel positions of the target in the first and second camera images, calculate the relative horizontal pixel distances and vertical pixel distances between the first and second cameras as follows:
[0091] m a1i =(u 1i -u 10 );
[0092] n a1i =(v 1i -v 10 );
[0093] m a2i =(u 2i -u 10 );
[0094] n a2i =(v 2i -v 10 );
[0095] m a3i =(u 3i -u 10 );
[0096] n a3i =(v 3i -v 10 );
[0097] Among them u 10 v 10 This represents the x and y coordinates of the pixel position in the pixel coordinate system, indicating the center of the camera's image coordinate system. These are internal parameters of the camera, obtainable from the camera manufacturer or through self-measurement and calibration; the acquisition process will not be elaborated upon here. a 1 i n is the relative distance between the camera's horizontal pixels to the first target; a1i The vertical pixel distance between the first target and the camera is m. a2i n is the relative distance between the camera's horizontal pixels to the first target; a2i The vertical pixel distance between the camera and the second target is m. a3i n is the relative distance between the camera's lateral pixels to the third target; a3i The relative distance between the camera's vertical pixels for the third target.
[0098] The second step is to calculate the camera's lateral and longitudinal composite coefficients based on the known calibrated internal and external parameters of the industrial camera lens, as follows:
[0099]
[0100]
[0101] Where f1 is the camera focal length, c x1 c y1 The parameters are the actual physical dimensions of each pixel in the x and y directions of the camera image. These parameters are internal camera parameters, which can be obtained from the camera manufacturer or through self-measurement and calibration. The acquisition process will not be elaborated here. m1 is the camera's horizontal composite coefficient, and n1 is the camera's vertical composite coefficient.
[0102] The third step involves calculating the comprehensive position coefficients of the camera relative to the first target based on the known calibrated internal and external parameters of the industrial camera lens, as well as the relative distances between the camera's horizontal and vertical pixels to the first target.
[0103] g 11i =m a1i r 31 -m1r 11 ;
[0104] g 12i =m a1i r 32 -m1r 12 ;
[0105] g 13i =m a1i r 33 -m1r 13 ;
[0106] g 14i =-m a1i t3+m1t1;
[0107] g 15i =n 1ai r 31 -n1r 21 ;
[0108] g 16i =n 1ai r 32 -n1r 22 ;
[0109] g 17i =n 1ai r 33 -n1r 23 ;
[0110] g 18i =-n 1ai t3+n1t2;
[0111] Where t1, t2, and t3 are three axial translation parameters between the camera's camera coordinate system and the world coordinate system; r 11 ,r 12 ,r 13 ,r 21 ,r 22 ,r 23 ,r 31 ,r 32 ,r 33 These are the nine rotational parameters of the camera. The above 12 parameters are the external parameters of the camera, which can be obtained through measurement and calibration. Since there are many related general calibration methods, and they are not the focus of this invention, they will not be elaborated here. 11i g 12i g 13i g 14i g 15i g 16i g 17i g 18i This is the comprehensive position coefficient of the first target related to the camera.
[0112] The fourth step involves calculating the camera-related comprehensive position coefficients for the second target based on the known calibrated internal and external parameters of the industrial camera lens, as well as the relative distances between the camera's horizontal and vertical pixels to the second target.
[0113] g 21i =m a2i r 31 -m1r 11 ;
[0114] g 22i =m a2i r 32 -m1r 12 ;
[0115] g 23i =m a2i r 33 -m1r 13 ;
[0116] g 24i =-m a2i t3+m1t1;
[0117] g 25i =n 2ai r 31 -n1r 21 ;
[0118] g 26i =n 2ai r 32 -n1r 22 ;
[0119] g 27i =n 2ai r 33 -n1r 23 ;
[0120] g 28i =-n 2ai t3+n1t2;
[0121] Where g 21i g 22i g 23i g 24i g 25i g 26i g 27i g 28i This is the comprehensive position coefficient of the second target related to the camera.
[0122] Fifth, based on the known calibrated internal and external parameters of the industrial camera lens, as well as the relative distances between the camera's horizontal and vertical pixels to the third target, the comprehensive position coefficients of the camera related to the third target are calculated as follows:
[0123] g 31i =m a3i r 31 -m1r 11 ;
[0124] g 32i =m a3i r 32 =m1r 12 ;
[0125] g 33i =m a3i r 33 -m1r 13 ;
[0126] g 34i =-m a3i t3+m1t1;
[0127] g 35i =n 3ai r 31 -n1r 21 ;
[0128] g 36i =n 3ai r 32 -n1r 22 ;
[0129] g 37i =n 3ai r 33 -n1r 23 ;
[0130] g 38i =-n 3ai t3+n1t2;
[0131] Where g 31i g 32i g 33i g 34i g 35i g 36i g 37i g 38i This is the comprehensive position coefficient of the third target related to the camera.
[0132] Step S40: Based on the comprehensive position coefficients of the first, second, and third targets related to the camera, solve the six linear position relationship equations for the three targets; then, based on the spatial position relationship of the three targets, form three nonlinear spatial distance relationship equations; finally, combine them into a nonlinear equation set for solving the spatial positioning of the three targets with a single camera.
[0133] Specifically, it can be divided into the following two steps. The first step, based on the combined position coefficients of the first, second, and third targets related to the camera, is to solve the following system of six linear positional relationship equations for the three targets:
[0134]
[0135]
[0136]
[0137] The second step involves constructing three sets of nonlinear spatial distance equations based on the spatial relationships of the three targets, as follows:
[0138] (x w1 -x w2 ) 2 +(y w1 -y w2 ) 2 +(z w1 -z w2 ) 2 =d 12 ;
[0139] (x w1 -x w3 ) 2 +(y w1 -y w3 ) 2 +(z w1 -z w3) 2 =d 13 ;
[0140] (x w2 -x w3 ) 2 +(y w2 -y w3 ) 2 +(z w2 -z w3 ) 2 =d 23 ;
[0141] Where x w1 ,y w1 ,z w1 Let x, y, and z be the coordinates of the first target in the world coordinate system; x w2 ,y w2 ,z w2 Let x, y, and z be the coordinates of the second target in the world coordinate system; x w3 ,y w3 ,z w3 Let x, y, and z be the coordinates of the third target in the world coordinate system. Finally, the above nine equations are combined into a nonlinear equation system for solving the spatial positioning problem of a three-target single-camera system.
[0142] Step S50: Based on the nonlinear equations of the three-target single-camera spatial positioning, the computer is used to solve the equations to obtain the three-dimensional coordinates of the three targets in the world coordinate system; then, the three-dimensional coordinates of the first target in the world coordinate system are selected as the spatial positioning coordinates of the object being measured, and the computer camera captures images at the specified frequency to output the final spatial position coordinates of the moving body.
[0143] Preferably, in this invention, the fsolve function of Matlab is used to solve the above-mentioned nonlinear equation system; specifically, as shown in the following m-language code:
[0144] function F = rootxj(x,y)
[0145] g11=y(1); g12=y(2); g13=y(3); g14=y(4); g15=y(5); g16=y(6); g17=y(7);
[0146] g18=y(8); g21=y(9); g22=y(10); g23=y(11); g24=y(12); g25=y(13); g26=y(14);
[0147] g27=y(15);g28=y(16);g31=y(17);g32=y(18);g33=y(19);
[0148] g34=y(20);g35=y(21);g36=y(22);g37=y(23);g38=y(24);
[0149] d12=y(25);d13=y(26);d23=y(27);
[0150] F(1)=g11*x(1)+g12*x(2)+g13*x(3)-g14;
[0151] F(2)=g15*x(1)+g16*x(2)+g17*x(3)-g18;
[0152] F(3)=g21*x(4)+g22*x(5)+g23*x(6)-g24;
[0153] F(4)=g25*x(4)+g26*x(5)+g27*x(6)-g28;
[0154] F(5)=g31*x(7)+g32*x(8)+g33*x(9)-g34;
[0155] F(6)=g35*x(7)+g36*x(8)+g37*x(9)-g38;
[0156] F(7)=(x(1)-x(4))^2+(x(2)-x(5))^2+(x(3)-x(6))^2-d12^2;
[0157] F(8)=(x(1)-x(7))^2+(x(2)-x(8))^2+(x(3)-x(9))^2-d13^2;
[0158] F(9)=(x(7)-x(4))^2+(x(8)-x(5))^2+(x(9)-x(6))^2-d23^2,
[0159] y=[g11 g12 g13 g14 g15 g16 g17 g18 g21 g22 g23 g24 g25 g26 g27 g28g31 g32 g33 g34 g35 g36 g37 g38 d12 d13 d23];
[0160] fun=@(x)rootxj(x,y);
[0161] x0 = [0,0,0,0,0,0,0,0,0];
[0162] x = fsolve(fun, x0)
[0163] The final x1, y1, and z1 values represent the three-dimensional coordinates of the first target in the world coordinate system. Specifically, in this case, an output frequency of 400 Hz was selected, meaning that the position coordinates of the moving object are output every 0.0025 seconds, thus achieving real-time calculation and output of continuous positioning data. In this case, the final result is the change in displacement of the measured object along the x-axis of the world coordinate system within 1 second, as shown in the figure. Figure 6 As shown; the change in displacement of the measured object along the y-axis in the world coordinate system within 1 second is obtained as follows. Figure 7 As shown; the displacement change of the measured object along the z-axis of the world coordinate system within 1 second is obtained as follows. Figure 8 As shown.
[0164] This completes the continuous measurement and calculation of the spatial optical positioning of the moving object using a single camera and three targets, achieving high-precision optical positioning of the moving object.
[0165] As can be seen from the above examples, the method provided by this invention is entirely feasible, simple, and convenient to implement. Regarding the number of targets, a single camera is used, resulting in a low-cost and technologically mature system architecture. It can be implemented in any scene with a wide field of view and good lighting. Furthermore, the three targets can be set in a fixed shape, such as an equilateral triangle, forming a single unit. This allows for easy and direct attachment of the three targets to the object being measured. Therefore, it possesses high engineering practicality and market promotion value.
Claims
1. A method for spatial positioning using a single camera with three targets, comprising the following steps: Step S10: A control circuit is composed of an ultra-low power microcontroller. A target module system is composed of a button battery, a liquid crystal light valve, a reflector, and a control circuit. The microcontroller program sets the target flashing period and controls the target to form alternating bright and dark light spots for output. Step S20: According to the design method of the target module system described above, three targets are fabricated and attached to predetermined positions on the moving object being tested using strong adhesive. The first target is located at the center of the object being tested, and the other two targets are randomly selected and offset by a certain distance. Then, the spatial distance between the three targets is measured. Based on the target flashing period, a visible light industrial camera is set up at a predetermined location, and the continuous shooting frequency of a single industrial camera is set. The industrial camera is connected to a computer to read the image data, and the pixel positions of the three targets in the image are located based on the target highlights in the camera image. Then, the pixel positions of the three targets in the image are detected. Measuring the spatial distance between the three targets and determining the pixel positions of the three targets in the photograph includes: denoting the three-dimensional spatial distance between the first target and the second target as... The three-dimensional spatial distance between the first target and the third target is denoted as... The three-dimensional spatial distance between the second and third targets is denoted as... The pixel position of the first target captured by the camera in the photograph is denoted as... ,in The integer represents the time period interval. The pixel position, that is represent The pixel position of the first target in the camera image is recorded at a specific moment; similarly, the pixel position of the second target in the image obtained by the camera is recorded as... That is represent The pixel position of the second target in the camera image is recorded; the pixel position of the third target in the image obtained by the camera is denoted as... That is represent The pixel position of the third target in the camera image at any given moment; Step S30: Based on the pixel positions of the three targets in the camera image, calculate the relative distance between the camera's horizontal and vertical pixels for the three targets; based on the known calibrated internal and external parameters of the industrial camera lens, calculate the camera's horizontal and vertical composite coefficients as follows: ; ; ; ; ; ; ; ; in , The x and y coordinates represent the pixel position of the center of the camera's image coordinate system in the pixel coordinate system; these are intrinsic parameters of the camera. The relative distance between the camera's horizontal pixels for the first target; The vertical pixel distance between the first target and the camera. The relative distance between the camera's horizontal pixels for the first target; The vertical pixel distance between the camera and the second target; The relative distance between the camera's horizontal pixels for the third target; The vertical pixel distance of the camera to the third target; where For camera focal length, , These are the actual physical size parameters of each pixel in the x and y directions of the camera image; For the camera's lateral composite coefficient, Camera longitudinal composite coefficient; Step S40: Based on the camera-related comprehensive position coefficients of the first, second, and third targets, solve for a set of six linear positional relationship equations for the three targets; then, based on the spatial positional relationships of the three targets, construct three nonlinear spatial distance relationship equations; finally, based on the camera's horizontal pixel relative distance, vertical pixel relative distance, and camera parameters, solve for the camera-related comprehensive position coefficients of the three targets as follows: ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; in These are the three axial translation parameters between the camera's camera coordinate system and the world coordinate system; These are the nine rotation parameters of the camera, and the above 12 parameters are the external parameters of the camera; , , , , , , , The first target's overall position coefficient related to the camera; , , , , , , , The comprehensive position coefficient of the second target related to the camera; , , , , , , , The comprehensive position coefficient of the third target related to the camera; Step S50: Based on the comprehensive position coefficients of the first, second, and third targets related to the camera, solve the six linear positional relationship equations for the three targets; then, based on the spatial positional relationships of the three targets, form three nonlinear spatial distance relationship equations; the nonlinear equations are solved according to the three-target single-camera spatial positioning as follows: ; ; ; ; ; ; in For the first target in the world coordinate system , , Three directional coordinates; For the second target in the world coordinate system , , Three directional coordinates; For the third target in the world coordinate system , , Three directional coordinates; Finally, a computer is used to solve the problem and obtain the three-dimensional coordinates of the three targets in the world coordinate system. Then, the three-dimensional coordinates of the first target in the world coordinate system are selected as the spatial positioning coordinates of the object being measured. The computer camera takes pictures at different frequencies and outputs the final spatial position coordinates of the moving body.
Citation Information
Patent Citations
Integral flexibility testing method for monocular posture measurement precision evaluation
CN107817005A
Beacon positioning method, device, storage medium and equipment
CN110378898A
