项目使用PyQt5接口百度AI文字识别服务,使用SQLite为数据库引擎,开发实现普通文字识别、身份证识别、银行卡识别、驾驶证识别、行驶证识别和车牌识别的集成系统,百度AI的文字识别还有很多别的功能,可以根据个体不同需要调入。
Github地址:https://github.com/shanghaixuhuan/myOCR
系统的识别历史窗口直接模仿了我的大神朋友的博客。https://blog.csdn.net/weixin_38312031/article/details/80145652
界面效果如图,能够实现对识别历史的查看和根据不同属性进行模糊查询。
数据库设计如下,除了身份证是正反面两张图的,其他都是识别一张图的,比较雷同,所以就建立在同一张表上了。
另外详细信息可以查看识别的图片,具体信息和识别结果。
窗口代码如下:
import sys
from PyQt5.QtWidgets import (QWidget, QApplication, QVBoxLayout, QHBoxLayout,
QLineEdit, QPushButton, QComboBox, QLabel, QMessageBox,
QTableView, QAbstractItemView, QDialog)
from PyQt5.QtGui import QIcon, QFont
from PyQt5.QtCore import Qt
from PyQt5.QtSql import QSqlDatabase, QSqlQueryModel
import qdarkstyle
from RecordDetail import RecordDetailDialog
from RecordDetail_id import RecordDetailDialog_id
class RecordsViewer(QDialog):
def __init__(self):
super(RecordsViewer, self).__init__()
self.resize(800, 500)
self.setWindowTitle('myOCR——我的识别历史')
self.setWindowIcon(QIcon('./images/icon.png'))
self.queryModel = None
self.tableView = None
self.currentPage = 0
self.totalPage = 0
self.totalRecord = 0
self.pageRecord = 10
self.initUI()
def initUI(self):
self.vbox = QVBoxLayout()
self.h1box = QHBoxLayout()
self.h2box = QHBoxLayout()
self.searchEdit = QLineEdit()
self.searchEdit.setFixedHeight(32)
self.searchEdit.setFont(QFont("苏新诗柳楷繁", 15))
self.searchButton = QPushButton("查询")
self.searchButton.setFixedHeight(32)
self.searchButton.setFont(QFont("苏新诗柳楷繁", 15))
self.condisionComboBox = QComboBox()
searchCondision = ['按识别编号查询', '按识别时间查询', '按识别类型查询',
'按识别文字查询']
self.condisionComboBox.setFixedHeight(32)
self.condisionComboBox.setFont(QFont("苏新诗柳楷繁", 15))
self.condisionComboBox.addItems(searchCondision)
self.h1box.addWidget(self.searchEdit)
self.h1box.addWidget(self.condisionComboBox)
self.h1box.addWidget(self.searchButton)
self.jumpToLabel = QLabel(self)
self.jumpToLabel.setText("跳转到第")
self.jumpToLabel.setFont(QFont("苏新诗柳楷繁", 12))
self.jumpToLabel.setFixedWidth(90)
self.pageEdit = QLineEdit()
self.pageEdit.setFixedWidth(30)
self.pageEdit.setFont(QFont("苏新诗柳楷繁", 12))
s = "/" + str(self.totalPage) + "页"
self.pageLabel = QLabel(s)
self.pageLabel.setFont(QFont("苏新诗柳楷繁", 12))
self.pageLabel.setFixedWidth(40)
self.jumpToButton = QPushButton(sel