GithubHelp home page GithubHelp logo

leeyongchao / table_ocr_0.1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zkity/table_ocr_0.1

0.0 1.0 0.0 1.37 MB

generate an excel file from a picture of a table

License: MIT License

Python 100.00%

table_ocr_0.1's Introduction

table_ocr_0.1

generate an excel file from a picture of a table

根据表格图像生成表格文件

这一小段代码可以从一个简单的表格图片中生成表格文件,如下

项目的起源是一个作业中只有一个表格的图片,需要手工把数据输入,这的确惹恼了一个计算机专业的学生 #_#

依赖安装

pip install opencv-python
pip install numpy
pip install openpyxl
pip install baidu-aip

实现

使用投影的方法把表格图片按每个单元格分割开,因此只适用于标准的表格图片,而且不存在单元格合并的情况

调用百度ocr API识别单元格中的文字

将每个单元格的内容写入excel文件中

使用

将项目clone到本地

安装依赖

将需要识别的表格图片放到./res/ora中

到./src中执行 python3 main.py

结果在./res/excel中

配置文件

配置文件位于 ./res/conf.json

'''
{
"bd":{
	"app_id": "***",
	"api_key": "***",
	"secret_key": "***"
},
"us":{
	"mode": "0",                                      
	"ora_path": "../res/ora",
	"excel_path": "../res/excel"
}
}
'''
  • 其中bd中的信息是 百度OCR的配置信息,请自己申请应用替换信息,免费。

  • mode是识别的模式

    • 0-快速,精确度低,每天50000次免费使用,适用于图片的分辨率高

    • 1-较慢,精确度高,每天500次免费使用,适用于图片的分辨率低

  • ora_path是识别图片的存放路径

  • excel_path是结果的存放路径

table_ocr_0.1's People

Contributors

zkity 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.