Affine Transform, Simple Rotation and Scaling or something else entirely?

后端 未结 2 1311
囚心锁ツ
囚心锁ツ 2020-12-06 17:01

The scenario goes like this: I have a picture of a paper that I would like to do some OCR. So take the image below as my input example:

相关标签:
2条回答
  • It's called Keystone correction, or keystoning. It transforms a shape that looks like a trapezoid into a rectangle.

    Book Scan Wizard program offers techniques to correct this artifact, you may want to check it out.

    0 讨论(0)
  • 2020-12-06 17:50

    I think http://felix.abecassis.me/2011/10/opencv-rotation-deskewing/ and http://felix.abecassis.me/2011/10/opencv-bounding-box-skew-angle/ will come in handy. The aforementioned posts don't cover perspective warping (only rotation). To get the best results, you'll have to use warpPerspective (maybe in conjunction with getRotationMatrix2D). Use the angles between line segments to find out how much you need to warp the perspective. THe assumption here is that they should always be 90 degrees and that the closest one to 90 degrees is the "closest" vector as far as the perspective is concerned.

    Don't forget to normalize your vectors!

    0 讨论(0)
提交回复
热议问题