Reputation: 61
I've been trying to estimate the euler angles (Rotz(yaw)*Roty(pitch)*Rotx(roll)) of a UAV from the homography between two frames. This means that the rotation I get from each frame to the previous one has to be multiplied by the previous one to get the total rotation with respect to the initial axes. So: R_accumulated=R01*R12*... Those R are obtained from decomposeHomography() in openCV. According to REP and OpenCV homography page, the camera reference is Z forward, X rigth and Y down but my UAV reference system is ENU. The question is how to get from that R_accumulated the dron orientation.
The R_accumulated from the homography tells you how to convert one plane into another. So if I want the camera orientation, the camera have to do the opposite movement to get the same result ( inv(R_accumulated)) ? Then that camera orientation matrix should be transformed to ENU coordinates? I have tried doing this with several rotations but I do not get good results.
The best one I've had is by getting the angles directly from R_accumulated and exchanging pitch and roll. That's a very good estimation but I still need to know some kind of rotation matrix from the camera frame to the UAV one.
I don't know if you have understood me.
Upvotes: 3
Views: 1043
Reputation: 61
Finally, I have the solution to my problem:
If UAV axes are different from those of the camera, we have to find a matrix R1 that transforms UAV axes into camera ones and another one that does the same task the other way around, from camera axis to UAV axis, R2.
The homography returns the value of translation and rotation that should be applied to the first PICTURE to get the second one. But we want the camera pose, not the picture one. So, for example, if the z axis is pointing at an object who has an arrow pointing upwards, a 90º rotation of the IMAGE around that forward axis will make the arrow point right. But this is not the rotation the camera has to do to get the arrow pointing right. If you want the arrow pointing right you have to rotate the camera -90º along that same axis. In conclusion, the camera movement is the inverse of the image, so the camera rotation will be the inverse of the homography rotation and the traslation will be -1*(homography_traslation) * scale_factor.
Suppose we have a rotation R between the initial image and the final one. If we want to obtain the EulerAngles(preferable called Tait-Brian) as Rotz * Roty * Rotx of the UAV, we have to calculate the EulerAngles of R1 * inv(R) * R2. That R is the multiplication of all the intermediate rotations between frames so that R = Rinit * ... * Rend
Upvotes: 1