如何删除图像Python中的水印背景 [英] How to remove watermark background in image Python

查看:1444
本文介绍了如何删除图像Python中的水印背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张如下图片,





我想删除背景水印。



到目前为止,我尝试在<$ c $中修复方法C>的OpenCV 。它没有帮助我。



我试过以下脚本:

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

我是图像处理新手, opencv 。所以,我不知道我是否以正确的方式进行修复。我应该采取什么方法来删除背景水印。



我想从我的图片中删除绿色引号水印。





任何帮助都会更加明显。

解决方案

此处的文字强度与水印的强度不同。您可以使用简单的亮度/对比度变换进行游戏,即增加增益/对比度,直到水印消失并降低亮度以进行补偿。



参见


I have a image like below,

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.

any help would be more appreciable.

解决方案

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)

这篇关于如何删除图像Python中的水印背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆