Rotation of the sub-coordinate system C in the parent coordinate system W

Source: Internet
Author: User

Keywords: space rotation, rotation axis, rigid body rotation

Use: Camera pose estimation, unmanned attitude estimation

Article type: concept, Formula Summary ( This article does not take the process of demolition, if you want to know how the formula is introduced, please search the literature ), C + + function display

@Author: V_shawn

@Date: 2016-11-04

@Lab: [Email protected]

In this paper, a "Space point rotation Formula & Program (c + +)", continue to discuss the rotation problem in space, may use the function defined in the previous article.

question four: coordinate system rotation in space (rotation of camera coordinate system in world coordinate system)

OK, now the problem is getting more and more complicated, this time the problem involves two coordinate system: World coordinate system w and camera coordinate system C.

People who have done camera calibration or have studied camera models should be quite familiar with these two coordinate systems, for those who do not know this can understand:

    1. The world coordinate system is the coordinate system that has been used in the previous article, which specifies the absolute coordinates of everything.
    2. The camera coordinate system is the human eye or the camera to see the object of a coordinate system, it can show me how far this object is from me, the direction angle is how much. (its z axis is the line of sight)

The O is the camera coordinate system origin, that is, the position of the human eye, OZC represents the direction of the current line of sight,

OW is the world coordinate system origin.

So our problem is that people stand at some point to shoot at the origin of the world coordinate system ow (subscript w means that the coordinates are in the world coordinate system ), the origin of the shot falls right in the center of the image, and now I'm going through some way (to solve the PNP problem) The coordinates of the OW in the camera coordinate system are computed (subscript c indicates that the coordinates are defined in the camera coordinate system ), where the camera or human is located in the world coordinate system.

This problem, when the camera coordinate system is completely parallel to the world coordinate system (two pairs of coordinate system three axes are parallel to each other) is very simple, no need to consider rotation, the position of the camera is. In fact, this problem is well solved as long as the three axes of the camera coordinate system are parallel to the three axes of the world (this parallelism does not require a one by one correspondence). For example, the picture below (the yellow point is the world coordinate system origin point ow), as long as the world coordinate system's origin ow in the camera coordinate system, it is easy to calculate the camera position.

However, once the following situation arises, the problem is not solved so well.

For example, the state of the camera is this:

It is difficult for you to calculate the position of the camera in the world coordinate system by OW coordinates in the camera coordinate system. Because it involves the rotation problem of the camera coordinate system in the world coordinate system .

So how to solve this problem, in fact, in the above by some method (solve the PNP problem) to find the origin of the coordinates of the camera coordinate system ow, we also obtained the camera coordinate system rotation matrix (yes, the camera's external parameter matrix: rotation Matrix R & translation Matrix T), this "some way" I will show you in other articles. The translation matrix T can tell the coordinates of the world coordinate system origin ow in the camera coordinate system, we assume the point p= (x0,y0,z0), the vector OCP is the vector that OC points to ow. and the rotation matrix R, you can find three Euler angle "specific how to calculate the reference" according to the camera rotation matrix three axes of rotation angle/Euler angle ". When the camera coordinate system C rotates the above angle in the order of the z-axis, x-axis, y-axis, the coordinate system c3,c3 will be completely parallel to the world coordinate system W. At this point, if you know the coordinates of OW in the C3 system, you will naturally know the coordinates of OC in the world coordinate system W.

Obviously, the camera coordinate system has undergone three rotations, the original point OC position will remain unchanged, and the point P follows the coordinate system for three rotations, then the vector OCP no longer points to ow.

To counteract the rotation, each time the axis is rotated, we need to reverse rotate the point P so that the vector OCP in the coordinate system C3 can still point to OW.

Then get the steps to solve the problem:

First Rotation:

The original camera coordinate system is rotated around the z-axis into a C1 system, at which point p=p0= (x0,y0,z0)rotates the P-point around the z-axis independently, resulting in p1= (X1,Y1,Z1), which is the C1 coordinate of the OW system.

Second Rotation:

The C1 rotates around the y-axis into the C2 system, at which point p1= (X1,Y1,Z1)rotates the P1 point around the y-axis to get p2= (X2,Y2,Z2), which is the C2 coordinate of the OW system.

Third Rotation:

The C2 rotates around the x-axis into the C3 system, at which point p2= (X2,Y2,Z2)rotates the P2 point around the x-axis, resulting in p3= (x3,y3,z3), the C3 coordinates of the OW system.

So in the world coordinate system, the camera's position coordinates are (-X3,-Y3,-Z3).

As for the program is very simple, only a few times the "space point around Axis rotation Formula & Program (c + +)" function can be.

Rotation of the sub-coordinate system C in the parent coordinate system W

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.