轻量级公式 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
青尘工作室
一个喜欢做有趣事情的工作室。
青尘工作室
Papers, Datasets, Algorithms, SOTA for STR. Long-time Maintaining

Scene Text Recognition Recommendations Everythin about Scene Text Recognition SOTA • Papers • Datasets • Code Contents 1. Papers 2. Datasets 2.1 Synth

Deep Learning and Vision Computing Lab, SCUT 197 Jan 05, 2023
This is the open source implementation of the ICLR2022 paper "StyleNeRF: A Style-based 3D-Aware Generator for High-resolution Image Synthesis"

StyleNeRF: A Style-based 3D-Aware Generator for High-resolution Image Synthesis StyleNeRF: A Style-based 3D-Aware Generator for High-resolution Image

Meta Research 840 Dec 26, 2022
Text modding tools for FF7R (Final Fantasy VII Remake)

FF7R_text_mod_tools Subtitle modding tools for FF7R (Final Fantasy VII Remake) There are 3 tools I made. make_dualsub_mod.exe: Merges (or swaps) subti

10 Dec 19, 2022
Text to QR-CODE

QR CODE GENERATO USING PYTHON Author : RAFIK BOUDALIA. Installation Use the package manager pip to install foobar. pip install pyqrcode Usage from tki

Rafik Boudalia 2 Oct 13, 2021
An easy to use an (hopefully useful) captcha solution for pyTelegramBotAPI

pyTelegramBotCAPTCHA An easy to use and (hopefully useful) image CAPTCHA soltion for pyTelegramBotAPI. Installation: pip install pyTelegramBotCAPTCHA

29 Dec 26, 2022
APS 6º Semestre - UNIP (2021)

UNIP - Universidade Paulista Ciência da Computação (CC) DESENVOLVIMENTO DE UM SISTEMA COMPUTACIONAL PARA ANÁLISE E CLASSIFICAÇÃO DE FORMAS Link do git

Eduardo Talarico 5 Mar 09, 2022
Python Computer Vision Aim Bot for Roblox's Phantom Forces

Python-Phantom-Forces-Aim-Bot Python Computer Vision Aim Bot for Roblox's Phanto

drag0ngam3s 2 Jul 11, 2022
A webcam-based 3x3x3 rubik's cube solver written in Python 3 and OpenCV.

Qbr Qbr, pronounced as Cuber, is a webcam-based 3x3x3 rubik's cube solver written in Python 3 and OpenCV. 🌈 Accurate color detection 🔍 Accurate 3x3x

Kim 金可明 502 Dec 29, 2022
Reference Code for AAAI-20 paper "Multi-Stage Self-Supervised Learning for Graph Convolutional Networks on Graphs with Few Labels"

Reference Code for AAAI-20 paper "Multi-Stage Self-Supervised Learning for Graph Convolutional Networks on Graphs with Few Labels" Please refer to htt

Ke Sun 1 Feb 14, 2022
The virtual calculator will be above the live streaming from your camera

The virtual calculator is above the live streaming from my camera usb , the program first detect my hand and in each frame calculate the distance between two finger ,if the distance is lower than the

gasbaoui mohammed al amine 5 Jul 01, 2022
1st place solution for SIIM-FISABIO-RSNA COVID-19 Detection Challenge

SIIM-COVID19-Detection Source code of the 1st place solution for SIIM-FISABIO-RSNA COVID-19 Detection Challenge. 1.INSTALLATION Ubuntu 18.04.5 LTS CUD

Nguyen Ba Dung 170 Dec 21, 2022
Code for the AAAI 2018 publication "SEE: Towards Semi-Supervised End-to-End Scene Text Recognition"

SEE: Towards Semi-Supervised End-to-End Scene Text Recognition Code for the AAAI 2018 publication "SEE: Towards Semi-Supervised End-to-End Scene Text

Christian Bartz 572 Jan 05, 2023
Isearch (OSINT) 🔎 Face recognition reverse image search on Instagram profile feed photos.

isearch is an OSINT tool on Instagram. Offers a face recognition reverse image search on Instagram profile feed photos.

Malek salem 20 Oct 25, 2022
Create single line SVG illustrations from your pictures

Create single line SVG illustrations from your pictures

Javier Bórquez 686 Dec 26, 2022
Library used to deskew a scanned document

Deskew //Note: Skew is measured in degrees. Deskewing is a process whereby skew is removed by rotating an image by the same amount as its skew but in

Stéphane Brunner 273 Jan 06, 2023
This project is basically to draw lines with your hand, using python, opencv, mediapipe.

Paint Opencv 📷 This project is basically to draw lines with your hand, using python, opencv, mediapipe. Screenshoots 📱 Tools ⚙️ Python Opencv Mediap

Williams Ismael Bobadilla Torres 3 Nov 17, 2021
A machine learning software for extracting information from scholarly documents

GROBID GROBID documentation Visit the GROBID documentation for more detailed information. Summary GROBID (or Grobid, but not GroBid nor GroBiD) means

Patrice Lopez 1.9k Jan 08, 2023
Tools for manipulating and evaluating the hOCR format for representing multi-lingual OCR results by embedding them into HTML.

hocr-tools About About the code Installation System-wide with pip System-wide from source virtualenv Available Programs hocr-check -- check the hOCR f

OCRopus 285 Dec 08, 2022
kaldi-asr/kaldi is the official location of the Kaldi project.

Kaldi Speech Recognition Toolkit To build the toolkit: see ./INSTALL. These instructions are valid for UNIX systems including various flavors of Linux

Kaldi 12.3k Jan 05, 2023
chineseocr/table_line 表格线检测模型pytorch版

table_line_pytorch chineseocr/table_detct 表格线检测模型table_line pytorch版 原项目github: https://github.com/chineseocr/table-detect 1、模型转换 下载原项目table_detect模型文

1 Oct 21, 2021