Skip to content

Instantly share code, notes, and snippets.

@smeschke
smeschke / align_scan.py
Last active December 26, 2024 17:25
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]