轻量级公式 OCR 小工具:一键识别各类公式图片,并转换为 LaTeX 格式

Overview

QC-Formula | 青尘公式 OCR

介绍

0_QCFormula.png

轻量级开源公式 OCR 小工具:一键识别公式图片,并转换为 LaTeX 格式。

  • 支持从 电脑本地 导入公式图片;(后续版本将支持直接从网页导入图片)
  • 公式图片支持 .png / .jpg / .bmp,大小为 4M 以内均可;
  • 支持印刷体手写体,前者识别效果更佳。

软件下载地址:https://github.com/QingchenWait/QC-Formula/releases

1 软件架构

  • 软件基于 Python 3.7 开发,界面基于 PyQt 5,项目 完全开源
  • 软件在 macOS 10.15.1 、Windows 10 测试通过,Linux 平台用户亦可自行编译。

2 使用教程

2.1 获取 API(必需)

本软件调用了 讯飞 的 API(后续有望增加更多源,以提高准确率),目前的免费额度为 500次 / 天,可以满足个人用户的使用需求。

在进行识别前,需要先自行申请 API 额度,然后在软件的 设置 页面,填写获得的 API。

API 的获取方法如下:

  1. 进入讯飞开放平台注册页面,注册一个新的账号;

  2. 进入公式识别业务页面,可以在首页顶栏的 “产品服务 - 文字识别 - 公式识别” 中找到;

    1_mainpage.png
  3. 点击 “服务管理”,会提示创建一个应用(如果之前没有账号的话),界面如下图所示。

    依次填写 “应用名称”、“应用分类” 与 “应用功能描述” 项,可以按自己喜好任意填写。

    2_CreateAPP.png
  4. 点击 “提交” ,即可进入服务管理页面,如下图所示。

    右侧的 APPIDAPISecretAPIKey 三项,即是我们需要的 API 值。

    3_APIInfo_B.png

2.2 将获取的 API 填入软件

  • 进入软件,点击 设置 页面,可以看到如下图所示的界面。

  • 将获取到的 APPIDAPISecretAPIKey 三项,分别填入对应的位置,然后点击 确定

至此,软件已经配置成功!可以选择需要的公式,进行识别了!

3 开发说明

3.1 软件需求

  • Python IDE 及环境:PyCharm Community 2020.2 + Python 3.7

    • 建议新建项目及 venv 虚拟环境进行开发。
    • 注意:在上述开发环境中,较高的 pip 版本似乎会导致在 PyCharm 中添加包失败。如果出现了同样的错误,请使用命令行将 pip 版本手动降级至 20.2.4 及以下,或尝试使用最新版本的 PyCharm。
  • GUI 编辑工具:PyQt5

    • 安装 Qt Designer,随后在 对应的 PyCharm 工程中配置 External Tools:Qt Designer 、 PyUIC 与 PyRcc。

    • 可参照下列教程进行配置:

      PyCharm 安装 PyQt5 及其工具(Qt Designer、PyUIC、PyRcc)详细教程

    • 若不需要使用 Qt Designer 进行可视化开发,或不打算对界面 GUI 进行修改,可以不安装 pyqt5-tools 包,在配置 External Tools 的过程中也不需要配置 Qt Designer 与 PyUIC 项。

3.2 文件树

  • /Examples :存放示例图片。
  • main_v104.py:软件主程序。
    • 此文件调用了 Init_Window_v104.pyOCR_iFLY_v104.py 中定义的类。
  • Init_Window_v104.py:PyQt GUI 控件定义及绘制源码,使用 PyUIC 生成。
  • Init_Window_v104.ui:Qt 窗口样式文件,可使用 Qt Designer 打开及编辑。
  • OCR_iFLY_v104.py:定义公式识别相关后端函数(讯飞接口)。
  • config.ini:配置文件,存放公式图片路径及 API 参数。
  • requirements.txt:程序的依赖项列表。

3.3 依赖配置

  • 程序的第三方依赖项已经包含在根目录的 requirements.txt 文档中,使用 pipreqs 生成。

  • 除此之外,还包含一个使用 pip freeze 命令生成的 requirements_all.txt 文档,包含此程序所需的所有依赖包。

    可以根据需求,选用以上两个文档中的一个。

  • 文档的使用方式:

    在命令行或使用 PyCharm 建立的虚拟环境中,使用以下命令:pip install -r requirements.txt

3.4 调试方法

  • 在 PyCharm 等 IDE 中,使用 requirements.txt 安装好相关依赖,随后运行 main_v104.py ,即可运行程序。
  • 程序的部分运行状态(如图片加载状态、公式识别结果完整 JSON 文本等)会输出到终端中,便于实时查看和调试。

4 目前已知的问题

  • 请勿使用 Windows 记事本直接编辑及保存 config.ini 配置文件!!!
    • 原因:Windows 记事本默认使用 ANCI 编码方式保存文件,而本程序使用 utf-8 编码格式读取,在读取中文路径 的时候会产生冲突。
    • 报错解决方式:若程序无法打开,并提示:UnicodeDecodeError:'utf-8' code can't ... ,则执行以下步骤:
      1. 使用记事本打开 config.ini 文件,选择 “文件 - 另存为”;
      2. 文件名填写 “config.ini”,保存类型填写 “所有文件”,最下方的编码选择 “utf-8”。
      3. 确认替换,重新打开软件即可。
  • 对于结构比较复杂的公式,识别准确率不高。后续将尝试引入其他识别 API 以提高准确率。

5 参与贡献

这个软件的界面和功能还非常原始,随时欢迎大家对它进行后续的开发。

  1. Fork 本仓库
  2. 新建 Feat_xxx 分支
  3. 提交代码
  4. 新建 Pull Request

6 关于作者

软件作者:青尘工作室

官方网站:https://qingchen1995.gitee.io

本程序 GitHub 仓库地址:https://github.com/QingchenWait/QC-Formula

本程序码云地址:https://gitee.com/qingchen1995/qc-formula

You might also like...
A pure pytorch implemented ocr project including text detection and recognition
A pure pytorch implemented ocr project including text detection and recognition

ocr.pytorch A pure pytorch implemented ocr project. Text detection is based CTPN and text recognition is based CRNN. More detection and recognition me

python ocr using tesseract/ with EAST opencv detector

pytextractor python ocr using tesseract/ with EAST opencv text detector Uses the EAST opencv detector defined here with pytesseract to extract text(de

Run tesseract with the tesserocr bindings with @OCR-D's interfaces

ocrd_tesserocr Crop, deskew, segment into regions / tables / lines / words, or recognize with tesserocr Introduction This package offers OCR-D complia

A set of workflows for corpus building through OCR, post-correction and normalisation
A set of workflows for corpus building through OCR, post-correction and normalisation

PICCL: Philosophical Integrator of Computational and Corpus Libraries PICCL offers a workflow for corpus building and builds on a variety of tools. Th

Tensorflow-based CNN+LSTM trained with CTC-loss for OCR

Overview This collection demonstrates how to construct and train a deep, bidirectional stacked LSTM using CNN features as input with CTC loss to perfo

🖺 OCR using tensorflow with attention

tensorflow-ocr 🖺 OCR using tensorflow with attention, batteries included Installation git clone --recursive http://github.com/pannous/tensorflow-ocr

This is the implementation of the paper
This is the implementation of the paper "Gated Recurrent Convolution Neural Network for OCR"

Gated Recurrent Convolution Neural Network for OCR This project is an implementation of the GRCNN for OCR. For details, please refer to the paper: htt

A tool for extracting text from scanned documents (via OCR), with user-defined post-processing.

The project is based on older versions of tesseract and other tools, and is now superseded by another project which allows for more granular control o

MXNet OCR implementation. Including text recognition and detection.

insightocr Text Recognition Accuracy on Chinese dataset by caffe-ocr Network LSTM 4x1 Pooling Gray Test Acc SimpleNet N Y Y 99.37% SE-ResNet34 N Y Y 9

Releases(v1.0.4)
  • v1.0.4(Dec 24, 2021)

    青尘公式 OCR 的第一个发行版,基于 v1.0.4 版本源码,使用 PyInstaller 编译并打包。

    • 适用系统:
      • Windows / macOS 系统,可以下载对应版本的 zip 压缩包。Linux 平台用户可下载源码并自行编译打包。
      • 在 Windows 10 / macOS 10.15 平台测试通过,其余版本系统的兼容性暂时未测试。
    • 使用方法:
      • Windows 系统:下载并解压 QC-Formula-v1.0.4-win10-64bit.zip 压缩包,打开 青尘公式 OCR.exe 即可运行。
      • macOS 系统:下载并解压 QC-Formula-v1.0.4-macOS10.15-64bit.zip 压缩包,打开 QC-Formula-v104.exec 即可运行。
      • 首次打开后,需要进行公式识别 API 的配置。 方法可以参考:使用教程
    • v1.0.4 更新与修复:
      1. 修改了部分 PyQt 控件尺寸,使控件在 1920x1080 分辨率屏幕中,也能够以相对正常的尺寸显示。
      2. 修复了 Windows 系统下,当路径存在中文时,程序闪退的问题。(如果依然发生闪退,可以参考:解决方案
    Source code(tar.gz)
    Source code(zip)
    QC-Formula-v1.0.4-macOS10.15-64bit.zip(34.37 MB)
    QC-Formula-v1.0.4-win10-64bit.zip(34.89 MB)
Owner
青尘工作室
一个喜欢做有趣事情的工作室。
青尘工作室
A toolbox of scene text detection and recognition

FudanOCR This toolbox contains the implementations of the following papers: Scene Text Telescope: Text-Focused Scene Image Super-Resolution [Chen et a

FudanVIC Team 170 Dec 26, 2022
Omdena-abuja-anpd - Automatic Number Plate Detection for the security of lives and properties using Computer Vision.

Omdena-abuja-anpd - Automatic Number Plate Detection for the security of lives and properties using Computer Vision.

Abdulazeez Jimoh 1 Jan 01, 2022
Some codes from PyImageSearch course's and external projects.

👨‍💻 Some codes and projects 👨‍💻 💡 Technologies 📜 Projects 📍 Chrome Dinosaur Controller 📦 Script 📍 Coins Counter 📦 Script 🤓 Author Lucas Biv

Lucas Bivar 25 Oct 24, 2021
Multi-Oriented Scene Text Detection via Corner Localization and Region Segmentation

This is the official implementation of "Multi-Oriented Scene Text Detection via Corner Localization and Region Segmentation". For more details, please

Pengyuan Lyu 309 Dec 06, 2022
A selectional auto-encoder approach for document image binarization

The code of this repository was used for the following publication. If you find this code useful please cite our paper: @article{Gallego2019, title =

Javier Gallego 89 Nov 18, 2022
STEFANN: Scene Text Editor using Font Adaptive Neural Network

STEFANN: Scene Text Editor using Font Adaptive Neural Network @ The IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) 2020.

Prasun Roy 208 Dec 11, 2022
✌️Using this you can control your PC/Laptop volume by Hand Gestures created with Python.

Hand Gesture Volume Controller ✋ Hand recognition 👆 Finger recognition 🔊 you can decrease and increase volume Demo Code Firstly I have created a Mod

Abbas Ataei 19 Nov 17, 2022
An OCR evaluation tool

dinglehopper dinglehopper is an OCR evaluation tool and reads ALTO, PAGE and text files. It compares a ground truth (GT) document page with a OCR resu

QURATOR-SPK 40 Dec 20, 2022
OpenMMLab Text Detection, Recognition and Understanding Toolbox

Introduction English | 简体中文 MMOCR is an open-source toolbox based on PyTorch and mmdetection for text detection, text recognition, and the correspondi

OpenMMLab 3k Jan 07, 2023
The papers published in top-tier AI conferences in recent years.

AI-conference-papers The papers published in top-tier AI conferences in recent years. Paper table AAAI ICLR CVPR ICML ICCV ECCV NIPS 2019 ✔️ ✔️ ✔️ ✔️

Jinbae Park 6 Dec 09, 2022
A general list of resources to image text localization and recognition 场景文本位置感知与识别的论文资源与实现合集 シーンテキストの位置認識と識別のための論文リソースの要約

Scene Text Localization & Recognition Resources Read this institute-wise: English, 简体中文. Read this year-wise: English, 简体中文. Tags: [STL] (Scene Text L

Karl Lok (Zhaokai Luo) 901 Dec 11, 2022
A python program to block out your face

Readme This is a small program I threw together in about 6 hours to block out your face. It probably doesn't work very well, so be warned. By default,

1 Oct 17, 2021
Roboflow makes managing, preprocessing, augmenting, and versioning datasets for computer vision seamless.

Roboflow makes managing, preprocessing, augmenting, and versioning datasets for computer vision seamless. This is the official Roboflow python package that interfaces with the Roboflow API.

Roboflow 52 Dec 23, 2022
Automatically download multiple papers by keywords in CVPR

CVFPaperHelper Automatically download multiple papers by keywords in CVPR Install mkdir PapersToRead cd PaperToRead pip install requests tqdm git clon

46 Jun 08, 2022
Script para controlar o movimento do mouse usando Python e openCV com câmera em tempo real que detecta pontos de referência da mão, rastreia padrões de gestos em vez de um mouse físico.

mouserController Script para controlar o movimento do mouse usando Python e openCV com câmera em tempo real que detecta pontos de referência da mão, r

Vinícius Azevedo 6 Jun 28, 2022
👄 The most accurate natural language detection library for Java and the JVM, suitable for long and short text alike

Quick Info this library tries to solve language detection of very short words and phrases, even shorter than tweets makes use of both statistical and

Peter M. Stahl 532 Dec 28, 2022
An organized collection of tutorials and projects created for aspriring computer vision students.

A repository created with the purpose of teaching students in BME lab 308A- Hanoi University of Science and Technology

Givralnguyen 5 Nov 24, 2021
This is a project to detect gestures to zoom in or out, using the real-time distance between the index finger and the thumb. It's based on OpenCV and Mediapipe.

Pinch-zoom This is a python project based on real-time hand-gesture detection, to zoom in or out, using the distance between the index finger and the

Harshit Bhalla 6 Jul 11, 2022
A small C++ implementation of LSTM networks, focused on OCR.

clstm CLSTM is an implementation of the LSTM recurrent neural network model in C++, using the Eigen library for numerical computations. Status and sco

Tom 794 Dec 30, 2022
🔎 Like Chardet. 🚀 Package for encoding & language detection. Charset detection.

Charset Detection, for Everyone 👋 The Real First Universal Charset Detector A library that helps you read text from an unknown charset encoding. Moti

TAHRI Ahmed R. 332 Dec 31, 2022