1

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

I am using OpenCV. I would like to transform an image, which have a parallelogram, to rectangle image. Please tell me how to do ?

Thanks.

Community
  • 1
  • 1
Mau Vu Huu
  • 101
  • 1
  • 3
  • 10
  • 1
    You should try something first instead of "show me the solution". This website is for helping you when you're stuck, not doing the work for you. – Stephan Celis Jan 24 '13 at 14:37

2 Answers2

0

Take a look in the documentation of OpenCV regarding affine transformations. There are examples on there:

http://opencv.willowgarage.com/documentation/cpp/geometric_image_transformations.html

Didac Perez Parera
  • 3,734
  • 3
  • 52
  • 87
0

You want to shear the image (or part of it)

For this you could use an affine transform with the warpAffine function

  void warpAffine(const Mat& src, Mat& dst, const Mat& M, Size dsize, 
                  int flags=INTER_LINEAR, int borderMode=BORDER_CONSTANT, 
                  const Scalar& borderValue=Scalar())

and read this Q&A: Performing shear with altered origin in OpenCV

Community
  • 1
  • 1
foundry
  • 31,615
  • 9
  • 90
  • 125