Last active
July 9, 2020 17:52
-
-
Save joschuck/33e0353c5fc3c4fd12c90aad424f9656 to your computer and use it in GitHub Desktop.
Enhance Scanned Document
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image = cv2.imread('input.jpg', 0) # read as grayscale | |
th = cv2.adaptiveThreshold(image, | |
255, # maximum value assigned to pixel values exceeding the threshold | |
cv2.ADAPTIVE_THRESH_GAUSSIAN_C, # gaussian weighted sum of neighborhood | |
cv2.THRESH_BINARY, # thresholding type | |
5, # block size (5x5 window) | |
3) # constant |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment