mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 06:46:53 +08:00
Wrapped OpenALPR library in "alpr" namespace. Resolves issue #60.
This commit is contained in:
@@ -21,6 +21,8 @@
|
|||||||
#include <log4cplus/consoleappender.h>
|
#include <log4cplus/consoleappender.h>
|
||||||
#include <log4cplus/fileappender.h>
|
#include <log4cplus/fileappender.h>
|
||||||
|
|
||||||
|
using namespace alpr;
|
||||||
|
|
||||||
// prototypes
|
// prototypes
|
||||||
void streamRecognitionThread(void* arg);
|
void streamRecognitionThread(void* arg);
|
||||||
bool writeToQueue(std::string jsonResult);
|
bool writeToQueue(std::string jsonResult);
|
||||||
|
@@ -33,6 +33,8 @@
|
|||||||
#include "video/videobuffer.h"
|
#include "video/videobuffer.h"
|
||||||
#include "alpr.h"
|
#include "alpr.h"
|
||||||
|
|
||||||
|
using namespace alpr;
|
||||||
|
|
||||||
const std::string MAIN_WINDOW_NAME = "ALPR main window";
|
const std::string MAIN_WINDOW_NAME = "ALPR main window";
|
||||||
|
|
||||||
const bool SAVE_LAST_VIDEO_STILL = false;
|
const bool SAVE_LAST_VIDEO_STILL = false;
|
||||||
|
@@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
|
using namespace alpr;
|
||||||
|
|
||||||
// Given a directory full of lp images (named [statecode]#.png) crop out the alphanumeric characters.
|
// Given a directory full of lp images (named [statecode]#.png) crop out the alphanumeric characters.
|
||||||
// These will be used to train the OCR
|
// These will be used to train the OCR
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
#include "benchmark_utils.h"
|
#include "benchmark_utils.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
using namespace alpr;
|
||||||
|
|
||||||
vector<string> filterByExtension(vector<string> fileList, string extension)
|
vector<string> filterByExtension(vector<string> fileList, string extension)
|
||||||
{
|
{
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
|
using namespace alpr;
|
||||||
|
|
||||||
|
|
||||||
EndToEndTest::EndToEndTest(string inputDir, string outputDir)
|
EndToEndTest::EndToEndTest(string inputDir, string outputDir)
|
||||||
|
@@ -15,8 +15,8 @@ class EndToEndTest
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
bool rectMatches(cv::Rect actualPlate, PlateRegion candidate);
|
bool rectMatches(cv::Rect actualPlate, alpr::PlateRegion candidate);
|
||||||
int totalRectCount(PlateRegion rootCandidate);
|
int totalRectCount(alpr::PlateRegion rootCandidate);
|
||||||
|
|
||||||
std::string inputDir;
|
std::string inputDir;
|
||||||
std::string outputDir;
|
std::string outputDir;
|
||||||
|
@@ -32,6 +32,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
|
using namespace alpr;
|
||||||
|
|
||||||
// Given a directory full of lp images (named [statecode]#.png) crop out the alphanumeric characters.
|
// Given a directory full of lp images (named [statecode]#.png) crop out the alphanumeric characters.
|
||||||
// These will be used to train the OCR
|
// These will be used to train the OCR
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
|
using namespace alpr;
|
||||||
|
|
||||||
// Takes a directory full of single char images, and plops them on a big tif files
|
// Takes a directory full of single char images, and plops them on a big tif files
|
||||||
// Also creates a box file so Tesseract can recognize it
|
// Also creates a box file so Tesseract can recognize it
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
|
using namespace alpr;
|
||||||
|
|
||||||
// Given a directory full of pre-cropped images, identify the state that each image belongs to.
|
// Given a directory full of pre-cropped images, identify the state that each image belongs to.
|
||||||
// This is used to sort our own positive image database as a first step before grabbing characters to use to train the OCR.
|
// This is used to sort our own positive image database as a first step before grabbing characters to use to train the OCR.
|
||||||
|
@@ -58,6 +58,7 @@ const int UP_ARROW_KEY= 82;
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
|
using namespace alpr;
|
||||||
|
|
||||||
static bool ldragging = false;
|
static bool ldragging = false;
|
||||||
static int xPos1 = 0;
|
static int xPos1 = 0;
|
||||||
|
@@ -20,6 +20,9 @@
|
|||||||
#include "alpr.h"
|
#include "alpr.h"
|
||||||
#include "alpr_impl.h"
|
#include "alpr_impl.h"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
// ALPR code
|
// ALPR code
|
||||||
|
|
||||||
Alpr::Alpr(const std::string country, const std::string configFile, const std::string runtimeDir)
|
Alpr::Alpr(const std::string country, const std::string configFile, const std::string runtimeDir)
|
||||||
@@ -93,3 +96,4 @@ std::string Alpr::getVersion()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -24,6 +24,9 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
struct AlprPlate
|
struct AlprPlate
|
||||||
{
|
{
|
||||||
std::string characters;
|
std::string characters;
|
||||||
@@ -125,4 +128,5 @@ class Alpr
|
|||||||
AlprImpl* impl;
|
AlprImpl* impl;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
#endif // OPENALPR_APLR_H
|
#endif // OPENALPR_APLR_H
|
||||||
|
@@ -24,6 +24,8 @@ void plateAnalysisThread(void* arg);
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
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);
|
||||||
@@ -492,3 +494,4 @@ std::string AlprImpl::getVersion()
|
|||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
@@ -52,6 +52,8 @@
|
|||||||
|
|
||||||
#define ALPR_NULL_PTR 0
|
#define ALPR_NULL_PTR 0
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
struct AlprFullDetails
|
struct AlprFullDetails
|
||||||
{
|
{
|
||||||
@@ -101,7 +103,7 @@ class AlprImpl
|
|||||||
|
|
||||||
static cJSON* createJsonObj(const AlprPlateResult* result);
|
static cJSON* createJsonObj(const AlprPlateResult* result);
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif // OPENALPR_ALPRIMPL_H
|
#endif // OPENALPR_ALPRIMPL_H
|
@@ -36,11 +36,13 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
// *************************************************************
|
// *************************************************************
|
||||||
// glide a window across the image and
|
// glide a window across the image and
|
||||||
// create two maps: mean and standard deviation.
|
// create two maps: mean and standard deviation.
|
||||||
// *************************************************************
|
// *************************************************************
|
||||||
|
|
||||||
float calcLocalStats (Mat &im, Mat &map_m, Mat &map_s, int winx, int winy)
|
float calcLocalStats (Mat &im, Mat &map_m, Mat &map_s, int winx, int winy)
|
||||||
{
|
{
|
||||||
float m,s,max_s;
|
float m,s,max_s;
|
||||||
@@ -243,3 +245,5 @@ void NiblackSauvolaWolfJolion (Mat im, Mat output, NiblackVersion version,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
@@ -26,6 +26,8 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "opencv2/opencv.hpp"
|
#include "opencv2/opencv.hpp"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
enum NiblackVersion
|
enum NiblackVersion
|
||||||
{
|
{
|
||||||
@@ -45,4 +47,6 @@ enum NiblackVersion
|
|||||||
void NiblackSauvolaWolfJolion (cv::Mat im, cv::Mat output, NiblackVersion version,
|
void NiblackSauvolaWolfJolion (cv::Mat im, cv::Mat output, NiblackVersion version,
|
||||||
int winx, int winy, float k);
|
int winx, int winy, float k);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // OPENALPR_BINARIZEWOLF_H
|
#endif // OPENALPR_BINARIZEWOLF_H
|
||||||
|
@@ -22,6 +22,10 @@
|
|||||||
using namespace cv;
|
using namespace cv;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
ColorFilter::ColorFilter(Mat image, Mat characterMask, Config* config)
|
ColorFilter::ColorFilter(Mat image, Mat characterMask, Config* config)
|
||||||
{
|
{
|
||||||
timespec startTime;
|
timespec startTime;
|
||||||
@@ -396,3 +400,5 @@ int ColorFilter::getMajorityOpinion(vector<float> values, float minPercentAgreem
|
|||||||
|
|
||||||
return bestPercentAgreementIndex;
|
return bestPercentAgreementIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
@@ -27,6 +27,8 @@
|
|||||||
#include "utility.h"
|
#include "utility.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
class ColorFilter
|
class ColorFilter
|
||||||
{
|
{
|
||||||
@@ -54,4 +56,5 @@ class ColorFilter
|
|||||||
int getMajorityOpinion(std::vector<float> values, float minPercentAgreement, float maxValDifference);
|
int getMajorityOpinion(std::vector<float> values, float minPercentAgreement, float maxValDifference);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
#endif // OPENALPR_COLORFILTER_H
|
#endif // OPENALPR_COLORFILTER_H
|
||||||
|
@@ -21,6 +21,9 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
Config::Config(const std::string country, const std::string config_file, const std::string runtime_dir)
|
Config::Config(const std::string country, const std::string config_file, const std::string runtime_dir)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -282,3 +285,4 @@ string Config::getString(string section, string key, string defaultValue)
|
|||||||
string val = string(pszValue);
|
string val = string(pszValue);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
}
|
@@ -33,6 +33,8 @@
|
|||||||
#include <stdlib.h> /* getenv */
|
#include <stdlib.h> /* getenv */
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
class Config
|
class Config
|
||||||
{
|
{
|
||||||
@@ -131,5 +133,5 @@ private:
|
|||||||
bool getBoolean(std::string section, std::string key, bool defaultValue);
|
bool getBoolean(std::string section, std::string key, bool defaultValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
#endif // OPENALPR_CONFIG_H
|
#endif // OPENALPR_CONFIG_H
|
@@ -22,6 +22,9 @@
|
|||||||
using namespace cv;
|
using namespace cv;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
Detector::Detector(Config* config)
|
Detector::Detector(Config* config)
|
||||||
{
|
{
|
||||||
this->config = config;
|
this->config = config;
|
||||||
@@ -107,3 +110,5 @@ vector<PlateRegion> Detector::aggregateRegions(vector<Rect> regions)
|
|||||||
|
|
||||||
return topLevelRegions;
|
return topLevelRegions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
@@ -28,6 +28,9 @@
|
|||||||
#include "support/timing.h"
|
#include "support/timing.h"
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
struct PlateRegion
|
struct PlateRegion
|
||||||
{
|
{
|
||||||
cv::Rect rect;
|
cv::Rect rect;
|
||||||
@@ -58,4 +61,6 @@ class Detector
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // OPENALPR_REGIONDETECTOR_H
|
#endif // OPENALPR_REGIONDETECTOR_H
|
||||||
|
@@ -22,6 +22,9 @@
|
|||||||
using namespace cv;
|
using namespace cv;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
DetectorCPU::DetectorCPU(Config* config) : Detector(config) {
|
DetectorCPU::DetectorCPU(Config* config) : Detector(config) {
|
||||||
|
|
||||||
|
|
||||||
@@ -116,3 +119,5 @@ vector<PlateRegion> DetectorCPU::doCascade(Mat frame, std::vector<cv::Rect> regi
|
|||||||
return orderedRegions;
|
return orderedRegions;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
@@ -31,6 +31,9 @@
|
|||||||
|
|
||||||
#include "detector.h"
|
#include "detector.h"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
class DetectorCPU : public Detector {
|
class DetectorCPU : public Detector {
|
||||||
public:
|
public:
|
||||||
DetectorCPU(Config* config);
|
DetectorCPU(Config* config);
|
||||||
@@ -45,5 +48,7 @@ private:
|
|||||||
std::vector<PlateRegion> doCascade(cv::Mat frame, std::vector<cv::Rect> regionsOfInterest);
|
std::vector<PlateRegion> doCascade(cv::Mat frame, std::vector<cv::Rect> regionsOfInterest);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* OPENALPR_DETECTORCPU_H */
|
#endif /* OPENALPR_DETECTORCPU_H */
|
||||||
|
|
||||||
|
@@ -1,7 +1,11 @@
|
|||||||
#include "detectorfactory.h"
|
#include "detectorfactory.h"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
Detector* createDetector(Config* config)
|
Detector* createDetector(Config* config)
|
||||||
{
|
{
|
||||||
return new DetectorCPU(config);
|
return new DetectorCPU(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
@@ -23,7 +23,11 @@
|
|||||||
#include "detectorcpu.h"
|
#include "detectorcpu.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
Detector* createDetector(Config* config);
|
Detector* createDetector(Config* config);
|
||||||
|
|
||||||
|
}
|
||||||
#endif /* OPENALPR_DETECTORFACTORY_H */
|
#endif /* OPENALPR_DETECTORFACTORY_H */
|
||||||
|
|
||||||
|
@@ -23,6 +23,9 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
EdgeFinder::EdgeFinder(PipelineData* pipeline_data) {
|
EdgeFinder::EdgeFinder(PipelineData* pipeline_data) {
|
||||||
|
|
||||||
this->pipeline_data = pipeline_data;
|
this->pipeline_data = pipeline_data;
|
||||||
@@ -141,3 +144,4 @@ std::vector<cv::Point2f> EdgeFinder::findEdgeCorners() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
@@ -26,6 +26,9 @@
|
|||||||
#include "platelines.h"
|
#include "platelines.h"
|
||||||
#include "platecorners.h"
|
#include "platecorners.h"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
class EdgeFinder {
|
class EdgeFinder {
|
||||||
public:
|
public:
|
||||||
EdgeFinder(PipelineData* pipeline_data);
|
EdgeFinder(PipelineData* pipeline_data);
|
||||||
@@ -40,5 +43,6 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
#endif /* OPENALPR_EDGEFINDER_H */
|
#endif /* OPENALPR_EDGEFINDER_H */
|
||||||
|
|
||||||
|
@@ -22,6 +22,9 @@
|
|||||||
using namespace cv;
|
using namespace cv;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
PlateCorners::PlateCorners(Mat inputImage, PlateLines* plateLines, PipelineData* pipelineData, vector<TextLine> textLines) :
|
PlateCorners::PlateCorners(Mat inputImage, PlateLines* plateLines, PipelineData* pipelineData, vector<TextLine> textLines) :
|
||||||
tlc(textLines)
|
tlc(textLines)
|
||||||
{
|
{
|
||||||
@@ -349,6 +352,6 @@ void PlateCorners::scoreHorizontals(int h1, int h2)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -40,7 +40,8 @@
|
|||||||
|
|
||||||
#define SCORING_LINE_CONFIDENCE_WEIGHT 18.0
|
#define SCORING_LINE_CONFIDENCE_WEIGHT 18.0
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
class PlateCorners
|
class PlateCorners
|
||||||
{
|
{
|
||||||
@@ -76,4 +77,5 @@ class PlateCorners
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
#endif // OPENALPR_PLATELINES_H
|
#endif // OPENALPR_PLATELINES_H
|
||||||
|
@@ -24,6 +24,8 @@ using namespace std;
|
|||||||
|
|
||||||
const float MIN_CONFIDENCE = 0.3;
|
const float MIN_CONFIDENCE = 0.3;
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
PlateLines::PlateLines(PipelineData* pipelineData)
|
PlateLines::PlateLines(PipelineData* pipelineData)
|
||||||
{
|
{
|
||||||
@@ -250,3 +252,5 @@ Mat PlateLines::customGrayscaleConversion(Mat src)
|
|||||||
//displayImage(config, "Hue", hue);
|
//displayImage(config, "Hue", hue);
|
||||||
return grayscale;
|
return grayscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
@@ -27,6 +27,9 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "pipeline_data.h"
|
#include "pipeline_data.h"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
struct PlateLine
|
struct PlateLine
|
||||||
{
|
{
|
||||||
LineSegment line;
|
LineSegment line;
|
||||||
@@ -57,4 +60,6 @@ class PlateLines
|
|||||||
std::vector<PlateLine> getLines(cv::Mat edges, float sensitivityMultiplier, bool vertical);
|
std::vector<PlateLine> getLines(cv::Mat edges, float sensitivityMultiplier, bool vertical);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // OPENALPR_PLATELINES_H
|
#endif // OPENALPR_PLATELINES_H
|
||||||
|
@@ -21,6 +21,9 @@
|
|||||||
|
|
||||||
#include "scorekeeper.h"
|
#include "scorekeeper.h"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
ScoreKeeper::ScoreKeeper() {
|
ScoreKeeper::ScoreKeeper() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,3 +76,5 @@ void ScoreKeeper::printDebugScores() {
|
|||||||
|
|
||||||
std::cout << "Total: " << total << std::endl;
|
std::cout << "Total: " << total << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
@@ -24,6 +24,9 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
class ScoreKeeper {
|
class ScoreKeeper {
|
||||||
public:
|
public:
|
||||||
ScoreKeeper();
|
ScoreKeeper();
|
||||||
@@ -44,5 +47,7 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* OPENALPR_SCOREKEEPER_H */
|
#endif /* OPENALPR_SCOREKEEPER_H */
|
||||||
|
|
||||||
|
@@ -10,6 +10,9 @@
|
|||||||
using namespace cv;
|
using namespace cv;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
TextLineCollection::TextLineCollection(std::vector<TextLine> textLines) {
|
TextLineCollection::TextLineCollection(std::vector<TextLine> textLines) {
|
||||||
|
|
||||||
|
|
||||||
@@ -158,3 +161,5 @@ void TextLineCollection::findCenterVertical() {
|
|||||||
else
|
else
|
||||||
this->centerVerticalLine = LineSegment(p2, p1);
|
this->centerVerticalLine = LineSegment(p2, p1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
@@ -13,6 +13,8 @@
|
|||||||
#include "opencv2/imgproc/imgproc.hpp"
|
#include "opencv2/imgproc/imgproc.hpp"
|
||||||
#include "textdetection/textline.h"
|
#include "textdetection/textline.h"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
class TextLineCollection
|
class TextLineCollection
|
||||||
{
|
{
|
||||||
@@ -45,5 +47,7 @@ private:
|
|||||||
void findCenterVertical();
|
void findCenterVertical();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* OPENALPR_TEXTLINECOLLECTION_H */
|
#endif /* OPENALPR_TEXTLINECOLLECTION_H */
|
||||||
|
|
||||||
|
@@ -22,6 +22,9 @@
|
|||||||
using namespace cv;
|
using namespace cv;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
//const int DEFAULT_QUERY_FEATURES = 305;
|
//const int DEFAULT_QUERY_FEATURES = 305;
|
||||||
//const int DEFAULT_TRAINING_FEATURES = 305;
|
//const int DEFAULT_TRAINING_FEATURES = 305;
|
||||||
const float MAX_DISTANCE_TO_MATCH = 100.0f;
|
const float MAX_DISTANCE_TO_MATCH = 100.0f;
|
||||||
@@ -388,3 +391,5 @@ RecognitionResult FeatureMatcher::recognize( const Mat& queryImg, bool drawOnIma
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
@@ -30,6 +30,8 @@
|
|||||||
#include "utility.h"
|
#include "utility.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
struct RecognitionResult
|
struct RecognitionResult
|
||||||
{
|
{
|
||||||
@@ -74,4 +76,5 @@ class FeatureMatcher
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
#endif // OPENALPR_FEATUREMATCHER_H
|
#endif // OPENALPR_FEATUREMATCHER_H
|
||||||
|
@@ -26,6 +26,9 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
LicensePlateCandidate::LicensePlateCandidate(PipelineData* pipeline_data)
|
LicensePlateCandidate::LicensePlateCandidate(PipelineData* pipeline_data)
|
||||||
{
|
{
|
||||||
this->pipeline_data = pipeline_data;
|
this->pipeline_data = pipeline_data;
|
||||||
@@ -123,4 +126,4 @@ void LicensePlateCandidate::recognize()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@@ -37,8 +37,8 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "pipeline_data.h"
|
#include "pipeline_data.h"
|
||||||
|
|
||||||
//vector<Rect> getCharacterRegions(Mat frame, vector<Rect> regionsOfInterest);
|
namespace alpr
|
||||||
//vector<RotatedRect> getCharSegmentsBetweenLines(Mat img, vector<vector<Point> > contours, LineSegment top, LineSegment bottom);
|
{
|
||||||
|
|
||||||
class LicensePlateCandidate
|
class LicensePlateCandidate
|
||||||
{
|
{
|
||||||
@@ -64,4 +64,5 @@ class LicensePlateCandidate
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
#endif // OPENALPR_LICENSEPLATECANDIDATE_H
|
#endif // OPENALPR_LICENSEPLATECANDIDATE_H
|
||||||
|
@@ -23,6 +23,9 @@ using namespace std;
|
|||||||
using namespace cv;
|
using namespace cv;
|
||||||
using namespace tesseract;
|
using namespace tesseract;
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
OCR::OCR(Config* config)
|
OCR::OCR(Config* config)
|
||||||
: postProcessor(config)
|
: postProcessor(config)
|
||||||
{
|
{
|
||||||
@@ -132,3 +135,5 @@ void OCR::performOCR(PipelineData* pipeline_data)
|
|||||||
cout << "OCR Time: " << diffclock(startTime, endTime) << "ms." << endl;
|
cout << "OCR Time: " << diffclock(startTime, endTime) << "ms." << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
@@ -34,6 +34,9 @@
|
|||||||
|
|
||||||
#include "tesseract/baseapi.h"
|
#include "tesseract/baseapi.h"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
class OCR
|
class OCR
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -52,4 +55,6 @@ class OCR
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // OPENALPR_OCR_H
|
#endif // OPENALPR_OCR_H
|
||||||
|
@@ -3,6 +3,9 @@
|
|||||||
using namespace cv;
|
using namespace cv;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
PipelineData::PipelineData(Mat colorImage, Rect regionOfInterest, Config* config)
|
PipelineData::PipelineData(Mat colorImage, Rect regionOfInterest, Config* config)
|
||||||
{
|
{
|
||||||
this->colorImg = colorImage;
|
this->colorImg = colorImage;
|
||||||
@@ -29,3 +32,5 @@ void PipelineData::clearThresholds()
|
|||||||
}
|
}
|
||||||
thresholds.clear();
|
thresholds.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@@ -7,6 +7,9 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "textdetection/textline.h"
|
#include "textdetection/textline.h"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
class PipelineData
|
class PipelineData
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -54,5 +57,6 @@ class PipelineData
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // OPENALPR_PIPELINEDATA_H
|
#endif // OPENALPR_PIPELINEDATA_H
|
@@ -21,6 +21,10 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
PostProcess::PostProcess(Config* config)
|
PostProcess::PostProcess(Config* config)
|
||||||
{
|
{
|
||||||
this->config = config;
|
this->config = config;
|
||||||
@@ -518,3 +522,5 @@ string RegexRule::filterSkips(string text)
|
|||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
@@ -32,6 +32,9 @@
|
|||||||
|
|
||||||
#define SKIP_CHAR "~"
|
#define SKIP_CHAR "~"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
struct Letter
|
struct Letter
|
||||||
{
|
{
|
||||||
std::string letter;
|
std::string letter;
|
||||||
@@ -105,23 +108,5 @@ class PostProcess
|
|||||||
int getNextLeastDrop(std::vector<int> depth);
|
int getNextLeastDrop(std::vector<int> depth);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
}
|
||||||
class LetterScores
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
LetterScores(int numCharPositions);
|
|
||||||
|
|
||||||
void addScore(char letter, int charposition, float score);
|
|
||||||
|
|
||||||
vector<char> getBestScore();
|
|
||||||
float getConfidence();
|
|
||||||
|
|
||||||
private:
|
|
||||||
int numCharPositions;
|
|
||||||
|
|
||||||
vector<char> letters;
|
|
||||||
vector<int> charpositions;
|
|
||||||
vector<float> scores;
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
#endif // OPENALPR_POSTPROCESS_H
|
#endif // OPENALPR_POSTPROCESS_H
|
||||||
|
@@ -24,6 +24,9 @@
|
|||||||
using namespace cv;
|
using namespace cv;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
CharacterSegmenter::CharacterSegmenter(PipelineData* pipeline_data)
|
CharacterSegmenter::CharacterSegmenter(PipelineData* pipeline_data)
|
||||||
{
|
{
|
||||||
this->pipeline_data = pipeline_data;
|
this->pipeline_data = pipeline_data;
|
||||||
@@ -1078,4 +1081,4 @@ Mat CharacterSegmenter::getCharBoxMask(Mat img_threshold, vector<Rect> charBoxes
|
|||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@@ -29,8 +29,9 @@
|
|||||||
#include "textdetection/textcontours.h"
|
#include "textdetection/textcontours.h"
|
||||||
#include "pipeline_data.h"
|
#include "pipeline_data.h"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
//const float MIN_BOX_WIDTH_PX = 4; // 4 pixels
|
|
||||||
|
|
||||||
const cv::Scalar COLOR_DEBUG_EDGE(0,0,255); // Red
|
const cv::Scalar COLOR_DEBUG_EDGE(0,0,255); // Red
|
||||||
const cv::Scalar COLOR_DEBUG_SPECKLES(0,0,255); // Red
|
const cv::Scalar COLOR_DEBUG_SPECKLES(0,0,255); // Red
|
||||||
@@ -83,4 +84,6 @@ class CharacterSegmenter
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // OPENALPR_CHARACTERSEGMENTER_H
|
#endif // OPENALPR_CHARACTERSEGMENTER_H
|
||||||
|
@@ -19,6 +19,9 @@
|
|||||||
|
|
||||||
#include "segment.h"
|
#include "segment.h"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
Segment::Segment(cv::Rect newSegment)
|
Segment::Segment(cv::Rect newSegment)
|
||||||
{
|
{
|
||||||
this->segment = newSegment;
|
this->segment = newSegment;
|
||||||
@@ -48,3 +51,4 @@ bool Segment::matches(cv::Rect newSegment)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
@@ -25,6 +25,9 @@
|
|||||||
|
|
||||||
#include "opencv2/imgproc/imgproc.hpp"
|
#include "opencv2/imgproc/imgproc.hpp"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
class Segment
|
class Segment
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -38,4 +41,6 @@ class Segment
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // OPENALPR_SEGMENTATIONGROUP_H
|
#endif // OPENALPR_SEGMENTATIONGROUP_H
|
||||||
|
@@ -19,6 +19,9 @@
|
|||||||
|
|
||||||
#include "segmentationgroup.h"
|
#include "segmentationgroup.h"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
SegmentationGroup::SegmentationGroup()
|
SegmentationGroup::SegmentationGroup()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -47,3 +50,5 @@ bool SegmentationGroup::equals(SegmentationGroup otherGroup)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
@@ -27,6 +27,8 @@
|
|||||||
|
|
||||||
#include "segment.h"
|
#include "segment.h"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
class SegmentationGroup
|
class SegmentationGroup
|
||||||
{
|
{
|
||||||
@@ -47,4 +49,6 @@ class SegmentationGroup
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // OPENALPR_SEGMENTATIONGROUP_H
|
#endif // OPENALPR_SEGMENTATIONGROUP_H
|
||||||
|
@@ -22,6 +22,9 @@
|
|||||||
using namespace cv;
|
using namespace cv;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
VerticalHistogram::VerticalHistogram(Mat inputImage, Mat mask)
|
VerticalHistogram::VerticalHistogram(Mat inputImage, Mat mask)
|
||||||
{
|
{
|
||||||
analyzeImage(inputImage, mask);
|
analyzeImage(inputImage, mask);
|
||||||
@@ -179,3 +182,5 @@ HistogramDirection VerticalHistogram::getHistogramDirection(uint index)
|
|||||||
else
|
else
|
||||||
return FLAT;
|
return FLAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
@@ -22,6 +22,8 @@
|
|||||||
|
|
||||||
#include "opencv2/imgproc/imgproc.hpp"
|
#include "opencv2/imgproc/imgproc.hpp"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
struct Valley
|
struct Valley
|
||||||
{
|
{
|
||||||
@@ -61,4 +63,6 @@ class VerticalHistogram
|
|||||||
HistogramDirection getHistogramDirection(uint index);
|
HistogramDirection getHistogramDirection(uint index);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // OPENALPR_VERTICALHISTOGRAM_H
|
#endif // OPENALPR_VERTICALHISTOGRAM_H
|
||||||
|
@@ -23,6 +23,9 @@
|
|||||||
using namespace cv;
|
using namespace cv;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
StateIdentifier::StateIdentifier(Config* config)
|
StateIdentifier::StateIdentifier(Config* config)
|
||||||
{
|
{
|
||||||
this->config = config;
|
this->config = config;
|
||||||
@@ -87,3 +90,5 @@ bool StateIdentifier::recognize(PipelineData* pipeline_data)
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
@@ -27,6 +27,9 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "pipeline_data.h"
|
#include "pipeline_data.h"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
class StateIdentifier
|
class StateIdentifier
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -47,4 +50,5 @@ class StateIdentifier
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
#endif // OPENALPR_STATEIDENTIFIER_H
|
#endif // OPENALPR_STATEIDENTIFIER_H
|
||||||
|
@@ -1,5 +1,8 @@
|
|||||||
#include "filesystem.h"
|
#include "filesystem.h"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
bool startsWith(std::string const &fullString, std::string const &prefix)
|
bool startsWith(std::string const &fullString, std::string const &prefix)
|
||||||
{
|
{
|
||||||
if(fullString.substr(0, prefix.size()).compare(prefix) == 0) {
|
if(fullString.substr(0, prefix.size()).compare(prefix) == 0) {
|
||||||
@@ -107,3 +110,5 @@ std::string filenameWithoutExtension(std::string filename)
|
|||||||
int lastindex = filename.find_last_of(".");
|
int lastindex = filename.find_last_of(".");
|
||||||
return filename.substr(0, lastindex);
|
return filename.substr(0, lastindex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
@@ -17,6 +17,9 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
bool startsWith(std::string const &fullString, std::string const &prefix);
|
bool startsWith(std::string const &fullString, std::string const &prefix);
|
||||||
bool hasEnding (std::string const &fullString, std::string const &ending);
|
bool hasEnding (std::string const &fullString, std::string const &ending);
|
||||||
bool hasEndingInsensitive(const std::string& fullString, const std::string& ending);
|
bool hasEndingInsensitive(const std::string& fullString, const std::string& ending);
|
||||||
@@ -29,4 +32,6 @@ std::vector<std::string> getFilesInDir(const char* dirPath);
|
|||||||
|
|
||||||
bool stringCompare( const std::string &left, const std::string &right );
|
bool stringCompare( const std::string &left, const std::string &right );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // FILESYSTEM_H
|
#endif // FILESYSTEM_H
|
||||||
|
@@ -1,5 +1,8 @@
|
|||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
void sleep_ms(int sleepMs)
|
void sleep_ms(int sleepMs)
|
||||||
{
|
{
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
@@ -43,3 +46,5 @@ std::string getExeDir()
|
|||||||
return directory;
|
return directory;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
@@ -10,11 +10,13 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
void sleep_ms(int sleepMs);
|
void sleep_ms(int sleepMs);
|
||||||
|
|
||||||
std::string getExeDir();
|
std::string getExeDir();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif //OPENALPR_PLATFORM_H
|
#endif //OPENALPR_PLATFORM_H
|
||||||
|
@@ -1,5 +1,8 @@
|
|||||||
#include "timing.h"
|
#include "timing.h"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
timespec diff(timespec start, timespec end);
|
timespec diff(timespec start, timespec end);
|
||||||
|
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
@@ -156,4 +159,6 @@ long getEpochTime()
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -23,9 +23,14 @@
|
|||||||
#define timespec timeval
|
#define timespec timeval
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
void getTime(timespec* time);
|
void getTime(timespec* time);
|
||||||
double diffclock(timespec time1,timespec time2);
|
double diffclock(timespec time1,timespec time2);
|
||||||
|
|
||||||
long getEpochTime();
|
long getEpochTime();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -25,6 +25,9 @@
|
|||||||
using namespace cv;
|
using namespace cv;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
bool sort_text_line(TextLine i, TextLine j) { return (i.topLine.p1.y < j.topLine.p1.y); }
|
bool sort_text_line(TextLine i, TextLine j) { return (i.topLine.p1.y < j.topLine.p1.y); }
|
||||||
|
|
||||||
CharacterAnalysis::CharacterAnalysis(PipelineData* pipeline_data)
|
CharacterAnalysis::CharacterAnalysis(PipelineData* pipeline_data)
|
||||||
@@ -651,3 +654,5 @@ vector<Point> CharacterAnalysis::getCharArea(LineSegment topLine, LineSegment bo
|
|||||||
|
|
||||||
return charArea;
|
return charArea;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
@@ -29,6 +29,9 @@
|
|||||||
#include "platemask.h"
|
#include "platemask.h"
|
||||||
#include "linefinder.h"
|
#include "linefinder.h"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
class CharacterAnalysis
|
class CharacterAnalysis
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -71,4 +74,6 @@ class CharacterAnalysis
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // OPENALPR_CHARACTERANALYSIS_H
|
#endif // OPENALPR_CHARACTERANALYSIS_H
|
||||||
|
@@ -26,6 +26,9 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
LineFinder::LineFinder(PipelineData* pipeline_data) {
|
LineFinder::LineFinder(PipelineData* pipeline_data) {
|
||||||
this->pipeline_data = pipeline_data;
|
this->pipeline_data = pipeline_data;
|
||||||
}
|
}
|
||||||
@@ -251,3 +254,5 @@ CharPointInfo::CharPointInfo(vector<Point> contour, int index) {
|
|||||||
this->bottom = Point(x,y);
|
this->bottom = Point(x,y);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
@@ -27,6 +27,9 @@
|
|||||||
#include "textline.h"
|
#include "textline.h"
|
||||||
#include "pipeline_data.h"
|
#include "pipeline_data.h"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
class CharPointInfo
|
class CharPointInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -51,5 +54,7 @@ private:
|
|||||||
std::vector<cv::Point> getBestLine(const TextContours contours, std::vector<CharPointInfo> charPoints);
|
std::vector<cv::Point> getBestLine(const TextContours contours, std::vector<CharPointInfo> charPoints);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* OPENALPR_LINEFINDER_H */
|
#endif /* OPENALPR_LINEFINDER_H */
|
||||||
|
|
||||||
|
@@ -22,6 +22,9 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
PlateMask::PlateMask(PipelineData* pipeline_data) {
|
PlateMask::PlateMask(PipelineData* pipeline_data) {
|
||||||
this->pipeline_data = pipeline_data;
|
this->pipeline_data = pipeline_data;
|
||||||
this->hasPlateMask = false;
|
this->hasPlateMask = false;
|
||||||
@@ -197,3 +200,5 @@ void PlateMask::findOuterBoxMask( vector<TextContours > contours )
|
|||||||
|
|
||||||
this->plateMask = fullMask;
|
this->plateMask = fullMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
@@ -24,6 +24,9 @@
|
|||||||
#include "pipeline_data.h"
|
#include "pipeline_data.h"
|
||||||
#include "textcontours.h"
|
#include "textcontours.h"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
class PlateMask {
|
class PlateMask {
|
||||||
public:
|
public:
|
||||||
PlateMask(PipelineData* pipeline_data);
|
PlateMask(PipelineData* pipeline_data);
|
||||||
@@ -43,5 +46,6 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
#endif /* OPENALPR_PLATEMASK_H */
|
#endif /* OPENALPR_PLATEMASK_H */
|
||||||
|
|
||||||
|
@@ -22,6 +22,8 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
TextContours::TextContours() {
|
TextContours::TextContours() {
|
||||||
|
|
||||||
@@ -134,5 +136,5 @@ Mat TextContours::drawDebugImage(Mat baseImage) {
|
|||||||
return img_contours;
|
return img_contours;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -23,6 +23,9 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include "opencv2/imgproc/imgproc.hpp"
|
#include "opencv2/imgproc/imgproc.hpp"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
class TextContours {
|
class TextContours {
|
||||||
public:
|
public:
|
||||||
TextContours();
|
TextContours();
|
||||||
@@ -52,5 +55,7 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* TEXTCONTOURS_H */
|
#endif /* TEXTCONTOURS_H */
|
||||||
|
|
||||||
|
@@ -24,6 +24,9 @@
|
|||||||
|
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
TextLine::TextLine(std::vector<cv::Point2f> textArea, std::vector<cv::Point2f> linePolygon) {
|
TextLine::TextLine(std::vector<cv::Point2f> textArea, std::vector<cv::Point2f> linePolygon) {
|
||||||
std::vector<Point> textAreaInts, linePolygonInts;
|
std::vector<Point> textAreaInts, linePolygonInts;
|
||||||
|
|
||||||
@@ -105,3 +108,5 @@ cv::Mat TextLine::drawDebugImage(cv::Mat baseImage) {
|
|||||||
|
|
||||||
return debugImage;
|
return debugImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
@@ -24,6 +24,9 @@
|
|||||||
#include "utility.h"
|
#include "utility.h"
|
||||||
#include "opencv2/imgproc/imgproc.hpp"
|
#include "opencv2/imgproc/imgproc.hpp"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
class TextLine {
|
class TextLine {
|
||||||
public:
|
public:
|
||||||
TextLine(std::vector<cv::Point> textArea, std::vector<cv::Point> linePolygon);
|
TextLine(std::vector<cv::Point> textArea, std::vector<cv::Point> linePolygon);
|
||||||
@@ -50,5 +53,7 @@ private:
|
|||||||
void initialize(std::vector<cv::Point> textArea, std::vector<cv::Point> linePolygon);
|
void initialize(std::vector<cv::Point> textArea, std::vector<cv::Point> linePolygon);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* OPENALPR_TEXTLINE_H */
|
#endif /* OPENALPR_TEXTLINE_H */
|
||||||
|
|
||||||
|
@@ -22,6 +22,9 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
Transformation::Transformation(Mat bigImage, Mat smallImage, Rect regionInBigImage) {
|
Transformation::Transformation(Mat bigImage, Mat smallImage, Rect regionInBigImage) {
|
||||||
this->bigImage = bigImage;
|
this->bigImage = bigImage;
|
||||||
this->smallImage = smallImage;
|
this->smallImage = smallImage;
|
||||||
@@ -137,3 +140,5 @@ Size Transformation::getCropSize(vector<Point2f> areaCorners, Size targetSize)
|
|||||||
|
|
||||||
return Size(width, height);
|
return Size(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
@@ -23,6 +23,9 @@
|
|||||||
#include "opencv2/imgproc/imgproc.hpp"
|
#include "opencv2/imgproc/imgproc.hpp"
|
||||||
#include "utility.h"
|
#include "utility.h"
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
class Transformation {
|
class Transformation {
|
||||||
public:
|
public:
|
||||||
Transformation(cv::Mat bigImage, cv::Mat smallImage, cv::Rect regionInBigImage);
|
Transformation(cv::Mat bigImage, cv::Mat smallImage, cv::Rect regionInBigImage);
|
||||||
@@ -47,5 +50,7 @@ private:
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* OPENALPR_TRANSFORMATION_H */
|
#endif /* OPENALPR_TRANSFORMATION_H */
|
||||||
|
|
||||||
|
@@ -24,6 +24,9 @@
|
|||||||
using namespace cv;
|
using namespace cv;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
namespace alpr
|
||||||
|
{
|
||||||
|
|
||||||
Rect expandRect(Rect original, int expandXPixels, int expandYPixels, int maxX, int maxY)
|
Rect expandRect(Rect original, int expandXPixels, int expandYPixels, int maxX, int maxY)
|
||||||
{
|
{
|
||||||
Rect expandedRegion = Rect(original);
|
Rect expandedRegion = Rect(original);
|
||||||
@@ -434,3 +437,5 @@ std::string toString(double value)
|
|||||||
ss << value;
|
ss << value;
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
@@ -33,15 +33,8 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
/*
|
namespace alpr
|
||||||
struct LineSegment
|
|
||||||
{
|
{
|
||||||
float x1;
|
|
||||||
float y1;
|
|
||||||
float x2;
|
|
||||||
float y2;
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
class LineSegment
|
class LineSegment
|
||||||
{
|
{
|
||||||
@@ -114,4 +107,6 @@ std::string toString(uint value);
|
|||||||
std::string toString(float value);
|
std::string toString(float value);
|
||||||
std::string toString(double value);
|
std::string toString(double value);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endif // OPENALPR_UTILITY_H
|
#endif // OPENALPR_UTILITY_H
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
using namespace alpr;
|
||||||
|
|
||||||
|
|
||||||
TEST_CASE( "JSON Serialization/Deserialization", "[json]" ) {
|
TEST_CASE( "JSON Serialization/Deserialization", "[json]" ) {
|
||||||
|
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace cv;
|
using namespace cv;
|
||||||
|
using namespace alpr;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
|
|
||||||
#include "videobuffer.h"
|
#include "videobuffer.h"
|
||||||
|
|
||||||
|
using namespace alpr;
|
||||||
|
|
||||||
void imageCollectionThread(void* arg);
|
void imageCollectionThread(void* arg);
|
||||||
void getALPRImages(cv::VideoCapture cap, VideoDispatcher* dispatcher);
|
void getALPRImages(cv::VideoCapture cap, VideoDispatcher* dispatcher);
|
||||||
|
Reference in New Issue
Block a user