I tried the following code for perspective transform
#include "opencv2/opencv.hpp"
using namespace cv;
int main()
{
Mat ocv = imread("tennis.jpg");
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);
Mat result;
cv::warpPerspective(ocv, result, rot, Size(220,220));
imshow("result",result);
waitKey();
return 0;
}
I tried to get the coordinates of the source object for transform with mousecallback() but i cant able to achieve it Please tell me the logic to get four co-ordinate points using mousecallback function?