4

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.

Bilal
  • 3,191
  • 4
  • 21
  • 49
  • please check the link and your may be your answer https://stackoverflow.com/questions/50792812/how-to-remove-watermark-background-in-image-python – Flankes Jul 25 '20 at 14:45
  • 1
    @AAYUSHLAKHANI Welcome to Stack Overflow! Please take the [tour](https://stackoverflow.com/tour) and read [How to Ask](https://stackoverflow.com/help/how-to-ask). Please [edit](https://stackoverflow.com/posts/63088442/edit) the post to include your own effort into solving this problem. The latter preferably in code, this is called a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example). – Bilal Jul 25 '20 at 19:37

1 Answers1

7

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

Vardan Agarwal
  • 2,023
  • 2
  • 15
  • 27
  • Thanks, it worked for me, but in doing this, some of the characters I want to keep are losing thickness. Is there any way to subtract just the watermark from the system without losing any other information? – Anmol Deep Apr 07 '23 at 10:40