可能重复:
Executing cv::warpPerspective for a fake deskewing on a set of cv::Point
我正在使用this method修改图像。但是我没有按预期得到结果而是得到了这个 output http://imadev24.com/op.jpg
这是我的代码:
int main() {
const IplImage *input = cvLoadImage("input.jpg");
IplImage *output = cvCloneImage(input);
cvNamedWindow("Input", 1);
cvShowImage("Input", input);
CvMat* mmat = cvCreateMat(3,3,CV_32FC1);
//CvPoint2D32f* c1 = (&cvPoint2D32f(41,21), &cvPoint2D32f(241,41), &cvPoint2D32f(22,201), &cvPoint2D32f(260,181));
CvPoint2D32f* c1 = (&cvPoint2D32f(43,18), &cvPoint2D32f(280,40), &cvPoint2D32f(19,223), &cvPoint2D32f(304,200));
CvPoint2D32f* c2 = (&cvPoint2D32f(0,0), &cvPoint2D32f(320,0), &cvPoint2D32f(0,240), &cvPoint2D32f(320,240));
mmat = cvGetPerspectiveTransform(c1, c2,mmat);
cvWarpPerspective(input, output, mmat,CV_INTER_LINEAR);
cvNamedWindow("Output", 1);
cvShowImage("Output", output);
// wait key for 5000 ms
cv::waitKey(5000);
return 1;
}
我是图像处理的新手,无法弄清楚什么是错的。谁能指出我在实施这个问题上的错误?