如何为Tesseract预处理此图像?

时间:2019-07-25 23:29:40

标签: python image opencv image-processing tesseract

很长一段时间以来,我一直在试图找到一种方法来处理此图像,它的质量非常差,明显低于300ppi,我正在尝试使用模糊度和阈值对其进行处理。 Image

我所做的一切,可以使用这张图片吗?

img = cv2.imread(img_path, 0)

img = cv2.GaussianBlur(img, (3, 3), 0)
_, threshold = cv2.threshold(img, 65, 255, cv2.THRESH_BINARY)

Preprocessed

我的目标:获取此文档中的所有数据(名字,姓氏,日期)

目标示例: Result

1 个答案:

答案 0 :(得分:0)

img = cv2.imread(img_path, 0)

y=53
x=230
h=335
w=380

img = img[y:y+h, x:x+w]

img = cv2.resize(img, (0,0), fx=1.5, fy=1.5) 

img = cv2.GaussianBlur(img, (3, 3), 0)
_, threshold = cv2.threshold(img, 65, 255, cv2.THRESH_BINARY)
threshold = cv2.GaussianBlur(threshold, (3, 3), 0)