表单识别已经经过验证可行的python代码。
使用OpenCV进行图片处理,校正,二值化,去噪等。
对表单的边框进行识别划分表格,实现输出的文件和输入的位置对应。
1.EasyOCR
EasyOCR是支持70多种语言的OCR,包括中文,日文,韩文和泰文等。对中文的识别准确率很不错。
调用了EasyOCR库进行文字识别需要数据集。可以自动下载
pip install easyocr
但有下不成功的可能,也可以下载数据集之后放到指定位置。
文字检测模型(CRAFT)(必须)
https://pythondict.com/go/?url=https://github.com/JaidedAI/EasyOCR/releases/download/pre-v1.1.6/craft_mlt_25k.zip
中文(简体)模型(识别中文必须)
https://pythondict.com/go/?url=https://github.com/JaidedAI/EasyOCR/releases/download/pre-v1.1.6/chinese_sim.zip
中国(传统)模型
https://pythondict.com/go/?url=https://github.com/JaidedAI/EasyOCR/releases/download/pre-v1.1.6/chinese.zip
拉丁模型
https://pythondict.com/go/?url=https://github.com/JaidedAI/EasyOCR/releases/download/pre-v1.1.6/latin.zip
日本模型
https://pythondict.com/go/?url=https://github.com/JaidedAI/EasyOCR/releases/download/pre-v1.1.6/japanese.zip
韩文模型
https://pythondict.com/go/?url=https://github.com/JaidedAI/EasyOCR/releases/download/pre-v1.1.6/korean.zip
泰文模型
https://pythondict.com/go/?url=https://github.com/JaidedAI/EasyOCR/releases/download/pre-v1.1.6/thai.zip
阿拉伯文模型
https://pythondict.com/go/?url=https://github.com/JaidedAI/EasyOCR/releases/download/pre-v1.1.6/arabic.zip
下载完模型后,将文件放到下面这个位置。
Windows:C:\Users\用户名.EasyOCR\model
Linux:~/ .EasyOCR / model
需要额外下载EasyOCR库的中文数据集。