1 | initial version |
So looking for a solution on the Web I found that what I wish to do is called extrinsic calibration.
To find the best rotation/translation between two sets of 3D points, in the sense of minimizing the root mean square error, the solution is:
So, to transform 3D points from the camera reference frame, do the following:
1 - Define some 3D points with known position in the world reference frame, for example (but not necessarily) with Z=0. Put the coordinates in a Nx3 matrix P.
2 - Get the corresponding 3D points in the camera reference frame. Put them in a Nx3 matrix Q.
3 - From the file defined in point 3 above, call rigid_transform_3D(P, Q). This will return a 3x3 matrix R and a 3x1 vector t.
Then, for any 3D point in the camera reference frame p, as a 3x1 vector, you can obtain the corresponding world point, q with q = R.dot(p)+t
.
THE PROBLEM WITH THIS SOLUTION:
In the first step, it only works if I have a standard for the location of the points (for example using a rectangle of known dimentions I would be able to find the correct world coordinates). Now assume that those points are chosen by a user by clicking on the 2D original Depth Image. For those points I would only know the local coordinates, not the global ones. So, how will I know the corresponding 3D world coordinates? Is there a way to say "I got some 3D camera coordinates that belong to the ground plane, find me the rotation matrix that projects those points to an horizontal plane"
2 | No.2 Revision |
So looking for a solution on the Web I found that what I wish to do is called extrinsic calibration.
To find the best rotation/translation between two sets of 3D points, in the sense of minimizing the root mean square error, the solution is:
So, to transform 3D points from the camera reference frame, do the following:
1 - Define some 3D points with known position in the world reference frame, for example (but not necessarily) with Z=0. Put the coordinates in a Nx3 matrix P.
2 - Get the corresponding 3D points in the camera reference frame. Put them in a Nx3 matrix Q.
3 - From the file defined in point 3 above, call rigid_transform_3D(P, Q). This will return a 3x3 matrix R and a 3x1 vector t.
Then, for any 3D point in the camera reference frame p, as a 3x1 vector, you can obtain the corresponding world point, q with q = R.dot(p)+t
.
THE PROBLEM WITH THIS SOLUTION:
In the first step, it only works if I have a standard for the location of the points (for example using a rectangle of known dimentions I would be able to find the correct world coordinates). Now assume that those points are chosen by a user by clicking on the 2D original Depth Image. For those points I would only know the local coordinates, not the global ones. So, how will I know the corresponding 3D world coordinates? Is there a way to say "I got some 3D camera coordinates that belong to the ground plane, find me the rotation matrix that projects those points to an horizontal plane"
THE SOLUTION: (taken from an answer to my question at https://stackoverflow.com/questions/57820572/find-the-transformation-matrix-that-maps-3d-local-coordinates-to-global-coordina)
3 | No.3 Revision |
So looking for a solution on the Web I found that what I wish to do is called extrinsic calibration.
To find the best rotation/translation between two sets of 3D points, in the sense of minimizing the root mean square error, the solution is:
So, to transform 3D points from the camera reference frame, do the following:
1 -
2 -
3 -
Then, for any 3D point in the camera reference frame p, as a 3x1 vector, you can obtain the corresponding world point, q with q = R.dot(p)+t
.
THE PROBLEM WITH THIS SOLUTION:
In the first step, it only works if I have a standard for the location of the points (for example using a rectangle of known dimentions I would be able to find the correct world coordinates). Now assume that those points are chosen by a user by clicking on the 2D original Depth Image. For those points I would only know the local coordinates, not the global ones. So, how will I know the corresponding 3D world coordinates? Is there a way to say "I got some 3D camera coordinates that belong to the ground plane, find me the rotation matrix that projects those points to an horizontal plane"
THE SOLUTION: (taken from an answer to my question at https://stackoverflow.com/questions/57820572/find-the-transformation-matrix-that-maps-3d-local-coordinates-to-global-coordina)
4 | No.4 Revision |
So looking for a solution on the Web I found that what I wish to do is called extrinsic calibration.
To find the best rotation/translation between two sets of 3D points, in the sense of minimizing the root mean square error, the solution is:
So, to transform 3D points from the camera reference frame, do the following:
Then, for any 3D point in the camera reference frame p, as a 3x1 vector, you can obtain the corresponding world point, q with q = R.dot(p)+t
.
THE PROBLEM WITH THIS SOLUTION:
In the first step, it only works if I have a standard for the location of the points (for example using a rectangle of known dimentions I would be able to find the correct world coordinates). Now assume that those points are chosen by a user by clicking on the 2D original Depth Image. For those points I would only know the local coordinates, not the global ones. So, how will I know the corresponding 3D world coordinates? Is there a way to say "I got some 3D camera coordinates that belong to the ground plane, find me the rotation matrix that projects those points to an horizontal plane"
THE RESPECTIVE SOLUTION: (taken from an answer to my question at https://stackoverflow.com/questions/57820572/find-the-transformation-matrix-that-maps-3d-local-coordinates-to-global-coordina)