How to remove watermark background in image Python

前端 未结 1 1605
青春惊慌失措
青春惊慌失措 2020-12-07 23:50

I have a image like below,

I would like to remove background watermark.

So far I tried, inpainting method in opencv. It di

相关标签:
1条回答
  • 2020-12-07 23:55

    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)
    

    0 讨论(0)
提交回复
热议问题