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
import sys | |
import matplotlib.pyplot as plt | |
import numpy as np | |
from PIL import Image as im | |
from scipy.ndimage import interpolation as inter | |
input_file = sys.argv[1] | |
img = im.open(input_file) |
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
def remove_clear(img, degree): | |
''' | |
Preprocess l'image avant l'algo de détection de texte de manière à avoir une image thresholdée optimale | |
''' | |
# img = cv2.bilateralFilter(img, degree, 75, 75) | |
img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) | |
img = cv2.adaptiveThreshold(img, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C,\ | |
cv2.THRESH_BINARY,65,11) | |
# _, img = cv2.threshold(img,170,255,cv2.THRESH_BINARY) |