Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hello,

I have 2 sets of image points (x,y) from 2 images (ImgX, ImgY)

I would like to use these image points and find the affine transformation between the two images.

The getAffineTransform() function of openCV gives me a matrix of individual image points rather than a final matrix which I can apply for the entire image. So how do i get a final affine transformation matrix that can be applied for the image?

What I have tried:

C++
vector<vector < Point2f > > imagePoints; //imagePoints[0] and imagePoints[1] are initilaized with x y values 
 
 Mat view ;  //ImgX is also loaded
 Mat viewGray = Mat::zeros( view.rows, view.cols, view.type() );

for (int j =0; j< imagePoints[0].size(); j++)
    {
       cv::Mat affImg= getAffineTransform( & imagePoints[0][j], & imagePoints[1][j]);
       cv::warpAffine(view,viewGray,affImg, view.size());
       showImage("Affine transform", viewGray);
       cv::waitKey(0);
    }


so, in the above case, do i need to push_back the affImg matrix in a vector of Matrix?
Posted
Updated 3-Dec-16 0:36am
v9

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900