-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathplate.cpp
More file actions
66 lines (60 loc) · 1.81 KB
/
Copy pathplate.cpp
File metadata and controls
66 lines (60 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include "Pipeline.h"
#include <time.h>
#include <string.h>
using namespace std;
void TEST_PIPELINE(char* path){//车牌识别
pr::PipelinePR *prc;
prc =new pr::PipelinePR("../model/yolov3_Plate.engine",
"../model/HorizonalFinemapping.prototxt","../model/HorizonalFinemapping.caffemodel",
"../model/SegmentationFree.engine"
);
cv::Mat image = cv::imread(path);
std::vector<pr::PlateInfo> res;
res = prc->RunPiplineAsImage(image);
for(auto st:res) {
if(st.confidence>0.70) {
std::cout<<"车牌号:"<< st.getPlateName()<<endl;
std::cout<<"置信度:"<< st.getConfidence() <<endl;
cout<<"各字符置信度:"<<endl;
for(int count=0; count<st.length;count++){
cout<<st.nameList[count]<<':';
cout<<st.confList[count]<<'\n';
}
cout<<endl;
}
}
}
void build_detection_engine()
{
pr::PlateDetection *pp=new pr::PlateDetection("../model/yoloout.prototxt","../model/yoloout.caffemodel","../model/yolov3_Plate.engine");
}
void build_ocr_engine()
{
pr::SegmentationFreeRecognizer *ocr=new pr::SegmentationFreeRecognizer("../model/SegmentationFree.prototxt","../model/SegmentationFree.caffemodel","../model/SegmentationFree.engine");
}
int main(int argc, char** argv)
{
if(argc==2)
{
char mode[3];
strcpy(mode , argv[1]);
if(mode[0]=='0')
{
cout<<"构建车牌检测engine"<<endl;
build_detection_engine();
}
else
{
cout<<"构建车牌识别engine"<<endl;
build_ocr_engine();
}
}
else
{
char path[80];
cout<<"部署环境并测试"<<endl;
strcpy(path , argv[2]);
TEST_PIPELINE(path);
}
return 0 ;
}