Ask Your Question

Apply rotation matrix to image

asked 2014-07-19 19:50:50 -0500

rafaoc gravatar image

I am working with openCV api for java.
I have a images pair and want to apply the rotation matrix which I get from


and I want to use it. I have try for both images, right and left, with


But it doesnt work. I get a black image.

With < warpAffine() > I dont know how to use the rotation matrix because R is 3x3 but the input for warpaffine must be 2x3

Somebody has any idea

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-07-19 20:19:47 -0500

kovand11 gravatar image

The R matrix transforms from Cam1 system, to Cam2 system. Its a 3D->3D transformation. The warpPerspective() expects an 2D Image -> 2D Image tranformation (in normalized space).

Luckily there is a function for that:

edit flag offensive delete link more


Yes, you are right , either warpPerspective() or warpAffine() are transformation on images 2d -> 2d. May be do you know how to apply an infinitive homography to an image?, i.e the matrix Hinf=k1Rk2inv, where ki are the intrinsic camera matrix and R is the rotation matrix between cameras

rafaoc gravatar imagerafaoc ( 2014-07-19 20:52:55 -0500 )edit

Just multiple the matrices, and pass the result to the warpPerspective() function.

kovand11 gravatar imagekovand11 ( 2014-07-20 11:48:27 -0500 )edit

Hi @kovand11 , I have tried, but I dont get good results. Could you see please the question on the link

rafaoc gravatar imagerafaoc ( 2014-07-20 22:36:29 -0500 )edit

Question Tools


Asked: 2014-07-19 19:50:50 -0500

Seen: 1,389 times

Last updated: Jul 19 '14