Skip to content

Instantly share code, notes, and snippets.

@smeschke
smeschke / align_scan.py
Last active May 17, 2024 01:45
Aligns a scanned document to find optimal rotation
import cv2
import numpy as np
src = 255 - cv2.imread('/home/stephen/Desktop/I7Ykpbs.jpg',0)
scores = []
h,w = src.shape
small_dimention = min(h,w)
src = src[:small_dimention, :small_dimention]