Why homgraphy matrix doesn't work for any point in the image?

asked 2019-05-13 01:17:12 -0500

theateist gravatar image

I'm trying to find homography between the following two images.
If I calculate homography based on only corresponding points on the ground then the transformation works well only for the points on the ground. If I calculate homography based on only corresponding points on the heads then the transformation works well only for the points on the head level.

How do I get homography that will work for any point on the image? Is it even possible ?

The code for homography calculation:

vector<pair<Point, Point> > homographyPoints;

vector<cv::Point2f> plane1Points;
vector<cv::Point2f> plane2Points;
for (auto& p : homographyPoints)
{
    plane1Points.push_back(p.first);
    plane2Points.push_back(p.second);
}

homography = findHomography(plane1Points, plane2Points, CV_RANSAC);

The code for using the homography:

vector<cv::Point2f> srcPoints, dstPoints;
srcPoints.push_back(selectedPoint);
cv::perspectiveTransform(srcPoints, dstPoints, params->homography);
edit retag flag offensive close merge delete

Comments

based on only corresponding points on the heads

the what ?

berak gravatar imageberak ( 2019-05-13 01:52:37 -0500 )edit
1

Homography transformation holds only for the same planar objects or pure camera rotational motion. You should look at a computer vision course.

Here an introduction on computer vision.

Eduardo gravatar imageEduardo ( 2019-05-13 03:16:05 -0500 )edit