From d57d6020d12e9332af96e08ed8e061ffb57300e7 Mon Sep 17 00:00:00 2001 From: Micooz Date: Wed, 22 Apr 2015 16:29:31 +0800 Subject: [PATCH 1/3] Fixed: compile error "non-const lvalue reference to type 'cv::Mat' cannot bind to a temporary of type 'cv::Mat'". --- CMakeLists.txt | 2 +- src/core/plate_locate.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a4253f..ea0f96a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.8) project (EasyPR) -list(APPEND CMAKE_CXX_FLAGS "-std=c++0x") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") find_package(OpenCV REQUIRED) diff --git a/src/core/plate_locate.cpp b/src/core/plate_locate.cpp index ddd8602..3bf12be 100644 --- a/src/core/plate_locate.cpp +++ b/src/core/plate_locate.cpp @@ -1583,8 +1583,9 @@ int CPlateLocate::plateLocate(Mat src, vector& resultVec, int index) //large the rect for more if (!verifySizes(mr)) { - cv::Mat& roi = dst_blue(safeBoundRect); + cv::Mat roi = dst_blue(safeBoundRect); roi.setTo(0); + cv::swap(roi, dst_blue); } else { @@ -1637,8 +1638,9 @@ int CPlateLocate::plateLocate(Mat src, vector& resultVec, int index) //large the rect for more if (!verifySizes(mr)) { - cv::Mat& roi = dst_yellow(safeBoundRect); + cv::Mat roi = dst_yellow(safeBoundRect); roi.setTo(0); + cv::swap(roi, dst_yellow); } else { From f03ac2bb4393b878d9544f7e5dea25e56eeb3ad0 Mon Sep 17 00:00:00 2001 From: Micooz Date: Wed, 22 Apr 2015 16:34:40 +0800 Subject: [PATCH 2/3] Fixed: warnings "deprecated conversion from string constant to 'char*' [-Wwrite-strings]" generated by g++. --- src/util/learn_prepare.cpp | 6 +++--- src/util/mc_data_prepare.cpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util/learn_prepare.cpp b/src/util/learn_prepare.cpp index 077b3f8..92e36fa 100644 --- a/src/util/learn_prepare.cpp +++ b/src/util/learn_prepare.cpp @@ -16,9 +16,9 @@ using namespace easypr; //! 将以下路径改成你的位置 -char * notlabelPath = "F:/data/easypr-data/notlabel"; -char * hasPaltePath = "F:/data/easypr-data/learn/hasPlate/"; -char * noPlatePath = "F:/data/easypr-data/learn/noPlate/"; +const char * notlabelPath = "F:/data/easypr-data/notlabel"; +const char * hasPaltePath = "F:/data/easypr-data/learn/hasPlate/"; +const char * noPlatePath = "F:/data/easypr-data/learn/noPlate/"; //! 读取not label data,生成learn data void label_data() diff --git a/src/util/mc_data_prepare.cpp b/src/util/mc_data_prepare.cpp index fe8a134..86ba1e0 100644 --- a/src/util/mc_data_prepare.cpp +++ b/src/util/mc_data_prepare.cpp @@ -242,7 +242,7 @@ void getLearnData() void changeFileName() { //char * filePath = "F:/data/easypr-data/learndata"; - char * filePath = "F:/data/PlateLocate/pic1"; + const char * filePath = "F:/data/PlateLocate/pic1"; ////获取该路径下的所有文件 auto files = Utils::getFiles(filePath); From a66f01f7880c4f3a40adca898bfcb066a39b18d4 Mon Sep 17 00:00:00 2001 From: liuruoze Date: Wed, 22 Apr 2015 17:47:12 +0800 Subject: [PATCH 3/3] a little change --- run_accuracy.txt | 4 ++++ src/core/plate_detect.cpp | 1 + src/test/test.cpp | 9 +++++---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/run_accuracy.txt b/run_accuracy.txt index bd7ae70..9a07921 100644 --- a/run_accuracy.txt +++ b/run_accuracy.txt @@ -925,3 +925,7 @@ 总图片数:120张, 未识出图片:1张, 定位率:99.1667% 平均字符差距:0.714286个, 完全匹配数:81张, 完全匹配率:68.0672% 总时间:243秒, 平均执行时间:2.025秒 +2015-04-22 17:39:09 +总图片数:120张, 未识出图片:1张, 定位率:99.1667% +平均字符差距:0.714286个, 完全匹配数:81张, 完全匹配率:68.0672% +总时间:251秒, 平均执行时间:2.09167秒 diff --git a/src/core/plate_detect.cpp b/src/core/plate_detect.cpp index dc36a25..d38b8ff 100644 --- a/src/core/plate_detect.cpp +++ b/src/core/plate_detect.cpp @@ -108,6 +108,7 @@ int CPlateDetect::plateDetectDeep(Mat src, vector& resultVec, bool showD CPlate plate = all_result_Plates[i]; resultVec.push_back(plate); } + return 0; } diff --git a/src/test/test.cpp b/src/test/test.cpp index a19911d..0ad67b0 100644 --- a/src/test/test.cpp +++ b/src/test/test.cpp @@ -275,18 +275,19 @@ int test_plate_detect() Mat src = imread("image/plate_detect.jpg"); - vector resultVec; + vector resultVec; CPlateDetect pd; pd.setPDLifemode(true); - int result = pd.plateDetect(src, resultVec); + int result = pd.plateDetectDeep(src, resultVec); if (result == 0) { int num = resultVec.size(); for (int j = 0; j < num; j++) { - Mat resultMat = resultVec[j]; - imshow("plate_detect", resultMat); + CPlate resultMat = resultVec[j]; + + imshow("plate_detect", resultMat.getPlateMat()); waitKey(0); } destroyWindow("plate_detect");