1

Possible Duplicate:
Executing cv::warpPerspective for a fake deskewing on a set of cv::Point

I'm working on deskewing an image using this method .However i'm not getting the result as expected and instead getting this output http://imadev24.com/op.jpg

Here's my code:

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;
}

I'm a newbie in image processing and couldn't figure out whats wrong. Could anyone point me where i was wrong in implementing this ?

Community
  • 1
  • 1
Aryan
  • 27
  • 1
  • 7

0 Answers0