Ask Your Question
0

Apply rotation matrix to image

asked 2014-07-19 19:50:50 -0600

rafaoc gravatar image

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

stereoCalibrate()

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

warpPerspective()

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
0

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

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: http://docs.opencv.org/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html?highlight=findhomography#findhomography

edit flag offensive delete link more

Comments

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 -0600 )edit

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

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

Hi @kovand11 , I have tried, but I dont get good results. Could you see please the question on the link http://answers.opencv.org/question/37630/apply-infinite-homography-to-image/

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

Question Tools

Stats

Asked: 2014-07-19 19:50:50 -0600

Seen: 1,595 times

Last updated: Jul 19 '14