20

I have a image like below,

enter image description here

I would like to remove background watermark.

So far I tried, inpainting method in opencv. It didn't help me.

I tried following script:

edges = cv2.Canny(img,50,150,apertureSize = 3)
dst = cv2.inpaint(img,edges,3,cv2.INPAINT_TELEA)

I am new to image processing and opencv. So, I don't know whether I'm doing in the correct way or not for performing inpainting. What method should I do for removing background watermarks.

I would like to remove green quoted watermark from my image.

enter image description here

any help would be more appreciable.

Grokify
  • 13,266
  • 6
  • 50
  • 73
Mohamed Thasin ah
  • 9,418
  • 9
  • 43
  • 83

1 Answers1

37

Text here has a different intensity than the watermark. You could play around with a simple brightness/contrast transformation, i.e. increasing gain/contrast until the watermark vanishes and reducing brightness to compensate.

See OpenCV docs for a simple tutorial.

Here's a quick attempt in Python, not really using OpenCV because it's not needed IMHO for such a simple linear transformation. Play around with alpha (contrast) and beta (brightness) parameters until you get the result you want

import cv2
import numpy as np

img = cv2.imread("veidz.jpg")

alpha = 2.0
beta = -160

new = alpha * img + beta
new = np.clip(new, 0, 255).astype(np.uint8)

cv2.imwrite("cleaned.png", new)

removed watermark

filippo
  • 4,858
  • 2
  • 18
  • 40
  • 3
    This approach works for basic texts on white background , what if there are color images with colour watermark, i tried playing with contrast and brightness but no luck, it is just distorting the images. Can you highlight any other algorithm which can do that – Ravi Apr 06 '20 at 19:51
  • this was never intended as a general method to remove watermarks, it was more to say that sometimes in image processing and computer vision the simplest transformations can take you a long way... – filippo Mar 12 '21 at 14:20