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