Camera attitude detection method

By calculating the pixel point vector in the target photo taken by the camera and using the photo plane normal vector, the problem of low camera posture detection accuracy in the prior art is solved, and a high-precision and low-cost posture detection method is realized.

CN119810197APending Publication Date: 2025-04-11XIAMEN JIUHUA COMM EQUIP FACTORY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411868833.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

In the prior art, camera attitude detection has problems such as difficult installation, limited gyroscope accuracy, limited reference object installation and poor attitude measurement accuracy.

Method used

By obtaining several photos of the target taken after the camera rotates, the first vector and the second vector of the pixel points of the target in the photo are calculated, and the posture information of the camera is calculated using the photo plane normal vector, including azimuth angle, pitch angle and rotation angle.

Benefits of technology

It realizes simple, low-cost and high-precision camera attitude detection, reduces the attitude measurement workload, does not require the introduction of mechanical devices to assist in measurement, and improves the measurement accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119810197A_ABST
    Figure CN119810197A_ABST
Patent Text Reader

Abstract

The camera attitude detection method comprises the following steps: acquiring a plurality of pictures of a target shot after the camera rotates, respectively calculating first vectors of pixel points of the target in the plurality of pictures, and calculating vectors of the pixel points mapped to a picture plane by combining the first vectors of the pixel points as second vectors; calculating a unit vector of the photo plane according to the plurality of second vectors of the photo plane, and calculating a normal vector of the photo plane according to the unit vector; and calculating attitude information of rotation of the camera according to the normal vector of the photo plane. The method is simple, low in measurement cost and high in precision.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of visual intelligence, and in particular to a camera posture detection method. Background Art

[0002] In the field of visual intelligence, the accuracy of the camera's posture (including azimuth, pitch, rotation, etc.) is one of the key factors causing errors in visual direction finding and positioning. At present, the methods to control the accuracy of the camera's posture are mainly: ① Improve the installation accuracy of the camera; ② Introduce reference objects to calibrate the camera; ③ Measure the camera's posture and use the measured data for visual intelligence algorithms.

[0003] The main problems of the existing technology are: ① Difficulty in installation; ② The accuracy of the existing gyroscope is limited by the mounting platform (for example, the material of the platform is iron, which will obviously affect the accuracy of the gyroscope); ③ The installation of the reference object is limited by the terrain conditions; ④ The attitude measurement accuracy is poor. Summary of the invention

[0004] The main purpose of the present invention is to overcome the above-mentioned defects in the prior art and to propose a camera posture detection method, which has the advantages of simple method, low measurement cost and high accuracy.

[0005] The present invention adopts the following technical solution:

[0006] A camera posture detection method, characterized by comprising:

[0007] Acquire several photos of the target taken by the camera after the camera rotates, calculate first vectors of pixel points of the target in the several photos respectively, and calculate vectors mapped from the pixel points to the photo plane as second vectors based on the first vectors of the pixel points;

[0008] Calculating a unit vector of the photo plane according to a plurality of second vectors of the photo plane, and calculating a normal vector of the photo plane according to the unit vector;

[0009] The rotation posture information of the camera is calculated according to the normal vector of the photo plane.

[0010] Calculate the position coordinate vector of the pixel points of the target in the plurality of photos as the first vector, specifically:

[0011] Assume that the pixel points of the target in one of the photos are P1, then the first vector of the pixel point P1

[0012]

[0013] Among them, P1.X, P1.Y, and P1.Z represent the position coordinates of the pixel point P1 on the X-axis, Y-axis, and Z-axis respectively.

[0014] Calculating the vector of the pixel point mapped to the photo plane as the second vector in combination with the first vector of the pixel point specifically includes the following steps:

[0015] First, according to the first vector of the pixel point Calculate the unit vector of the pixel

[0016]

[0017] Then according to the modulus of the vector of the pixel point Calculate the second vector that maps the pixel point of the photo to the photo plane

[0018]

[0019] Among them, the vector of the pixel point The calculation formula is as follows;

[0020]

[0021] Among them, Xmax is the distance between the left or right side of the photo and the Y axis, Xmax=Z*tanV.X; Ymax is the distance between the top or bottom of the photo and the X axis, and Ymax=Z*tanV.Y, Z is the distance between the center of the photo and the position of the camera; VX and VY are the field of view angles in the X-axis direction and the Y-axis direction of the camera respectively; PB.X and PB.Y represent the resolution of the camera in the X-axis direction and the Y-axis direction respectively; P1.a and P1.b are the coordinates of the pixel points of the target on the photo.

[0022] Calculating the unit vector of the photo plane according to the plurality of the second vectors of the photo plane specifically includes the following steps:

[0023] Calculate the second vectors of the target pixels in the three photos mapped to the photo plane, including vectors vector and vector

[0024] Then according to the vector vector and vector Calculate the plane vector of the photo plane and

[0025]

[0026] The unit vectors i and j are obtained from the plane vectors of the photo:

[0027]

[0028] Where D is the characteristic matrix of the two-variable linear equation system:

[0029]

[0030] n 1 and m 1 Represents the plane vector The number of unit vectors i and j involved, n 2 、m 2 Represents the plane vector The number of unit vectors i and j included.

[0031] The following relationship is obtained based on the position relationship of the pixel points of the target on different photos:

[0032]

[0033] Among them, P1.a, P2.a, and P3.a are respectively the X-axis coordinates of the pixel points of the target in the three photos, and P1.b, P2.b, and P3.b are respectively the Y-axis coordinates of the pixel points of the target in the three photos.

[0034] Calculate the normal vector of the plane vector according to the unit vectors i and j and the coordinates of the pixel points of the target in the photo Specifically:

[0035]

[0036] in, is the second vector that maps the pixel points in the photo to the photo plane; PB.X and PB.Y represent the resolution of the camera in the X-axis direction and the resolution in the Y-axis direction respectively; P1.a and P1.b are the coordinates of the pixel points of the target in the photo;

[0037] The normal vectors of the plurality of plane vectors obtained according to the coordinates of the pixel points of the target in different photos are averaged to obtain a more accurate

[0038]

[0039] Wherein, n is the number of the photos, Represents the normal vector of the i-th plane vector.

[0040] Calculating the rotation posture information of the camera according to the normal vector of the photo plane, including calculating the rotation posture information of the camera according to the normal vector of the photo plane Calculate the azimuth angle β of the camera on the XY plane as follows: but Projection vector on the XY plane Then we have:

[0041]

[0042] Where X and Y are the normal vectors The X-axis coordinate and Y-axis coordinate of .

[0043] Calculating the rotation posture information of the camera according to the normal vector of the photo plane, including calculating the rotation posture information of the camera according to the normal vector of the photo plane The pitch angle α of the camera on the YZ plane is calculated as follows:

[0044]

[0045] Calculating the rotation posture information of the camera according to the normal vector of the photo plane, including calculating the rotation posture information of the camera according to the normal vector of the photo plane Calculate the rotation angle of the camera on the YZ plane as follows:

[0046] set up Assuming that the camera does not rotate and the pitch angle and azimuth angle are adjusted, the unit vector of the photo plane is From the vertex of the normal vector along the unit vector Draw an extension line to intersect the Z axis to form a vector Then there is the following relationship:

[0047]

[0048] When Z≠0:

[0049] When Z=0: C is an arbitrary constant;

[0050] The unit vector of the photo plane when the camera is not rotated The angle between the unit vector j of the photo plane after the camera is rotated is the rotation angle θ of the camera:

[0051]

[0052] The posture information includes azimuth, pitch angle and rotation angle; multiple groups of posture information after the camera is rotated are obtained to obtain an azimuth set, a pitch angle set and a rotation angle set, and the median or average value in the set is taken as the posture information of the camera rotation.

[0053] It can be seen from the above description of the present invention that, compared with the prior art, the present invention has the following beneficial effects:

[0054] The present invention maps pixel points to the same photo plane, calculates the photo plane unit vector after the camera angle is adjusted from the photo plane vector, calculates the normal vector by combining the photo plane unit vector with the pixel points, and uses the photo plane normal vector to calculate the camera's posture information. The method is simple, has low measurement cost and high accuracy.

[0055] In a video surveillance cloud scenario where cameras are installed on a large scale and accurate camera posture information is required, the method of the present invention can significantly reduce the workload of posture measurement. There is no need to introduce mechanical devices for auxiliary measurement, thus reducing measurement costs.

[0056] The simulation results show that the azimuth and elevation angles detected by the method of the present invention have a 95% confidence interval accuracy of <0.0075, and a 95% confidence interval accuracy of <0.0175 for the rotation angle. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Figure 1 is a schematic diagram of the coordinate system when the camera is in the first posture;

[0058] Figure 2 This is a schematic diagram of the coordinate system when the camera is rotated in the second posture;

[0059] Figure 3 This is a schematic diagram of the photo plane;

[0060] Figure 4 It is a schematic diagram of the adjustment of the normal vector and unit vector of the plane with the angle;

[0061] Figure 5 is the simulation result diagram (error);

[0062] Figure 6 This is the simulation result diagram (accuracy normal distribution).

[0063] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. DETAILED DESCRIPTION

[0064] The present invention is further described below through specific implementation modes.

[0065] When the camera is installed, the camera position coordinates are recorded, and the camera takes a number of photos of the target, which can be a stationary target or a moving target. Taking a moving target as an example, for example, if the target is a drone, before shooting, the camera and the drone are synchronized. After the drone is released, the camera is controlled to record videos or take pictures. In order to ensure the synchronization of the drone and camera positions, each frame of the image taken by the camera is timestamped, and correspondingly, each position of the drone is timestamped. According to the pixel data structure, the video frame and the drone position information are matched to form a pixel data set.

[0066] In the present invention, by selecting several photos from the pixel point data set, the vector of the pixel point of the target in the photo can be calculated according to the field of view and resolution of the camera. The specific calculation is as follows:

[0067] See also Figure 1 , set the pixel point of the target in one of the photos as P1, assume that the first posture of the camera is at the coordinate origin, the center of the captured photo is the Z-axis coordinate (for example, Z = 100), and the lower left corner of the photo is the pixel origin (0, 0), then the vector of the pixel point P1 is

[0068]

[0069] Among them, Xmax is the distance between the left or right side of the photo and the Y axis, Xmax = Z*tanV.X; Ymax is the distance between the top or bottom of the photo and the X axis, and Ymax = Z*tanV.Y, Z is the distance between the center of the photo and the position of the camera; VX and VY are the field of view angles of the camera in the X-axis direction and the Y-axis direction respectively; PB.X and PB.Y represent the resolution of the camera in the X-axis direction and the Y-axis direction respectively; P1.a and P1.b are the coordinates of the pixel points of the target in the photo; P1.X′, P1.Y′ and Z represent the X-axis coordinates, Y-axis coordinates and Z-axis coordinates of the calculated vector of pixel point P1 respectively. Taking three photos as an example, the pixel points of the targets in the three photos are P1, P2, and P3 respectively, and their corresponding vectors are and

[0071] Based on this, the present invention proposes a camera posture detection method for detecting the camera posture, comprising the following steps:

[0072] S1 obtains several photos of the target taken after the camera rotates, calculates the first vectors of the pixel points of the target in the several photos respectively, and calculates the vector mapped from the pixel point to the photo plane as the second vector in combination with the first vector of the pixel point.

[0073] When the camera rotates, the azimuth, pitch angle, and rotation angle of the camera all change. The above-mentioned method for calculating the vector of the pixel point of the target in the photo is used to calculate the first vector of the pixel point of the target in different photos. For example, taking the pixel points P1, P2, and P3 of the target in three photos as an example, the calculated first vector includes

[0074] Combined with the first vector, the vector of the target pixel in the photo mapped to the photo plane is calculated as the second vector, which specifically includes the following:

[0075] First calculate the coordinate vector of the pixel of the target in the photo According to the coordinate vector Calculate its unit vector

[0076]

[0077] Among them, the coordinate vector of the pixel point P1 of the target in the photo is It can be calculated using the following formula: Among them, P1.X, P1.Y, and P1.Z represent the position coordinates of the pixel point P1 of the target in the photo, including the X-axis coordinate, the Y-axis coordinate, and the Z-axis coordinate. Representation vector Model.

[0078] Since the camera rotates, the vector of the pixel point P1 calculated above The modulus of the vector of pixel point P1 is constant. Calculate the second vector that maps the pixel point of the target in the photo to the photo plane

[0079]

[0080] In this embodiment, three photos are taken as an example. The pixel points of the target in the three photos are P1, P2, and P3 respectively. The second vectors of the pixel points of the target in the three photos are respectively mapped to the photo plane, including vector vector and vector

[0082] S2 calculates a unit vector of the photo plane according to a plurality of second vectors of the photo plane, and calculates a normal vector of the photo plane according to the unit vector.

[0083] Taking three photos as an example, the pixel points of the target in the three photos are mapped to the second vector of the photo plane, including the vector vector and vector Calculate the plane vector of the photo plane and

[0084]

[0085] Calculate the unit vectors i and j based on the plane vector of the photo:

[0086]

[0087] Where D is the characteristic matrix of the two-variable linear equation system:

[0088]

[0089] n 1 and m 1 Represents the plane vector The number of unit vectors i and j involved, n 2 、m 2 Represents the plane vector The number of unit vectors i and j included is as follows:

[0090]

[0091] Although the photo plane of the photo taken after the camera rotates rotates with the camera, the position relationship of the pixel points does not change due to the rotation of the photo plane. According to the position relationship of the pixel points of the target in different photos, the following relationship is obtained:

[0092]

[0093] Among them, P1.a, P2.a, and P3.a are the X-axis coordinates of the pixel points of the target in the three photos, and P1.b, P2.b, and P3.b are the Y-axis coordinates of the pixel points of the target in the three photos.

[0094] Calculate the normal vector of the plane vector based on the unit vectors i and j and the coordinates of the pixel point of the target in the photo Specifically:

[0095]

[0096] in, is the second vector that maps the pixel point in the photo to the photo plane; PB.X and PB.Y represent the resolution of the camera in the X-axis direction and the Y-axis direction respectively; P1.a and P1.b are the coordinates of the pixel point P1 of the target in the photo. Replace with or Replacing P1.a and P1.b with P2.a and P2.b, or P3.a and P3.b, also yields

[0097] Furthermore, in order to reduce Use the median or mean to get a more accurate estimate of the error. The normal vectors of multiple plane vectors obtained according to the coordinates of the target pixel points in different photos are averaged to obtain a more accurate

[0098]

[0099] Where n is the number of photos, Represents the normal vector of the i-th plane vector.

[0100] Where X and Y are the normal vectors The X-axis coordinate and Y-axis coordinate of .

[0101] S3 calculates the rotation posture information of the camera according to the normal vector of the photo plane.

[0102] The calculated result in this step is the posture information of the camera after rotation, which includes azimuth, pitch angle and rotation angle.

[0103] Specifically, it includes the normal vector of the photo plane Calculate the azimuth angle β of the camera on the XY plane. The azimuth angle β of the camera on the XY plane is equal to the normal vector The angle between the projection vector on the XY plane and the Y axis is as follows: but Projection vector on the XY plane Then we have:

[0104]

[0105] Calculate the camera rotation posture information based on the normal vector of the photo plane, including the normal vector of the photo plane Calculate the pitch angle α of the camera on the YZ plane as follows:

[0106]

[0107] The unit vector of the photo taken by the camera and the normal vector of the photo are perpendicular to each other, which will not change due to the adjustment of the camera angle (adjustment of the pitch angle and azimuth angle).

[0108] like Figure 4As shown, ① in the figure represents the initial state of the normal vector of the photo, ② in the figure represents the state rotated by the pitch angle, and ③ in the figure represents the state rotated by the azimuth angle.

[0109] Calculate the camera rotation posture information based on the normal vector of the photo plane, including the normal vector of the photo plane Calculate the rotation angle of the camera on the YZ plane as follows:

[0110] set up Assuming the camera does not rotate and the pitch and azimuth are adjusted, the unit vector of the photo plane is From the vertex along the unit vector Draw an extension line to intersect the Z axis to form a vector According to geometric knowledge, we have the following relationship:

[0111]

[0112] When Z≠0: (XYZ)·(x 0 y 0 z 0 )=0

[0113] x 0 = -X;

[0114] y 0 = -Y;

[0115]

[0116] Then there is

[0117] When Z=0: C is an arbitrary constant;

[0118] The unit vector of the photo plane when the camera is not rotated The angle between the unit vector j of the photo plane after the camera is rotated is the rotation angle θ of the camera:

[0119]

[0120] In the present invention, multiple sets of posture information after the camera is rotated are obtained to obtain an azimuth angle set, a pitch angle set and a rotation angle set, and the median or average value in the set is taken as the posture information of the camera rotation. The details are as follows:

[0121] The calculation results of azimuth, elevation and rotation angles are {β i}、{α i}、{θ i}, take the median or mean:

[0122] Azimuth:

[0123] Or β=M{α i};

[0124] Pitch Angle:

[0125] Or α=M{β i};

[0126] Rotation Angle:

[0127] Or θ=M{θ i};

[0128] In the above expression, M represents the median.

[0129] The method of the present invention has the following simulation results: Figure 5 and Figure 6 As shown, the accuracy of the azimuth and elevation angles within the 95% confidence interval is <0.0075, and the accuracy of the rotation angle within the 95% confidence interval is <0.0175.

[0130] The above is only a specific implementation of the present invention, but the design concept of the present invention is not limited thereto. Any non-substantial changes to the present invention using this concept shall be deemed as an infringement of the protection scope of the present invention.

Claims

1. A camera posture detection method, characterized in that: include: Acquire several photos of the target taken by the camera after the camera rotates, calculate first vectors of pixel points of the target in the several photos respectively, and calculate vectors of the pixel points mapped to the photo plane as second vectors in combination with the first vectors of the pixel points; Calculating a unit vector of the photo plane according to a plurality of second vectors of the photo plane, and calculating a normal vector of the photo plane according to the unit vector; The rotation posture information of the camera is calculated according to the normal vector of the photo plane.

2. A camera posture detection method as claimed in claim 1, characterized in that: Calculate the position coordinate vector of the pixel points of the target in the plurality of photos as the first vector, specifically: Assume that the pixel points of the target in one of the photos are P1, then the first vector of the pixel point P1 Among them, P1.X, P1.Y, and P1.Z represent the position coordinates of the pixel point P1 on the X-axis, Y-axis, and Z-axis respectively.

3. A camera posture detection method as claimed in claim 1, characterized in that: Calculating the vector of the pixel point mapped to the photo plane as the second vector in combination with the first vector of the pixel point specifically includes the following steps: First, according to the first vector of the pixel point Calculate the unit vector of the pixel Then according to the modulus of the vector of the pixel point Calculate the second vector that maps the pixel point of the photo to the photo plane Among them, the vector of the pixel point The calculation formula is as follows; Among them, Xmax is the distance between the left or right side of the photo and the Y axis, Xmax=Z*tanV.X; Ymax is the distance between the top or bottom of the photo and the X axis, and Ymax=Z*tanV.Y, Z is the distance between the center of the photo and the position of the camera; VX and VY are the field of view angles in the X-axis direction and the Y-axis direction of the camera respectively; PB.X and PB.Y represent the resolution of the camera in the X-axis direction and the Y-axis direction respectively; P1.a and P1.b are the coordinates of the pixel points of the target on the photo.

4. A camera posture detection method as claimed in claim 1, characterized in that: Calculating the unit vector of the photo plane according to the plurality of the second vectors of the photo plane specifically includes the following steps: Calculate the second vectors of the target pixels in the three photos mapped to the photo plane, including vectors vector and vector Then according to the vector vector and vector Calculate the plane vector of the photo plane and The unit vectors i and j are obtained from the plane vectors of the photo: Where D is the characteristic matrix of the two-variable linear equation system: n1 and m1 represent plane vectors respectively The number of unit vectors i and j contained, n2 and m2 represent the plane vectors The number of unit vectors i and j included.

5. A camera posture detection method as claimed in claim 4, characterized in that: The following relationship is obtained based on the position relationship of the pixel points of the target on different photos: Among them, P1.a, P2.a, and P3.a are respectively the X-axis coordinates of the pixel points of the target in the three photos, and P1.b, P2.b, and P3.b are respectively the Y-axis coordinates of the pixel points of the target in the three photos.

6. A camera posture detection method as claimed in claim 1, characterized in that: Calculate the normal vector of the plane vector according to the unit vectors i and j and the coordinates of the pixel points of the target in the photo Specifically: in, is the second vector that maps the pixel points in the photo to the photo plane; PB.X and PB.Y represent the resolution of the camera in the X-axis direction and the resolution in the Y-axis direction respectively; P1.a and P1.b are the coordinates of the pixel points of the target in the photo; The normal vectors of the plurality of plane vectors obtained according to the coordinates of the pixel points of the target in different photos are averaged to obtain a more accurate Wherein, n is the number of the photos, Represents the normal vector of the i-th plane vector.

7. A camera posture detection method as claimed in claim 1, characterized in that: Calculating the rotation posture information of the camera according to the normal vector of the photo plane, including calculating the rotation posture information of the camera according to the normal vector of the photo plane Calculate the azimuth angle β of the camera on the XY plane as follows: but Projection vector on the XY plane Then we have: Where X and Y are the normal vectors The X-axis coordinate and Y-axis coordinate of .

8. A camera posture detection method as claimed in claim 1, characterized in that: Calculating the rotation posture information of the camera according to the normal vector of the photo plane, including calculating the rotation posture information of the camera according to the normal vector of the photo plane The pitch angle α of the camera on the YZ plane is calculated as follows:

9. A camera posture detection method as claimed in claim 1, characterized in that: Calculating the rotation posture information of the camera according to the normal vector of the photo plane, including calculating the rotation posture information of the camera according to the normal vector of the photo plane Calculate the rotation angle of the camera on the YZ plane as follows: set up Assuming that the camera does not rotate and the pitch angle and azimuth angle are adjusted, the unit vector of the photo plane is From the vertex of the normal vector along the unit vector Draw an extension line to intersect the Z axis to form a vector Then there is the following relationship: When Z≠0: When Z=0: C is an arbitrary constant; The unit vector of the photo plane when the camera is not rotated The angle between the unit vector j of the photo plane after the camera is rotated is the rotation angle θ of the camera:

10. A camera posture detection method as claimed in claim 1, characterized in that: The posture information includes azimuth, pitch angle and rotation angle; multiple groups of posture information after the camera is rotated are obtained to obtain an azimuth set, a pitch angle set and a rotation angle set, and the median or average value in the set is taken as the posture information of the camera rotation.