A collection of document deskewing methods.
- index.html. A web document scanning app based on Dynamic Web TWAIN which provides document images deskewing.
run-magick.bat
. Deskew document images using ImageMagick.run-python.py
. Deskew document images using Python + OpenCV.
Here are the steps using image processing to deskew document images based on text lines.
- Normalize the image with the following operations:
- Blur
- Resize
- Crop border
- Grayscale
- Invert
- Threshold
- Find countours based on the binary image.
- Get the rotation angle of every contours and use the median as the skewed angle.
- Run affine transformation to get the deskewed image.
You can find the corresponding code in the py
file.