Question

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!

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top