From d24ed44f833512d780e97e0bf5bd4c8c2a389813 Mon Sep 17 00:00:00 2001 From: Philippe Vaucher Date: Mon, 24 Mar 2014 10:45:14 +0100 Subject: [PATCH] Add empty lines where it makes sense --- src/openalpr/alpr.cpp | 5 +++++ src/openalpr/alpr_impl.cpp | 3 +++ src/openalpr/charactersegmenter.cpp | 1 + src/openalpr/config.cpp | 7 +++++++ src/openalpr/postprocess.cpp | 1 + src/openalpr/support/timing.cpp | 2 ++ src/openalpr/utility.cpp | 1 + 7 files changed, 20 insertions(+) diff --git a/src/openalpr/alpr.cpp b/src/openalpr/alpr.cpp index 59f4e8a..715c53f 100644 --- a/src/openalpr/alpr.cpp +++ b/src/openalpr/alpr.cpp @@ -26,10 +26,12 @@ Alpr::Alpr(const std::string country, const std::string runtimeDir) { impl = new AlprImpl(country, runtimeDir); } + Alpr::~Alpr() { delete impl; } + std::vector Alpr::recognize(std::string filepath) { cv::Mat img = cv::imread(filepath, CV_LOAD_IMAGE_COLOR); @@ -53,10 +55,12 @@ void Alpr::setDetectRegion(bool detectRegion) { impl->setDetectRegion(detectRegion); } + void Alpr::setTopN(int topN) { impl->setTopN(topN); } + void Alpr::setDefaultRegion(std::string region) { impl->setDefaultRegion(region); @@ -72,6 +76,7 @@ bool Alpr::isLoaded() AlprResult::AlprResult() { } + AlprResult::~AlprResult() { } diff --git a/src/openalpr/alpr_impl.cpp b/src/openalpr/alpr_impl.cpp index cfd69b2..ecc3e8c 100644 --- a/src/openalpr/alpr_impl.cpp +++ b/src/openalpr/alpr_impl.cpp @@ -58,6 +58,7 @@ AlprImpl::AlprImpl(const std::string country, const std::string runtimeDir) } } } + AlprImpl::~AlprImpl() { delete config; @@ -245,10 +246,12 @@ void AlprImpl::setDetectRegion(bool detectRegion) { this->detectRegion = detectRegion; } + void AlprImpl::setTopN(int topn) { this->topN = topn; } + void AlprImpl::setDefaultRegion(string region) { this->defaultRegion = region; diff --git a/src/openalpr/charactersegmenter.cpp b/src/openalpr/charactersegmenter.cpp index 3b68037..b3d41d9 100644 --- a/src/openalpr/charactersegmenter.cpp +++ b/src/openalpr/charactersegmenter.cpp @@ -697,6 +697,7 @@ void CharacterSegmenter::cleanMostlyFullBoxes(vector thresholds, const vect } } } + vector CharacterSegmenter::filterMostlyEmptyBoxes(vector thresholds, const vector charRegions) { // Of the n thresholded images, if box 3 (for example) is empty in half (for example) of the thresholded images, diff --git a/src/openalpr/config.cpp b/src/openalpr/config.cpp index f90e4fb..5fe2168 100644 --- a/src/openalpr/config.cpp +++ b/src/openalpr/config.cpp @@ -61,6 +61,7 @@ Config::Config(const std::string country, const std::string runtimeBaseDir) loadValues(country); } + Config::~Config() { delete ini; @@ -148,14 +149,17 @@ string Config::getCascadeRuntimeDir() { return this->runtimeBaseDir + CASCADE_DIR; } + string Config::getKeypointsRuntimeDir() { return this->runtimeBaseDir + KEYPOINTS_DIR; } + string Config::getPostProcessRuntimeDir() { return this->runtimeBaseDir + POSTPROCESS_DIR; } + string Config::getTessdataPrefix() { return "TESSDATA_PREFIX=" + this->runtimeBaseDir + "/ocr/"; @@ -173,6 +177,7 @@ float Config::getFloat(string section, string key, float defaultValue) float val = atof(pszValue); return val; } + int Config::getInt(string section, string key, int defaultValue) { const char * pszValue = ini->GetValue(section.c_str(), key.c_str(), NULL /*default*/); @@ -185,6 +190,7 @@ int Config::getInt(string section, string key, int defaultValue) int val = atoi(pszValue); return val; } + bool Config::getBoolean(string section, string key, bool defaultValue) { const char * pszValue = ini->GetValue(section.c_str(), key.c_str(), NULL /*default*/); @@ -197,6 +203,7 @@ bool Config::getBoolean(string section, string key, bool defaultValue) int val = atoi(pszValue); return val != 0; } + string Config::getString(string section, string key, string defaultValue) { const char * pszValue = ini->GetValue(section.c_str(), key.c_str(), NULL /*default*/); diff --git a/src/openalpr/postprocess.cpp b/src/openalpr/postprocess.cpp index 204c6e0..9b23b73 100644 --- a/src/openalpr/postprocess.cpp +++ b/src/openalpr/postprocess.cpp @@ -142,6 +142,7 @@ void PostProcess::clear() bestChars = ""; matchesTemplate = false; } + void PostProcess::analyze(string templateregion, int topn) { timespec startTime; diff --git a/src/openalpr/support/timing.cpp b/src/openalpr/support/timing.cpp index 7d5e2a1..4cc7442 100644 --- a/src/openalpr/support/timing.cpp +++ b/src/openalpr/support/timing.cpp @@ -72,6 +72,7 @@ void getTime(timespec* time) { clock_gettime(0, time); } + double diffclock(timespec time1,timespec time2) { timespec delta = diff(time1,time2); @@ -112,6 +113,7 @@ void getTime(timespec* time) clock_gettime(CLOCK_PROCESS_CPUTIME_ID, time); #endif } + double diffclock(timespec time1,timespec time2) { timespec delta = diff(time1,time2); diff --git a/src/openalpr/utility.cpp b/src/openalpr/utility.cpp index f3ec573..700f735 100644 --- a/src/openalpr/utility.cpp +++ b/src/openalpr/utility.cpp @@ -262,6 +262,7 @@ LineSegment::LineSegment(Point p1, Point p2) { init(p1.x, p1.y, p2.x, p2.y); } + LineSegment::LineSegment(int x1, int y1, int x2, int y2) { init(x1, y1, x2, y2);