我承担了破译旧出生/洗礼声明(1734)的一些手写文本的任务,该声明在页面底部已被水洗(见original photo Chavane.jpg)。
更具体地说,它是用于删除的文本,从姓氏输入 Chavane 之后开始,您几乎无法阅读“Le dix neuf décembre...”。我们的总统可以做的最好尝试显示为 Chavane2.jpg .
我 tried isolating only the erased part ,这应该是我们真正的出发点,在应用不同的技术之前(例如 these ),但是我对图像处理的了解非常低,结果也好不到哪里去。我能得到的最好结果是under clahe_2.png ,使用以下代码:
import cv2 as cv
img = cv.imread('Chavane.jpg',0)
# create a CLAHE object (Arguments are optional).
clahe = cv.createCLAHE(clipLimit=2.0, tileGridSize=(8,8))
cl1 = clahe.apply(img)
在尝试用 Gimp 逐像素删除之前,我想确定这确实是最好的基础。
最佳答案
您可以在 Python/OpenCV 中使用除法标准化来提高质量。
输入:
import cv2
import numpy as np
import skimage.filters as filters
# read the image
img = cv2.imread('Chavane.jpg')
# convert to gray
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
# blur
smooth = cv2.GaussianBlur(gray, (33,33), 0)
# divide gray by morphology image
division = cv2.divide(gray, smooth, scale=255)
# sharpen using unsharp masking
sharp = filters.unsharp_mask(division, radius=1.5, amount=2.5, multichannel=False, preserve_range=False)
sharp = (255*sharp).clip(0,255).astype(np.uint8)
# save results
cv2.imwrite('Chavane_division.jpg',division)
cv2.imwrite('Chavane_division_sharp.jpg',sharp)
# show results
cv2.imshow('smooth', smooth)
cv2.imshow('division', division)
cv2.imshow('sharp', sharp)
cv2.waitKey(0)
cv2.destroyAllWindows()
分区图:
锐化图像:
关于python - 使用 OpenCV 或 Gimp 使用水洗墨水提高旧手写出生声明的质量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64206403/