* change the default locate method to mser add color.

v1.6alpha
liuruoze 9 years ago
parent 014d355278
commit a5ad51890a

@ -22,7 +22,11 @@ EasyPR是一个开源的中文车牌识别系统其目标是成为一个简
![高分辨率的图像](resources/doc/res/big_1.jpg)
2.更加合理的评价协议结合GroundTruth与ICDAR2003的协议使得整体评价指标更为合理。通用数据集里同时增加了近50张新图片。文字定位方法在面对这些复杂图片时比先前的SOBEL+COLOR的方法定位率提升了27个百分点。
2.更加合理的评价协议。结合新增的GroundTruth文件与ICDAR2003的协议使得整体评价指标更为合理。通用数据集里同时增加了近50张新图片。文字定位方法在面对这些复杂图片时比先前的SOBEL+COLOR的方法定位率提升了27个百分点。
实际运行时使用了文字定位与颜色定位的结合最终对256张的测试图片的测试结果如下
![v1.5版运行结果](resources/doc/res/v1.5_result.jpg)
3.使用了非极大值抑制算法去除相邻的车牌,使得最终输出变的合理。即便使用多个定位方法,最终也只会输出一个车牌,而且是可能性最大的车牌。
@ -38,11 +42,11 @@ EasyPR是一个开源的中文车牌识别系统其目标是成为一个简
6.增加了Grid Search方法可以进行自动调参。
7.首次增加了多线程支持基于OpenMP的文字定位方法在最终的识别效率上,比原先的单线程方法的速度提高了接近2倍。
7.首次增加了多线程支持基于OpenMP的文字定位方法在最终的识别速度上,比原先的单线程方法提高了接近2倍。
8.替换了一部分中文注释使得windows下的visual studio在面对全部以LF结尾的文件时也能成功通过编译。目前的程序只要opencv配置正确gitosc上通过zip下载下来可以直接通过编译并运行。
8.替换了一部分中文注释使得windows下的visual studio在面对全部以LF结尾的文件时也能成功通过编译。目前的程序只要opencv配置正确gitosc上通过zip下载下来的程序可以直接通过编译并运行。
其他还有不少改动,具体可以在代码中发现
关于本次改动的具体内容可以看博客中的介绍
### 跨平台
@ -87,7 +91,7 @@ EasyPR的调用非常简单下面是一段示例代码:
int result = pr.plateRecognize(src, plateVec);
```
首先创建一个CPlateRecognize对象pr接着我们设置pr的属性。
我们首先创建一个CPlateRecognize对象pr接着设置pr的属性。
```c++
pr.setResultShow(false);
@ -107,15 +111,13 @@ EasyPR的调用非常简单下面是一段示例代码:
pr.setDetectType(PR_DETECT_COLOR | PR_DETECT_SOBEL);
```
每个方法有其不同的特性新版本推荐使用文字定位方法CMSER
除此之外,还可以有一些其他的属性值设置:
```c++
pr.setLifemode(true);
```
设置开启生活模式这个属性在定位方法为SOBEL时可以发挥作用能增大搜索范围提高鲁棒性。
这句话设置开启生活模式这个属性在定位方法为SOBEL时可以发挥作用能增大搜索范围提高鲁棒性。
```c++
pr.setMaxPlates(4);
@ -123,7 +125,7 @@ EasyPR的调用非常简单下面是一段示例代码:
这句话设置EasyPR最多查找多少个车牌。当一副图中有大于n个车牌时EasyPR最终只会输出可能性最高的n个。
pr的主要方法为plateRecognize()这个方法有两个参数第一个代表输入图像第二个代表输出的车牌CPlate集合。
下面来看pr的方法。plateRecognize()这个方法有两个参数第一个代表输入图像第二个代表输出的车牌CPlate集合。
```c++
vector<CPlate> plateVec;
@ -133,9 +135,10 @@ pr的主要方法为plateRecognize(),这个方法有两个参数,第一个
当返回结果result为0时代表识别成功否则失败。
CPlate类包含了车牌的各种信息重要的如下
CPlate类包含了车牌的各种信息其中重要的如下:
```c++
CPlate plate = plateVec.at(i);
Mat plateMat = plate.getPlateMat();
RotatedRect rrect = plate.getPlatePos();
string license = plate.getPlateStr();

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<tagset>
<image>
<imageName>ÍîA2F560</imageName>
<taggedRectangles>
<taggedRectangle x="455" y="167" width="70" height="20" rotation="0" locateType="0">À¶ÅÆ:ÍîA2F560</taggedRectangle>
</taggedRectangles>
</image>
<image>
<imageName>ÍîA2F56D</imageName>
<taggedRectangles>
<taggedRectangle x="455" y="167" width="70" height="20" rotation="0" locateType="0">À¶ÅÆ:ÍîA2F560</taggedRectangle>
</taggedRectangles>
</image>
<image>
<imageName>ÍîAA3610</imageName>
<taggedRectangles>
<taggedRectangle x="279" y="446" width="39" height="141" rotation="-89" locateType="1">À¶ÅÆ:ÍîAA3610</taggedRectangle>
</taggedRectangles>
</image>
<image>
<imageName>ÍîAA361D</imageName>
<taggedRectangles>
<taggedRectangle x="279" y="446" width="39" height="141" rotation="-89" locateType="1">À¶ÅÆ:ÍîAA3610</taggedRectangle>
</taggedRectangles>
</image>
</tagset>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

File diff suppressed because it is too large Load Diff

@ -1923,3 +1923,88 @@ Recall:74.9149%, Precise:78.3019%, Fscore:76.5709%.
Recall:74.9149%, Precise:78.3019%, Fscore:76.5709%.
0-error:59.7345%, 1-error:68.5841%, Chinese-precise:71.6814%
总时间:95秒, 平均执行时间:0.371094秒
2016-07-05 15:47:40
总图片数:256, Plates count:297, 未定位车牌:29, 定位率:90.2357%
Recall:83.9013%, Precise:70.1227%, Fscore:76.3957%.
0-error:59.6%, 1-error:70.8%, Chinese-precise:72.4%
总时间:960秒, 平均执行时间:3.75秒
2016-07-05 15:51:32
总图片数:256, Plates count:297, 未定位车牌:35, 定位率:88.2155%
Recall:80.8165%, Precise:70.311%, Fscore:75.1986%.
0-error:59.2593%, 1-error:68.7243%, Chinese-precise:71.6049%
总时间:115秒, 平均执行时间:0.449219秒
2016-07-05 15:59:37
总图片数:256, Plates count:297, 未定位车牌:29, 定位率:90.2357%
Recall:83.9013%, Precise:70.1227%, Fscore:76.3957%.
0-error:59.6%, 1-error:70.8%, Chinese-precise:72.4%
总时间:114秒, 平均执行时间:0.445313秒
2016-07-05 16:25:53
总图片数:256, Plates count:297, 未定位车牌:31, 定位率:89.5623%
Recall:83.4717%, Precise:70.2438%, Fscore:76.2886%.
0-error:59.0361%, 1-error:70.2811%, Chinese-precise:71.8876%
总时间:111秒, 平均执行时间:0.433594秒
2016-07-05 16:27:45
总图片数:256, Plates count:297, 未定位车牌:31, 定位率:89.5623%
Recall:83.4717%, Precise:70.2438%, Fscore:76.2886%.
0-error:59.0361%, 1-error:70.2811%, Chinese-precise:71.8876%
总时间:112秒, 平均执行时间:0.4375秒
2016-07-05 16:29:37
总图片数:256, Plates count:297, 未定位车牌:31, 定位率:89.5623%
Recall:83.4717%, Precise:70.2438%, Fscore:76.2886%.
0-error:59.0361%, 1-error:70.2811%, Chinese-precise:71.8876%
总时间:112秒, 平均执行时间:0.4375秒
2016-07-05 16:31:29
总图片数:256, Plates count:297, 未定位车牌:31, 定位率:89.5623%
Recall:83.4717%, Precise:70.1707%, Fscore:76.2455%.
0-error:59.0361%, 1-error:70.2811%, Chinese-precise:71.8876%
总时间:112秒, 平均执行时间:0.4375秒
2016-07-05 16:33:21
总图片数:256, Plates count:297, 未定位车牌:30, 定位率:89.899%
Recall:83.6537%, Precise:70.1954%, Fscore:76.3359%.
0-error:59.2%, 1-error:70.4%, Chinese-precise:72%
总时间:112秒, 平均执行时间:0.4375秒
2016-07-05 16:35:13
总图片数:256, Plates count:297, 未定位车牌:29, 定位率:90.2357%
Recall:83.7973%, Precise:70.1223%, Fscore:76.3523%.
0-error:59.3625%, 1-error:70.5179%, Chinese-precise:72.1115%
总时间:112秒, 平均执行时间:0.4375秒
2016-07-05 16:37:05
总图片数:256, Plates count:297, 未定位车牌:29, 定位率:90.2357%
Recall:83.7973%, Precise:70.0622%, Fscore:76.3167%.
0-error:59.3625%, 1-error:70.5179%, Chinese-precise:72.1115%
总时间:112秒, 平均执行时间:0.4375秒
2016-07-05 16:38:59
总图片数:256, Plates count:297, 未定位车牌:29, 定位率:90.2357%
Recall:83.7973%, Precise:70.0622%, Fscore:76.3167%.
0-error:59.3625%, 1-error:70.5179%, Chinese-precise:72.1115%
总时间:114秒, 平均执行时间:0.445313秒
2016-07-05 16:40:58
总图片数:256, Plates count:297, 未定位车牌:29, 定位率:90.2357%
Recall:83.9013%, Precise:70.1227%, Fscore:76.3957%.
0-error:59.6%, 1-error:70.8%, Chinese-precise:72.4%
总时间:119秒, 平均执行时间:0.464844秒
2016-07-05 16:43:00
总图片数:256, Plates count:297, 未定位车牌:29, 定位率:90.2357%
Recall:83.9693%, Precise:70.1542%, Fscore:76.4426%.
0-error:60%, 1-error:71.2%, Chinese-precise:72.8%
总时间:122秒, 平均执行时间:0.476563秒
2016-07-05 16:45:00
总图片数:256, Plates count:297, 未定位车牌:29, 定位率:90.2357%
Recall:83.9693%, Precise:69.9983%, Fscore:76.3499%.
0-error:60%, 1-error:71.2%, Chinese-precise:72.8%
总时间:119秒, 平均执行时间:0.464844秒
2016-07-05 16:46:58
总图片数:256, Plates count:297, 未定位车牌:29, 定位率:90.2357%
Recall:84.0385%, Precise:70.1483%, Fscore:76.4677%.
0-error:60%, 1-error:71.2%, Chinese-precise:72.8%
总时间:118秒, 平均执行时间:0.460938秒
2016-07-05 16:49:09
总图片数:256, Plates count:297, 未定位车牌:29, 定位率:90.2357%
Recall:84.2263%, Precise:70.6573%, Fscore:76.8474%.
0-error:60.4%, 1-error:71.6%, Chinese-precise:73.2%
总时间:131秒, 平均执行时间:0.511719秒
2016-07-05 17:03:01
总图片数:256, Plates count:297, 未定位车牌:29, 定位率:90.2357%
Recall:84.2263%, Precise:70.6573%, Fscore:76.8474%.
0-error:60.4%, 1-error:71.6%, Chinese-precise:73.2%
总时间:114秒, 平均执行时间:0.445313秒

File diff suppressed because it is too large Load Diff

@ -28,20 +28,27 @@ namespace easypr {
std::vector<CPlate> all_result_Plates;
all_result_Plates.reserve(64);
#pragma omp parallel sections
{
#pragma omp section
{
if (!type || type & PR_DETECT_SOBEL) {
m_plateLocate->plateSobelLocate(src, sobel_Plates, img_index);
}
if (!type || type & PR_DETECT_COLOR) {
m_plateLocate->plateColorLocate(src, color_Plates, img_index);
}
#pragma omp section
{
if (!type || type & PR_DETECT_COLOR) {
m_plateLocate->plateColorLocate(src, color_Plates, img_index);
}
}
#pragma omp section
{
if (!type || type & PR_DETECT_CMSER) {
m_plateLocate->plateMserLocate(src, mser_Plates, img_index);
}
}
}
for (auto plate : sobel_Plates) {
plate.setPlateLocateType(SOBEL);
@ -92,34 +99,9 @@ namespace easypr {
for (int j = 0; j < 4; j++)
line(result, rect_points[j], rect_points[(j + 1) % 4], lineColor, 2, 8);
}
showResult(result, img_index);
}
/*if (0) {
Mat result = src.clone();
for (size_t i = 0; i < all_result_Plates.size(); i++) {
CPlate plate = all_result_Plates.at(i);
Rect_<float> outputRect;
calcSafeRect(plate.getPlatePos(), src, outputRect);
cv::rectangle(result, outputRect, Scalar(0, 0, 255));
if (0){
std::stringstream ss(std::stringstream::in | std::stringstream::out);
ss << "resources/image/tmp/plate_" << index << "_" << i << ".jpg";
imwrite(ss.str(), src(outputRect));
}
}
if (0) {
imshow("result", result);
waitKey(0);
destroyWindow("result");
}
}*/
return 0;
}

@ -1,6 +1,7 @@
#include "easypr/core/plate_judge.h"
#include "easypr/config.h"
#include "easypr/core/core_func.h"
#include "easypr/core/params.h"
namespace easypr {
@ -164,7 +165,8 @@ namespace easypr {
std::vector<CPlate> reDupPlateVec;
double overlap = 0.5;
double overlap = 0.7;
//double overlap = CParams::instance()->getParam1f();
NMS(plateVec, reDupPlateVec, overlap);
std::vector<CPlate>::iterator it = reDupPlateVec.begin();

@ -86,7 +86,7 @@ namespace easypr {
pr.setLifemode(true);
pr.setMaxPlates(max_plates);
//pr.setDetectType(PR_DETECT_COLOR | PR_DETECT_SOBEL);
pr.setDetectType(PR_DETECT_CMSER);
pr.setDetectType(PR_DETECT_CMSER | PR_DETECT_COLOR);
// load the maching learning model
pr.LoadSVM("resources/model/svm.xml");
@ -158,10 +158,10 @@ namespace easypr {
img_ss << kv->get("original_plate") << ":" << plateLicense << endl;
// remain
XMLNode xNode, rectangleNodes;
xNode = xMainNode.addChild("image");
xNode.addChild("imageName").addText(plateLicense.c_str());
rectangleNodes = xNode.addChild("taggedRectangles");
//XMLNode xNode, rectangleNodes;
//xNode = xMainNode.addChild("image");
//xNode.addChild("imageName").addText(plateLicense.c_str());
//rectangleNodes = xNode.addChild("taggedRectangles");
// get the ground truth and compare it with the detect list;
vector<CPlate> plateVecGT;
@ -269,18 +269,18 @@ namespace easypr {
calcSafeRect(platePos_d, src, plateRect_d);
// remain
XMLNode rectangleNode = rectangleNodes.addChild("taggedRectangle");
RotatedRect rr = platePos_d;
LocateType locateType = plate_d.getPlateLocateType();
//XMLNode rectangleNode = rectangleNodes.addChild("taggedRectangle");
//RotatedRect rr = platePos_d;
//LocateType locateType = plate_d.getPlateLocateType();
rectangleNode.addAttribute("x", to_string((int)rr.center.x).c_str());
rectangleNode.addAttribute("y", to_string((int)rr.center.y).c_str());
rectangleNode.addAttribute("width", to_string((int)rr.size.width).c_str());
rectangleNode.addAttribute("height", to_string((int)rr.size.height).c_str());
//rectangleNode.addAttribute("x", to_string((int)rr.center.x).c_str());
//rectangleNode.addAttribute("y", to_string((int)rr.center.y).c_str());
//rectangleNode.addAttribute("width", to_string((int)rr.size.width).c_str());
//rectangleNode.addAttribute("height", to_string((int)rr.size.height).c_str());
rectangleNode.addAttribute("rotation", to_string((int)rr.angle).c_str());
rectangleNode.addAttribute("locateType", to_string(locateType).c_str());
rectangleNode.addText(plate_d.getPlateStr().c_str());
//rectangleNode.addAttribute("rotation", to_string((int)rr.angle).c_str());
//rectangleNode.addAttribute("locateType", to_string(locateType).c_str());
//rectangleNode.addText(plate_d.getPlateStr().c_str());
for (auto plate_g : plateVecGT) {
RotatedRect platePos_g = plate_g.getPlatePos();
@ -348,7 +348,7 @@ namespace easypr {
time(&end);
// the xml detection result
xMainNode.writeToFile(path_result.c_str());
//xMainNode.writeToFile(path_result.c_str());
cout << "------------------" << endl;
cout << "Easypr accuracy test end!" << endl;
@ -471,8 +471,8 @@ namespace easypr {
int i1[] = { 900, 1000, 1100, 1200 };
int i1_c = 4;
float f1[] = { 0.3f, 0.4f, 0.5f, 0.6f };
int f1_c = 4;
float f1[] = { 0.1f, 0.15f, 0.2f, 0.25f, 0.3f, 0.35f, 0.4f, 0.45f, 0.5f, 0.55f, 0.6f, 0.65f, 0.7f };
int f1_c = 13;
float f2[] = { 0.2f, 0.25f, 0.3f, 0.35f };
int f2_c = 4;
@ -481,6 +481,17 @@ namespace easypr {
int f3_c = 4;
Config config;
config.setParam1f(f1, f1_c);
for (size_t idx1 = 0; idx1 < config.getParam1f().size(); idx1++) {
float f1 = config.getParam1f().at(idx1);
CParams::instance()->setParam1f(f1);
Result result;
accuracyTest(test_path, result, true);
result.getParams().setParam1f(f1);
all_results.push_back(result);
}
/*Config config;
config.setParam1i(i1, i1_c);
config.setParam1f(f1, f1_c);
config.setParam2f(f2, f2_c);
@ -515,7 +526,7 @@ namespace easypr {
}
}
}
}
}*/
std::sort(all_results.begin(), all_results.end(),
[](const Result& r1, const Result& r2) {

Loading…
Cancel
Save