目录

一:EasyPR开源库 ubuntu下配置

二:车牌识别UI绘制

三:车牌识别代码实现

四:车牌识别成果展示


一:EasyPR开源库 ubuntu下配置

1.确定好工程路径

如/root/Qt_workspace/omo220315_001

2.将/opt/EasyPR/model 的 model文件夹 拷贝到 上述的Qt工程目录下

3.修改Qt pro

注意点:需要加 \ 再加配置文件

   /opt/EasyPR/src/core/chars_identify.cpp \/opt/EasyPR/src/core/chars_recognise.cpp \/opt/EasyPR/src/core/chars_segment.cpp \/opt/EasyPR/src/core/core_func.cpp \/opt/EasyPR/src/core/feature.cpp \/opt/EasyPR/src/core/params.cpp \/opt/EasyPR/src/core/plate_detect.cpp \/opt/EasyPR/src/core/plate_judge.cpp \/opt/EasyPR/src/core/plate_locate.cpp \/opt/EasyPR/src/core/plate_recognize.cpp \/opt/EasyPR/src/train/ann_train.cpp \/opt/EasyPR/src/train/annCh_train.cpp \/opt/EasyPR/src/train/create_data.cpp \/opt/EasyPR/src/train/svm_train.cpp \/opt/EasyPR/src/train/train.cpp \/opt/EasyPR/src/util/kv.cpp \/opt/EasyPR/src/util/program_options.cpp \/opt/EasyPR/src/util/util.cpp \/opt/EasyPR/thirdparty/LBP/helper.cpp \/opt/EasyPR/thirdparty/LBP/lbp.cpp \/opt/EasyPR/thirdparty/mser/mser2.cpp \/opt/EasyPR/thirdparty/svm/corrected_svm.cpp \/opt/EasyPR/thirdparty/textDetect/erfilter.cpp \/opt/EasyPR/thirdparty/xmlParser/xmlParser.cpp/opt/EasyPR/include/easypr/core/character.hpp \/opt/EasyPR/include/easypr/core/chars_identify.h \/opt/EasyPR/include/easypr/core/chars_recognise.h \/opt/EasyPR/include/easypr/core/chars_segment.h \/opt/EasyPR/include/easypr/core/core_func.h \/opt/EasyPR/include/easypr/core/feature.h \/opt/EasyPR/include/easypr/core/params.h \/opt/EasyPR/include/easypr/core/plate.hpp \/opt/EasyPR/include/easypr/core/plate_detect.h \/opt/EasyPR/include/easypr/core/plate_judge.h \/opt/EasyPR/include/easypr/core/plate_locate.h \/opt/EasyPR/include/easypr/core/plate_recognize.h \/opt/EasyPR/include/easypr/train/ann_train.h \/opt/EasyPR/include/easypr/train/annCh_train.h \/opt/EasyPR/include/easypr/train/create_data.h \/opt/EasyPR/include/easypr/train/svm_train.h \/opt/EasyPR/include/easypr/train/train.h \/opt/EasyPR/include/easypr/util/kv.h \/opt/EasyPR/include/easypr/util/program_options.h \/opt/EasyPR/include/easypr/util/switch.hpp \/opt/EasyPR/include/easypr/util/util.h \/opt/EasyPR/include/easypr/api.hpp \/opt/EasyPR/include/easypr/config.h \/opt/EasyPR/include/easypr/version.h \/opt/EasyPR/include/easypr.h \/opt/EasyPR/test/accuracy.hpp \/opt/EasyPR/test/chars.hpp \/opt/EasyPR/test/config.hpp \/opt/EasyPR/test/plate.hpp \/opt/EasyPR/test/result.hpp \/opt/EasyPR/thirdparty/LBP/helper.hpp \/opt/EasyPR/thirdparty/LBP/lbp.hpp \/opt/EasyPR/thirdparty/mser/mser2.hpp \/opt/EasyPR/thirdparty/svm/precomp.hpp \/opt/EasyPR/thirdparty/textDetect/erfilter.hpp \/opt/EasyPR/thirdparty/xmlParser/xmlParser.hINCLUDEPATH +=/usr/local/include/
LIBS+=/usr/local/lib/libopencv_world.soINCLUDEPATH += /opt/EasyPR/include/DISTFILES += \model/ann_chinese.xml \model/ann.xml \model/annCh.xml \model/svm_hist.xml

此时点击生成,可能还会有报错,在thirdparty前 加上 ../即可 ,一个一个慢慢加,大概有4处

运行一下工程,有窗口运行,就代表配置成功

当然,你看到了 如下  /opt/EasyPR 和 Other files生成 ,也代表你配置成功了

二:车牌识别UI绘制

三:车牌识别代码实现

类PlayerVideoThread

#ifndef PLAYERVIDEOTHREAD_H
#define PLAYERVIDEOTHREAD_H
#include <QDebug>
#include <QThread>
#include <opencv2/opencv.hpp>using namespace cv;class PlayerVideoThread : public QThread
{Q_OBJECT
public:PlayerVideoThread(char *videopath);void run();
private:VideoCapture cap;Mat frame;
signals:void frameVideo(Mat frame);
};#endif // PLAYERVIDEOTHREAD_H
#include "playervideothread.h"PlayerVideoThread::PlayerVideoThread(char *videopath):QThread ()
{if(cap.open(videopath)){qDebug()<<"open video success";}}
void PlayerVideoThread::run()
{while(cap.read(frame)){emit frameVideo(frame);msleep(40);}}

类 widget

#ifndef WIDGET_H
#define WIDGET_H#include <QWidget>
#include <QDebug>
#include <easypr.h>
#include <opencv2/opencv.hpp>
#include "playervideothread.h"using namespace easypr;
using namespace cv;namespace Ui {
class Widget;
}class Widget : public QWidget
{Q_OBJECTpublic:explicit Widget(QWidget *parent = nullptr);~Widget();private slots:void on_pushButton_clicked();void on_pushButton_2_clicked();private:Ui::Widget *ui;CPlateRecognize pr;VideoCapture cap;vector<CPlate> plateVec;Mat frame;CPlate plate;Mat plateMat;PlayerVideoThread *playerVideoThread;
protected:void paintEvent(QPaintEvent *e);
public slots:void updateImage(Mat img);};#endif // WIDGET_H
#include "widget.h"
#include "ui_widget.h"Widget::Widget(QWidget *parent) :QWidget(parent),ui(new Ui::Widget)
{ui->setupUi(this);pr.setDetectType(PR_DETECT_CMSER|PR_DETECT_COLOR);pr.setMaxPlates(4);pr.setResultShow(false);
}Widget::~Widget()
{delete ui;
}void Widget::on_pushButton_clicked()
{this->playerVideoThread = new PlayerVideoThread ("./video/car_input.mp4");connect(this->playerVideoThread,SIGNAL(frameVideo(Mat)),this,SLOT(updateImage(Mat)),Qt::BlockingQueuedConnection);this->playerVideoThread->start();
}void Widget::on_pushButton_2_clicked()
{Mat car_number;int result = pr.plateRecognize(this->frame,plateVec);qDebug()<<"result ="<<result;if(result == 0){plate = plateVec.at(0); //car infoplateMat = plate.getPlateMat(); //car number infocvtColor(plateMat,car_number,CV_BGR2RGB);cvtColor(car_number,car_number,CV_BGR2RGB);QImage q_image = QImage(car_number.data,car_number.cols,car_number.rows,QImage::Format_RGB888);ui->label_2->setPixmap(QPixmap::fromImage(q_image));ui->label_2->setScaledContents(true);string str_car_num = plateVec[0].getPlateStr();QString q_str = QString::fromLocal8Bit(str_car_num.c_str());ui->lineEdit->clear();ui->lineEdit->insert(q_str);}plateVec.clear();}void Widget::paintEvent(QPaintEvent *e)
{QImage q_image = QImage(frame.data,frame.cols,frame.rows,QImage::Format_RGB888);ui->label->setPixmap(QPixmap::fromImage(q_image));ui->label->setScaledContents(true);
}void Widget::updateImage(Mat img)
{this->frame = img.clone();cvtColor(frame,frame,CV_BGR2RGB);this->update();
}

主入口测试

#include "widget.h"
#include <QApplication>
#include <easypr.h>using namespace easypr;int main(int argc, char *argv[])
{QApplication a(argc, argv);Widget w;w.show();return a.exec();
}

四:车牌识别成果展示

当车牌靠近缓冲带时候,点击carnum 即可车牌识别

【OpenCV】 车牌识别检测相关推荐

  1. 【功能超全】基于OpenCV车牌识别停车场管理系统软件开发【含python源码+PyqtUI界面+功能详解】-车牌识别python 深度学习实战项目

    车牌识别基础功能演示 摘要:车牌识别系统(Vehicle License Plate Recognition,VLPR) 是指能够检测到受监控路面的车辆并自动提取车辆牌照信息(含汉字字符.英文字母.阿 ...

  2. C++中文车牌识别检测系统源码

    下载地址:C++中文车牌识别检测系统源码 其目标是成为一个简单.高效.准确的非限制场景(unconstrained situation)下的车牌识别库. 相比于其他的车牌识别系统,EasyPR有如下特 ...

  3. opencv车牌识别入门资料汇总

    使用OpenCV和C++实现的车牌识别系统. http://download.csdn.net/detail/u014743238/7204477 使用VC++6.0做开发工具, 采用简单的SDI框架 ...

  4. matlab车牌识别 复杂环境,基于MATLAB复杂背景车牌识别检测系统

    基于MATLAB复杂背景车牌识别检测系统 1.选题目的和意义 在复杂背景车牌识别检测系统中,由于拍摄时的光照条件.牌照的整洁程度的影响,和摄像机的焦距调整.镜头的光学畸变所产生的噪声都会不同程度地造成 ...

  5. PyTorch + openCV 车牌识别(一)

    PyTorch + openCV 车牌识别(一) 注意 利用cv识别车牌并切割字符 注意 本项目仅是初学者学习pytorch过程中随手写的,有些地方不够严谨请谅解,仅供参考 利用cv识别车牌并切割字符 ...

  6. OpenCV视频识别检测人数跟踪统计

    Python+OpenCV视频识别检测人数跟踪统计 如需远程调试,可加QQ905733049由专业技术人员远程协助! 运行代码如下: import numpy as np import cv2 imp ...

  7. spring boot + maven + opencv 车牌识别系统,包含车牌检测、车牌号识别训练

    yx-image-recognition 介绍 这是一个基于spring boot + maven + opencv 实现的图像识别及训练的Demo项目 包含车牌识别.人脸识别等功能,贯穿样本处理.模 ...

  8. c# opencv车牌识别_毕设有着落了!一套开源的,基于SpringBoot的车牌识别系统

    阅读本文大概需要 4 分钟. 前言 这个项目是良月柒在逛社区时发现的,刚看到它,思绪直接被拉回了几年前,当初有同学的毕设就是停车场管理系统,关键的功能--车牌识别,连硬件都整上了,一整套流程跑下来,p ...

  9. pp-vehicle车牌识别检测代码

    车牌识别实例化 1.在官网拉取最新代码,并创建检测py文件,并引入相应的库 import os,cv2,time import numpy as np import argparse from dep ...

  10. Python 基于 opencv 车牌识别系统的研究与实现

    源码下载地址:https://download.csdn.net/download/gdutxiaoxu/87419195 原理简介 车牌字符识别使用的算法是opencv的SVM opencv的SVM ...

最新文章

  1. Redis的文件格式
  2. mysql设置Tooken过期时间_基于thinkPHP3.2实现微信接入及查询token值的方法
  3. boost::static_pointer_cast相关的测试程序
  4. 音视频技术开发周刊 64期
  5. Python弹窗提示警告框MessageBox
  6. 如何明智的使用计算机,幼儿园如何正确使用计算机
  7. python机器学习库sklearn——朴素贝叶斯分类器
  8. html5 字段换行,关于换行以及换行属性
  9. Spark入门到精通
  10. IBM Cloud 2015 - CDN
  11. Codeblock 美化字体和主题
  12. 论文阅读《Characterizing BDS signal-in-space performance from integrity perspective》3
  13. 小福利,用selenium模块爬取qq音乐歌单
  14. 阿里云上创建Oracle RAC-静默模式
  15. SAP 04-CONTAINER 使用DOCKING停靠容器示例
  16. blast中evalue和bitscore的理解
  17. 自动设计引物的Python小程序
  18. Python小白的数学建模课-B6. 新冠疫情 SEIR 改进模型
  19. ctf 抓捕赵德汉_《人民的名义》抓捕现实版:民警冒雨蹲守一夜只为他!
  20. 重走长征路---OI每周刷题记录---9月6日 2014

热门文章

  1. 从零开始学编程系列汇总
  2. 使用idea把Svn分支合并到主干上
  3. php后台登录验证(含验证码)
  4. 【设计原则】软件开发中的原则
  5. Vue SSR服务端渲染 vue预渲染
  6. CPDA|数据分析师成长之路如何起步?
  7. Activiti6驳回上一节点
  8. 最全面试题CSS(含答案)
  9. stm32-sbus数据接收,并通过CAN转发给车辆控制
  10. 卸下重负,苏宁易购重组价值逻辑