From 6dc1e6db8975b724c2c7b32975fd6c3e765cb187 Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Wed, 18 Jun 2014 17:52:18 -0400 Subject: [PATCH] Removed "using" statements from ocr.h --- src/openalpr/alpr.cpp | 4 ++-- src/openalpr/alpr_impl.cpp | 3 +++ src/openalpr/alpr_impl.h | 16 +++++++++------- src/openalpr/ocr.cpp | 4 ++++ src/openalpr/ocr.h | 7 ++----- 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/openalpr/alpr.cpp b/src/openalpr/alpr.cpp index 42a4aca..cc31091 100644 --- a/src/openalpr/alpr.cpp +++ b/src/openalpr/alpr.cpp @@ -41,12 +41,12 @@ std::vector Alpr::recognize(std::string filepath) std::vector Alpr::recognize(std::vector imageBuffer) { // Not sure if this actually works - cv::Mat img = cv::imdecode(Mat(imageBuffer), 1); + cv::Mat img = cv::imdecode(cv::Mat(imageBuffer), 1); return impl->recognize(img); } -string Alpr::toJson(const vector< AlprResult > results, double processing_time_ms) +std::string Alpr::toJson(const std::vector< AlprResult > results, double processing_time_ms) { return impl->toJson(results, processing_time_ms); } diff --git a/src/openalpr/alpr_impl.cpp b/src/openalpr/alpr_impl.cpp index e67a9db..3e1884f 100644 --- a/src/openalpr/alpr_impl.cpp +++ b/src/openalpr/alpr_impl.cpp @@ -21,6 +21,9 @@ void plateAnalysisThread(void* arg); +using namespace std; +using namespace cv; + AlprImpl::AlprImpl(const std::string country, const std::string configFile, const std::string runtimeDir) { config = new Config(country, configFile, runtimeDir); diff --git a/src/openalpr/alpr_impl.h b/src/openalpr/alpr_impl.h index 9adefba..4d8d02c 100644 --- a/src/openalpr/alpr_impl.h +++ b/src/openalpr/alpr_impl.h @@ -47,6 +47,8 @@ #define ALPR_NULL_PTR 0 + + class AlprImpl { @@ -60,9 +62,9 @@ class AlprImpl void setDetectRegion(bool detectRegion); void setTopN(int topn); - void setDefaultRegion(string region); + void setDefaultRegion(std::string region); - std::string toJson(const vector results, double processing_time_ms = -1); + std::string toJson(const std::vector results, double processing_time_ms = -1); static std::string getVersion(); Config* config; @@ -85,7 +87,7 @@ class AlprImpl class PlateDispatcher { public: - PlateDispatcher(vector plateRegions, cv::Mat* image, + PlateDispatcher(std::vector plateRegions, cv::Mat* image, Config* config, StateIdentifier* stateIdentifier, OCR* ocr, @@ -106,7 +108,7 @@ class PlateDispatcher { tthread::lock_guard guard(mMutex); - Mat img(this->frame->size(), this->frame->type()); + cv::Mat img(this->frame->size(), this->frame->type()); this->frame->copyTo(img); return img; @@ -139,7 +141,7 @@ class PlateDispatcher recognitionResults.push_back(recognitionResult); } - vector getRecognitionResults() + std::vector getRecognitionResults() { return recognitionResults; } @@ -159,8 +161,8 @@ class PlateDispatcher tthread::mutex mMutex; cv::Mat* frame; - vector plateRegions; - vector recognitionResults; + std::vector plateRegions; + std::vector recognitionResults; }; diff --git a/src/openalpr/ocr.cpp b/src/openalpr/ocr.cpp index 6a95596..5e43e0d 100644 --- a/src/openalpr/ocr.cpp +++ b/src/openalpr/ocr.cpp @@ -19,6 +19,10 @@ #include "ocr.h" +using namespace std; +using namespace cv; +using namespace tesseract; + OCR::OCR(Config* config) { const string EXPECTED_TESSERACT_VERSION = "3.03"; diff --git a/src/openalpr/ocr.h b/src/openalpr/ocr.h index 0ca3de1..0c9c080 100644 --- a/src/openalpr/ocr.h +++ b/src/openalpr/ocr.h @@ -31,9 +31,6 @@ #include "opencv2/imgproc/imgproc.hpp" #include "tesseract/baseapi.h" -using namespace tesseract; -using namespace std; -using namespace cv; class OCR { @@ -42,7 +39,7 @@ class OCR OCR(Config* config); virtual ~OCR(); - void performOCR(vector thresholds, vector charRegions); + void performOCR(std::vector thresholds, std::vector charRegions); PostProcess* postProcessor; //string recognizedText; @@ -52,7 +49,7 @@ class OCR private: Config* config; - TessBaseAPI *tesseract; + tesseract::TessBaseAPI *tesseract; };