remove watermark. 去除图片中的水印
remove watermark. 根据水印模板图片自动寻找并去除图片中对应的水印,利用 Python 和 OpenCV 快速实现。
$ brew install opencv3 --without-python --with-python3 --c++11 --with-contrib
Verifying the installation:
import cv2
print(cv2.__version__)
If you got this error: "ImportError: No module named 'cv2'", then your symlink might be corrupted, you need to link your opencv to python site-packages:
$ brew link --force opencv3
$ pip3 install nowatermark
from nowatermark import WatermarkRemover
path = './data/'
watermark_template_filename = path + 'anjuke-watermark-template.jpg'
remover = WatermarkRemover()
remover.load_watermark_template(watermark_template_filename)
remover.remove_watermark(path + 'anjuke3.jpg', path + 'anjuke3-result.jpg')
remover.remove_watermark(path + 'anjuke4.jpg', path + 'anjuke4-result.jpg')