1 | initial version |
try with the c++ api, it's not very difficult:
Mat ocv = imread("tennis.jpg");
Mat image;
vector<Point2f> P,Q;
P.push_back(Point2f(163,101));
Q.push_back(Point2f(0,0));
P.push_back(Point2f(432,99));
Q.push_back(Point2f(200,0));
P.push_back(Point2f(563,395));
Q.push_back(Point2f(200,200));
P.push_back(Point2f(31,393));
Q.push_back(Point2f(0,200));
Mat rot = cv::getPerspectiveTransform(P,Q);
cerr << rot << endl;
Mat result;
cv::warpPerspective(ocv, result, rot, Size(220,220));
imshow("result",result);
waitKey();
2 | No.2 Revision |
try with the c++ api, it's not very difficult:
Mat ocv = imread("tennis.jpg");
Mat image;
vector<Point2f> P,Q;
P.push_back(Point2f(163,101));
Q.push_back(Point2f(0,0));
Q.push_back(Point2f(10,10));
P.push_back(Point2f(432,99));
Q.push_back(Point2f(200,0));
Q.push_back(Point2f(210,10));
P.push_back(Point2f(563,395));
Q.push_back(Point2f(200,200));
Q.push_back(Point2f(210,210));
P.push_back(Point2f(31,393));
Q.push_back(Point2f(0,200));
Q.push_back(Point2f(10,210));
Mat rot = cv::getPerspectiveTransform(P,Q);
cerr << rot << endl;
Mat result;
cv::warpPerspective(ocv, result, rot, Size(220,220));
imshow("result",result);
waitKey();
3 | No.3 Revision |
try with the c++ api, it's not very difficult:
Mat ocv = imread("tennis.jpg");
Mat image;
vector<Point2f> P,Q;
P.push_back(Point2f(163,101));
Q.push_back(Point2f(10,10));
Q.push_back(Point2f(10,10)); // 10 pixel border on all sides
P.push_back(Point2f(432,99));
Q.push_back(Point2f(210,10));
P.push_back(Point2f(563,395));
Q.push_back(Point2f(210,210));
P.push_back(Point2f(31,393));
Q.push_back(Point2f(10,210));
Mat rot = cv::getPerspectiveTransform(P,Q);
cerr << rot << endl;
Mat result;
cv::warpPerspective(ocv, result, rot, Size(220,220));
imshow("result",result);
waitKey();
4 | No.4 Revision |
try with the c++ api, it's not very difficult:
#include "opencv2/opencv.hpp"
using namespace cv;
int main() {
Mat ocv = imread("tennis.jpg");
Mat image;
vector<Point2f> P,Q;
P.push_back(Point2f(163,101));
Q.push_back(Point2f(10,10)); // 10 pixel border on all sides
P.push_back(Point2f(432,99));
Q.push_back(Point2f(210,10));
P.push_back(Point2f(563,395));
Q.push_back(Point2f(210,210));
P.push_back(Point2f(31,393));
Q.push_back(Point2f(10,210));
Mat rot = cv::getPerspectiveTransform(P,Q);
cerr << rot << endl;
Mat result;
cv::warpPerspective(ocv, result, rot, Size(220,220));
imshow("result",result);
waitKey();
return 0;
}
5 | No.5 Revision |
try with the c++ api, it's not very difficult:
#include "opencv2/opencv.hpp"
using namespace cv;
int main() {
Mat ocv = imread("tennis.jpg");
Mat image;
vector<Point2f> P,Q;
P.push_back(Point2f(163,101));
Q.push_back(Point2f(10,10)); // 10 pixel border on all sides
P.push_back(Point2f(432,99));
Q.push_back(Point2f(210,10));
P.push_back(Point2f(563,395));
Q.push_back(Point2f(210,210));
P.push_back(Point2f(31,393));
Q.push_back(Point2f(10,210));
Mat rot = cv::getPerspectiveTransform(P,Q);
cerr << rot << endl;
Mat result;
cv::warpPerspective(ocv, result, rot, Size(220,220));
imshow("result",result);
waitKey();
return 0;
}