Ask Your Question

How to get the findHomography result's position relative to scene?

asked 2013-07-31 07:53:04 -0500

Ted WONG gravatar image

I follow the following tutorial:

And I can detect the object I want. But I would like to know the position, and the coordinate is relative in the scene image. And I take the source code's scene_corners vendor, but the position is totally wrong. How can I transfer it the the right position? Thanks.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-07-31 10:17:50 -0500

updated 2013-07-31 10:19:44 -0500

For solve this problem in the first use findHomography() then compute rotation value in the last use perspectiveTransform() to transform object points to scene points.

 const int n = 100;
 Point2f object_points[n],scene_points[n];
  Mat H = findHomography(object_points, scene_points, CV_RANSAC );
  float roatation =  acos(<double>(0,0)) * 180/CV_PI;
  perspectiveTransform( object_points, scene_points, H);
edit flag offensive delete link more


But what is this line for: float roatation = acos(<double>(0,0)) * 180/CV_PI;

Ted WONG gravatar imageTed WONG ( 2013-08-01 04:58:32 -0500 )edit

It determine the rotation angle of object_points to scene_points.

Mostafa Sataki gravatar imageMostafa Sataki ( 2013-08-01 05:04:41 -0500 )edit

Question Tools


Asked: 2013-07-31 07:53:04 -0500

Seen: 4,213 times

Last updated: Jul 31 '13