mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 01:27:03 +08:00
Removed "using" statements from ocr.h
This commit is contained in:
@@ -41,12 +41,12 @@ std::vector<AlprResult> Alpr::recognize(std::string filepath)
|
|||||||
std::vector<AlprResult> Alpr::recognize(std::vector<unsigned char> imageBuffer)
|
std::vector<AlprResult> Alpr::recognize(std::vector<unsigned char> imageBuffer)
|
||||||
{
|
{
|
||||||
// Not sure if this actually works
|
// 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);
|
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);
|
return impl->toJson(results, processing_time_ms);
|
||||||
}
|
}
|
||||||
|
@@ -21,6 +21,9 @@
|
|||||||
|
|
||||||
void plateAnalysisThread(void* arg);
|
void plateAnalysisThread(void* arg);
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace cv;
|
||||||
|
|
||||||
AlprImpl::AlprImpl(const std::string country, const std::string configFile, const std::string runtimeDir)
|
AlprImpl::AlprImpl(const std::string country, const std::string configFile, const std::string runtimeDir)
|
||||||
{
|
{
|
||||||
config = new Config(country, configFile, runtimeDir);
|
config = new Config(country, configFile, runtimeDir);
|
||||||
|
@@ -47,6 +47,8 @@
|
|||||||
|
|
||||||
#define ALPR_NULL_PTR 0
|
#define ALPR_NULL_PTR 0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class AlprImpl
|
class AlprImpl
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -60,9 +62,9 @@ class AlprImpl
|
|||||||
|
|
||||||
void setDetectRegion(bool detectRegion);
|
void setDetectRegion(bool detectRegion);
|
||||||
void setTopN(int topn);
|
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();
|
static std::string getVersion();
|
||||||
|
|
||||||
Config* config;
|
Config* config;
|
||||||
@@ -85,7 +87,7 @@ class AlprImpl
|
|||||||
class PlateDispatcher
|
class PlateDispatcher
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PlateDispatcher(vector<PlateRegion> plateRegions, cv::Mat* image,
|
PlateDispatcher(std::vector<PlateRegion> plateRegions, cv::Mat* image,
|
||||||
Config* config,
|
Config* config,
|
||||||
StateIdentifier* stateIdentifier,
|
StateIdentifier* stateIdentifier,
|
||||||
OCR* ocr,
|
OCR* ocr,
|
||||||
@@ -106,7 +108,7 @@ class PlateDispatcher
|
|||||||
{
|
{
|
||||||
tthread::lock_guard<tthread::mutex> guard(mMutex);
|
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);
|
this->frame->copyTo(img);
|
||||||
|
|
||||||
return img;
|
return img;
|
||||||
@@ -139,7 +141,7 @@ class PlateDispatcher
|
|||||||
recognitionResults.push_back(recognitionResult);
|
recognitionResults.push_back(recognitionResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<AlprResult> getRecognitionResults()
|
std::vector<AlprResult> getRecognitionResults()
|
||||||
{
|
{
|
||||||
return recognitionResults;
|
return recognitionResults;
|
||||||
}
|
}
|
||||||
@@ -159,8 +161,8 @@ class PlateDispatcher
|
|||||||
tthread::mutex mMutex;
|
tthread::mutex mMutex;
|
||||||
|
|
||||||
cv::Mat* frame;
|
cv::Mat* frame;
|
||||||
vector<PlateRegion> plateRegions;
|
std::vector<PlateRegion> plateRegions;
|
||||||
vector<AlprResult> recognitionResults;
|
std::vector<AlprResult> recognitionResults;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -19,6 +19,10 @@
|
|||||||
|
|
||||||
#include "ocr.h"
|
#include "ocr.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace cv;
|
||||||
|
using namespace tesseract;
|
||||||
|
|
||||||
OCR::OCR(Config* config)
|
OCR::OCR(Config* config)
|
||||||
{
|
{
|
||||||
const string EXPECTED_TESSERACT_VERSION = "3.03";
|
const string EXPECTED_TESSERACT_VERSION = "3.03";
|
||||||
|
@@ -31,9 +31,6 @@
|
|||||||
#include "opencv2/imgproc/imgproc.hpp"
|
#include "opencv2/imgproc/imgproc.hpp"
|
||||||
|
|
||||||
#include "tesseract/baseapi.h"
|
#include "tesseract/baseapi.h"
|
||||||
using namespace tesseract;
|
|
||||||
using namespace std;
|
|
||||||
using namespace cv;
|
|
||||||
|
|
||||||
class OCR
|
class OCR
|
||||||
{
|
{
|
||||||
@@ -42,7 +39,7 @@ class OCR
|
|||||||
OCR(Config* config);
|
OCR(Config* config);
|
||||||
virtual ~OCR();
|
virtual ~OCR();
|
||||||
|
|
||||||
void performOCR(vector<Mat> thresholds, vector<Rect> charRegions);
|
void performOCR(std::vector<cv::Mat> thresholds, std::vector<cv::Rect> charRegions);
|
||||||
|
|
||||||
PostProcess* postProcessor;
|
PostProcess* postProcessor;
|
||||||
//string recognizedText;
|
//string recognizedText;
|
||||||
@@ -52,7 +49,7 @@ class OCR
|
|||||||
private:
|
private:
|
||||||
Config* config;
|
Config* config;
|
||||||
|
|
||||||
TessBaseAPI *tesseract;
|
tesseract::TessBaseAPI *tesseract;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user