python opencv 去除水印,python去除水印,#!/usr/bin
python opencv 去除水印,python去除水印,#!/usr/bin
#!/usr/bin/env python# -*- coding:utf-8 -*-# Author : zhibo.wang# E-mail : [email protected]# Date : 18/11/03 20:07:41# Desc :import cv2import numpy as npdef img_clean(img): height, width = img.shape[0:2] cv2.namedWindow("Image", 0) cv2.resizeWindow("Image", int(width / 2), int(height / 2)) cv2.imshow(‘Image‘, img) rects = ((width - 170, height - 38, width, height),(1, 1, 164, 100)) #水印区域 mask = np.zeros((height, width), np.uint8) for rect in rects: x1, y1, x2, y2 = rect cv2.rectangle(mask, (x1, y1), (x2, y2), (255, 255, 255), -1) img = cv2.inpaint(img, mask, 1.5, cv2.INPAINT_TELEA) #蒙版 cv2.namedWindow("newImage", 0) cv2.resizeWindow("newImage", int(width / 2), int(height / 2)) cv2.imshow(‘newImage‘, img) cv2.waitKey(0) cv2.destroyAllWindows()if __name__ == ‘__main__‘: f_img = ‘shui1.jpg‘ img = cv2.imread(f_img) img_clean(img)
python opencv 去除水印
相关内容
- Python基础语法,python语法规则,编码Python源码
- Python 实现随机打乱字符串,字符串,# 随机打乱字符串
- python---数学表达式的分析树实现,python表达式,先走一遍
- Python基础知识,python基础知识测试,1.初识python
- python3 pexpect模块,python模块,pexpectimp
- python 求阶乘之和。求1+2!+3!+...+20!的和,python求5的阶乘
- python matplotlib模块——绘制三维图形、三维数据散点图
- python: 深度学习-梯度,,梯度的实现: 1 i
- Python绘制五星红旗,什么的五星红旗,# -*- codi
- python打造seo必备工具-自动查询排名,pythonseo, 因为工作
评论关闭