0
votes

I have the readings from a gyroscope attached to a camera describing the orientation of the camera in 3D (say with 3 Euler angles).

I take a picture (of say a flat plane) from this pose. After which, I want to transform the image to another image, as though it has been taken with the camera being perpendicular to the plane itself.

How would I do something like this in OpenCV? Can someone point me in the correct direction?

1

1 Answers

0
votes

You can checkout how to calculate the rotation matrix using the roll-pitch-yaw angles here: http://planning.cs.uiuc.edu/node102.html

A Transformation matrix is T = [R t; 0 1] (in matlab notation) Here, you can place the translation as a 3x1 vector in 't' and the calculated rotation matrix in 'R'.

Since a mathematical information is missing, I assume the Z-axis of the image and the camera are parallel. In this case, you have to add a 90° rotation to either the X or the Y axis to get a perpendicular view. This is to take care of orientation.

perspectiveTransform() function should be helpful thereon.

Check out this question for code insights: How to calculate perspective transform for OpenCV from rotation angles?