Steph
Steph

Reputation: 649

Generalising found transformation matrix to a whole image

I am using opencv and c++. I have successfully obtained the transformation matrix between images A and B based on 3 common points in the images. Now I want to apply this found transformation matrix to the whole image. I was hoping that warpAffine could do the job but it gives me this error https://i.sstatic.net/2RNTK.jpg. However, I used only part of the affineTransform code where it finds the warped image because I already found the transformation matrix using another method. Can anybody tell if this is the correct way to transform the whole image if I already have a transformation marix?Here is the piece of that code http://pastebin.com/HFYSneG2

Upvotes: 1

Views: 405

Answers (2)

Steph
Steph

Reputation: 649

The matrix of the common points found on both images needed to be transposed and then warpAffine used

Upvotes: 0

killogre
killogre

Reputation: 1800

If you already have the transformation matrix, then cv::warpAffine is the right way to go. Your error message seems to be about the type of the transformation matrix and/or its size, which should be 2x3 float or double precision.

Upvotes: 2

Related Questions