3

I need to perform a 3D rotation of a 2D image on x and y axis. I read that i have to use the Homographic matrix on OpenCV , but i don't know how to set the matrix to perform a common rotation angle. For example 30 degree on x axis or 45° on y axis.

I read this post : Translating and Rotating an Image in 3D using OpenCV. I have tried different values of the f but it doesn't work.

I want to know which parameters of the matrix i have to change and how (formula). Thank you!

Community
  • 1
  • 1
  • Its a bit late but you can find a very simple working demo-code here: http://stackoverflow.com/a/6667784/1886124 good luck. – Luqman Apr 05 '13 at 15:49

1 Answers1

2

Follow that same post, but replace your rotation matrix. Familiarize yourself with the Rorigues() function. You can send it a 1 x 3 array of the x, y, and z rotations. It will give you a a 3 x 3 rotation matrix. Plug this matrix in as the first 3 columns and 3 rows of R (leave the rest the same). If you don't want any translation, make sure you set the variable dist to 0 in the code on that page.

Community
  • 1
  • 1
Radford Parker
  • 731
  • 4
  • 14