Giter VIP home page Giter VIP logo

delwaterprint's Introduction

Python-openCV发票去印章

python-openCV写了一个去除发票红色印章水印的小工具。鼠标拖拽,模拟inpaint图像修复的操作去除红色印章。修改HSV颜色值还可以用来去蓝色印章。

文档结构

主程序为del_Water_print.py

包含选择操作:

1、分离色道;
	channel = input('''请选择通道:
        r:红色通道
        g:绿色通道
        b:蓝色通道
        q:返回上一级菜单
        ''')
2、鼠标选择抹除印章")
	印章颜色:
        1、红色印章
        2、蓝色印章
        q、返回上一级目录

测试程序scale_with_Trackbar.py用来观察不同阈值下的图像二值化变化。

测试程序show_histogram.py用来输出观察灰度的直方图分布,并且设置固定阈值二值化。

测试程序hsv_12121.py用来输出观察灰度的直方图分布,并且设置固定阈值二值化。

代码说明

输入图像:

# path 为输入待处理图像地址
path = "src/input1.png "

处理结果保存在/results

操作说明

读取待处理图像:

img = cv2.imread("input1.png")  #加载图片

鼠标拖拽完成去印章效果:

颜色通道二值化去印章效果:

英文输入法下,按s保存:

    if cv2.waitKey(0) & 0xFF == ord('s'):
        cv2.imwrite("results/roi_red_removed.jpg", image)
        print("图像已经保存")

运行时Console控制台输出结果为鼠标点击坐标,point1左上角起始点,point2右下角终止点,width为点击横跨宽幅,heigh为横跨高。

delwaterprint's People

Contributors

samggggflynn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.