Removed "using" statements from ocr.h

This commit is contained in:
Matt Hill
2014-06-18 17:52:18 -04:00
parent 409011caee
commit 6dc1e6db89
5 changed files with 20 additions and 14 deletions

View File

@@ -41,12 +41,12 @@ std::vector<AlprResult> Alpr::recognize(std::string filepath)
std::vector<AlprResult> Alpr::recognize(std::vector<unsigned char> 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);
}

View File

@@ -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);

View File

@@ -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<AlprResult> results, double processing_time_ms = -1);
std::string toJson(const std::vector<AlprResult> results, double processing_time_ms = -1);
static std::string getVersion();
Config* config;
@@ -85,7 +87,7 @@ class AlprImpl
class PlateDispatcher
{
public:
PlateDispatcher(vector<PlateRegion> plateRegions, cv::Mat* image,
PlateDispatcher(std::vector<PlateRegion> plateRegions, cv::Mat* image,
Config* config,
StateIdentifier* stateIdentifier,
OCR* ocr,
@@ -106,7 +108,7 @@ class PlateDispatcher
{
tthread::lock_guard<tthread::mutex> 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<AlprResult> getRecognitionResults()
std::vector<AlprResult> getRecognitionResults()
{
return recognitionResults;
}
@@ -159,8 +161,8 @@ class PlateDispatcher
tthread::mutex mMutex;
cv::Mat* frame;
vector<PlateRegion> plateRegions;
vector<AlprResult> recognitionResults;
std::vector<PlateRegion> plateRegions;
std::vector<AlprResult> recognitionResults;
};

View File

@@ -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";

View File

@@ -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<Mat> thresholds, vector<Rect> charRegions);
void performOCR(std::vector<cv::Mat> thresholds, std::vector<cv::Rect> charRegions);
PostProcess* postProcessor;
//string recognizedText;
@@ -52,7 +49,7 @@ class OCR
private:
Config* config;
TessBaseAPI *tesseract;
tesseract::TessBaseAPI *tesseract;
};