39 #include <opencv2/stitching/detail/warpers.hpp> 52 invertAffineTransform(transform.rowRange(0, 2), H);
53 cv::Rect roi =
warpRoi(grid, H);
55 H.at<
double>(0, 2) -= roi.tl().x;
56 H.at<
double>(1, 2) -= roi.tl().y;
57 warpAffine(grid, warped_grid, H, roi.size(), cv::INTER_NEAREST,
59 cv::Scalar::all(255) );
67 cv::Ptr<cv::detail::PlaneWarper> warper =
68 cv::makePtr<cv::detail::PlaneWarper>();
70 transform.convertTo(H, CV_32F);
74 cv::Mat T = cv::Mat::zeros(3, 1, CV_32F);
75 H.colRange(2, 3).rowRange(0, 2).copyTo(T.rowRange(0, 2));
77 cv::Mat R = cv::Mat::eye(3, 3, CV_32F);
78 H.colRange(0, 2).copyTo(R.rowRange(0, 2).colRange(0, 2));
80 return warper->warpRoi(grid.size(), cv::Mat::eye(3, 3, CV_32F), R, T);
cv::Rect warp(const cv::Mat &grid, const cv::Mat &transform, cv::Mat &warped_grid)
cv::Rect warpRoi(const cv::Mat &grid, const cv::Mat &transform)