3

I'm trying to make a simple scanner program, which takes in an image of a piece of paper and create a binary image based off of that. An example of what I am trying to do is below:

Img

However, as you can see, the program uses the 4 corners of the paper to create the image. This means that the program doesn't take into account the curvature of the paper.

Is there anyway to "warp" the image with more than four points? By this, I mean find the bounding rectangle, and if the contour line is outside the rectangle, shrink that row of pixels, and if the contour line is inside, then extend it?

I feel like this should exist in some way or form, but if it doesn't, it may be time to delve into the depths of OpenCV :D

Thanks!

agupta231
  • 1,161
  • 2
  • 14
  • 24
  • No, OpenCV only has _rigid_ transformations. You may want to look for a good implementation of [thin plate splines](https://en.wikipedia.org/wiki/Thin_plate_spline) – Miki Mar 24 '17 at 19:19
  • https://stackoverflow.com/questions/22443568/how-do-i-apply-a-perspective-transform-with-more-than-4-pairs-of-points Here is the link for similar question asked – Sanober Sayyed Jul 11 '17 at 04:16
  • Do you found any solution..? – Venkat Feb 19 '23 at 06:43

0 Answers0