From e65ac910df934fa12e75895327db0b338491d698 Mon Sep 17 00:00:00 2001 From: liuruoze Date: Sun, 19 Mar 2017 10:44:14 +0800 Subject: [PATCH] * fix #172, #158 --- result/accuracy.txt | 10 +++++++ src/core/plate.cpp | 10 ------- src/core/plate_recognize.cpp | 2 -- src/util/kv.cpp | 52 +++++++++++++++++++----------------- 4 files changed, 38 insertions(+), 36 deletions(-) delete mode 100644 src/core/plate.cpp diff --git a/result/accuracy.txt b/result/accuracy.txt index a4a0f7f..5899ac6 100644 --- a/result/accuracy.txt +++ b/result/accuracy.txt @@ -2178,3 +2178,13 @@ Recall:84.2263%, Precise:70.6573%, Fscore:76.8474%. Recall:84.2263%, Precise:70.6573%, Fscore:76.8474%. 0-error:60.4%, 1-error:71.6%, Chinese-precise:73.2% 总时间:173秒, 平均执行时间:0.675781秒 +2017-03-18 08:20:48 +总图片数: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% +总时间:165秒, 平均执行时间:0.644531秒 +2017-03-19 08:42:59 +总图片数: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% +总时间:172秒, 平均执行时间:0.671875秒 diff --git a/src/core/plate.cpp b/src/core/plate.cpp deleted file mode 100644 index e5df68f..0000000 --- a/src/core/plate.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include "easypr/core/plate.h" - -/*! \namespace easypr -Namespace where all the C++ EasyPR functionality resides -*/ -namespace easypr { - -CPlate::CPlate() { bColored = true; } - -} /*! \namespace easypr*/ \ No newline at end of file diff --git a/src/core/plate_recognize.cpp b/src/core/plate_recognize.cpp index e625a40..b32cf57 100644 --- a/src/core/plate_recognize.cpp +++ b/src/core/plate_recognize.cpp @@ -217,9 +217,7 @@ int CPlateRecognize::plateRecognize(Mat src, std::vector &plateVecOut, i } int CPlateRecognize::plateRecognize(Mat src, std::vector &plateVecOut, int img_index) { - std::vector plateVec; - int resultPD = plateDetect(src, plateVec, img_index); if (resultPD == 0) { diff --git a/src/util/kv.cpp b/src/util/kv.cpp index dab6b53..84ee6c9 100644 --- a/src/util/kv.cpp +++ b/src/util/kv.cpp @@ -7,36 +7,40 @@ Kv::Kv() { } void Kv::load(const std::string &file) { this->clear(); - std::ifstream reader(file); - while (!reader.eof()) { - std::string line; - std::getline(reader, line); - if (line.empty()) continue; + assert(reader); + + if (reader.is_open()) { + while (!reader.eof()) { + std::string line; + std::getline(reader, line); + if (line.empty()) continue; - const auto parse = [](const std::string &str) { - std::string tmp, key, value; - for (size_t i = 0, len = str.length(); i < len; ++i) { - const char ch = str[i]; - if (ch == ' ') { - if (i > 0 && str[i - 1] != ' ' && key.empty()) { - key = tmp; - tmp.clear(); + const auto parse = [](const std::string &str) { + std::string tmp, key, value; + for (size_t i = 0, len = str.length(); i < len; ++i) { + const char ch = str[i]; + if (ch == ' ') { + if (i > 0 && str[i - 1] != ' ' && key.empty()) { + key = tmp; + tmp.clear(); + } + } + else { + tmp.push_back(ch); + } + if (i == len - 1) { + value = tmp; } - } else { - tmp.push_back(ch); - } - if (i == len - 1) { - value = tmp; } - } - return std::make_pair(key, value); - }; + return std::make_pair(key, value); + }; - auto kv = parse(line); - this->add(kv.first, kv.second); + auto kv = parse(line); + this->add(kv.first, kv.second); + } + reader.close(); } - reader.close(); } std::string Kv::get(const std::string &key) {