Giter Club home page Giter Club logo

knowledgemoney's Introduction

  • 环境:python3 pip3 OCR办法目前只支持Mac

OCR文字识别搜题,目前只支持Mac

采用的大致原理是手机连上Mac,通过自带的QuickTime实时显示手机屏幕,具体做法可以百度「怎么用 Quick Time Player 为 iPhone 录制屏幕」

brew install tesseract
  • 下载中文语言识别包

  • 找到语言包chi_sim.traineddata

  • 下载下来后放到,这里是Mac上的路径
    /usr/local/Cellar/tesseract/3.05.01/share/tessdata/

  • 安装python依赖库

pip3 install -r requirements.txt
  • 自行修改代码中的屏幕截图区域Frame

#由于每个人屏幕尺寸不同需要自行修改截图Frame "x, y, w, h "
#冲顶大会截图坐标
cddh_ques_loca       = "70, 150, 310, 120"
cddh_answer_one_loca = "100, 275, 270, 35"
cddh_answer_two_loca = "100, 330, 270, 35"
cddh_answer_thr_loca = "100, 376, 270, 35"

  • 运行程序
python3 KnMoney.py

识别效果

  • OCR毕竟比不上接口直接拿数据,会存在一定误差,发现识别不准是可以自行调节图像处理参数
#处理图像
enh_con = ImageEnhance.Contrast(image)
#对比度,锐度,亮度
contrast = 2.0
sharpness = 5.0
brightness = 5.0
  • 这是截图后识别成文字的效果

image.png

  • 这是丢进百度搜索的效果

image.png

感谢

喜欢的话记得star哦

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.