Search code examples
pythonopencvimage-processingcomputer-visionwatermark

How to remove watermark from text document using openCV python?


image

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.


Solution

  • 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()
    

    Result

    Let me know if this works for you