如何使用openCV python从文本文档中删除水印?
问题描述:
我是OpenCV的新手,我需要帮助从该图像中删除水印,我尝试使用了inpaint,但我想使用一种更自动化的特征映射和修复方法,请帮忙解决它.
I am new to OpenCV, I need help removing the watermark from this image, I tried using inpaint but I want a more automated way of feature mapping and inpainting, pls help me with it.
答
如果您的所有图像都是这样,并且如问题中所示的带有水印的水印带有浅灰色水印,则可以使用简单的阈值操作.
If all your images are like this and have a watermark as shown in the question having a light gray watermark then a simple thresholding operation will work.
import cv2
img = cv2.imread('watermark.jpg')
_, thresh = cv2.threshold(img, 150, 255, cv2.THRESH_BINARY)
cv2.imshow('Result', thresh)
cv2.waitKey(0)
cv2.destroyAllWindows()
让我知道这是否对您有用
Let me know if this works for you