Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove watermark background in image Python

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.

like image 292
Mohamed Thasin ah Avatar asked Jun 11 '18 07:06

Mohamed Thasin ah


People also ask

How do I remove aspose watermark in Python?

If the watermarks are added using a Shape class object then to remove the watermark from a document you have to set only the name of watermark shape during inserting and then remove watermark shape by an assigned name.


1 Answers

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

like image 158
filippo Avatar answered Oct 17 '22 07:10

filippo