Ask Your Question

OpenCV : warpPerspective on whole image

asked 2013-10-30 18:26:57 -0600

axadiw gravatar image

updated 2013-10-31 09:15:19 -0600

Adi gravatar image

I'm detecting markers on images captured by my iPad. Because of that I want to calculate translations and rotations between them, I want to change change perspective on images these image, so it would look like I'm capturing them directly above markers.

Right now I'm using

points2D.push_back(cv::Point2f(-6, -6));
points2D.push_back(cv::Point2f(6, -6));
points2D.push_back(cv::Point2f(6, 6));
points2D.push_back(cv::Point2f(-6, 6));

Mat perspectiveMat = cv::getPerspectiveTransform(points2D, imagePoints);
cv::warpPerspective(*_image, *_undistortedImage, M, cv::Size(_image->cols, _image->rows));

Which gives my these results (look at the right-bottom corner for result of warpPerspective):

photo 1 photo 2 photo 3

As you probably see result image contains recognized marker in left-top corner of the result image. My problem is that I want to capture whole image (without cropping) so I could detect other markers on that image later.

How can I do that? Maybe I should use rotation/translation vectors from solvePnP function?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-11-07 18:51:12 -0600

axadiw gravatar image
edit flag offensive delete link more

Question Tools


Asked: 2013-10-30 18:26:57 -0600

Seen: 5,985 times

Last updated: Nov 07 '13