mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 07:37:00 +08:00
Moved character analysis to text detection folder
This commit is contained in:
@@ -22,7 +22,8 @@ set(lpr_source_files
|
|||||||
segmentation/verticalhistogram.cpp
|
segmentation/verticalhistogram.cpp
|
||||||
platecorners.cpp
|
platecorners.cpp
|
||||||
colorfilter.cpp
|
colorfilter.cpp
|
||||||
characteranalysis.cpp
|
textdetection/characteranalysis.cpp
|
||||||
|
textdetection/characteranalysis2l.cpp
|
||||||
pipeline_data.cpp
|
pipeline_data.cpp
|
||||||
trex.c
|
trex.c
|
||||||
cjson.c
|
cjson.c
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
#include "opencv2/imgproc/imgproc.hpp"
|
#include "opencv2/imgproc/imgproc.hpp"
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
#include "utility.h"
|
#include "utility.h"
|
||||||
#include "characteranalysis.h"
|
#include "textdetection/characteranalysis.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "pipeline_data.h"
|
#include "pipeline_data.h"
|
||||||
|
|
||||||
|
60
src/openalpr/textdetection/characteranalysis2l.cpp
Normal file
60
src/openalpr/textdetection/characteranalysis2l.cpp
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014 New Designs Unlimited, LLC
|
||||||
|
* Opensource Automated License Plate Recognition [http://www.openalpr.com]
|
||||||
|
*
|
||||||
|
* This file is part of OpenAlpr.
|
||||||
|
*
|
||||||
|
* OpenAlpr is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License
|
||||||
|
* version 3 as published by the Free Software Foundation
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "characteranalysis2l.h"
|
||||||
|
|
||||||
|
using namespace cv;
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
CharacterAnalysis2L::CharacterAnalysis2L(PipelineData* pipeline_data) {
|
||||||
|
this->pipeline_data = pipeline_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CharacterAnalysis2L::~CharacterAnalysis2L() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void CharacterAnalysis2L::analyze() {
|
||||||
|
|
||||||
|
pipeline_data->clearThresholds();
|
||||||
|
pipeline_data->thresholds = produceThresholds(pipeline_data->crop_gray, pipeline_data->config);
|
||||||
|
|
||||||
|
std::vector<std::vector<std::vector<cv::Point> > > allContours;
|
||||||
|
std::vector<std::vector<cv::Vec4i> > allHierarchy;
|
||||||
|
|
||||||
|
timespec startTime;
|
||||||
|
getTime(&startTime);
|
||||||
|
|
||||||
|
for (uint i = 0; i < pipeline_data->thresholds.size(); i++)
|
||||||
|
{
|
||||||
|
vector<vector<Point> > contours;
|
||||||
|
vector<Vec4i> hierarchy;
|
||||||
|
|
||||||
|
Mat tempThreshold(pipeline_data->thresholds[i].size(), CV_8U);
|
||||||
|
pipeline_data->thresholds[i].copyTo(tempThreshold);
|
||||||
|
findContours(tempThreshold,
|
||||||
|
contours, // a vector of contours
|
||||||
|
hierarchy,
|
||||||
|
CV_RETR_TREE, // retrieve all contours
|
||||||
|
CV_CHAIN_APPROX_SIMPLE ); // all pixels of each contours
|
||||||
|
|
||||||
|
allContours.push_back(contours);
|
||||||
|
allHierarchy.push_back(hierarchy);
|
||||||
|
}
|
||||||
|
}
|
38
src/openalpr/textdetection/characteranalysis2l.h
Normal file
38
src/openalpr/textdetection/characteranalysis2l.h
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2014 New Designs Unlimited, LLC
|
||||||
|
* Opensource Automated License Plate Recognition [http://www.openalpr.com]
|
||||||
|
*
|
||||||
|
* This file is part of OpenAlpr.
|
||||||
|
*
|
||||||
|
* OpenAlpr is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License
|
||||||
|
* version 3 as published by the Free Software Foundation
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef OPENALPR_CHARACTERANALYSIS2L_H
|
||||||
|
#define OPENALPR_CHARACTERANALYSIS2L_H
|
||||||
|
|
||||||
|
#include "utility.h"
|
||||||
|
#include "config.h"
|
||||||
|
#include "pipeline_data.h"
|
||||||
|
|
||||||
|
class CharacterAnalysis2L {
|
||||||
|
public:
|
||||||
|
CharacterAnalysis2L(PipelineData* pipeline_data);
|
||||||
|
virtual ~CharacterAnalysis2L();
|
||||||
|
private:
|
||||||
|
|
||||||
|
PipelineData* pipeline_data;
|
||||||
|
void analyze();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* OPENALPR_CHARACTERANALYSIS2L_H */
|
||||||
|
|
Reference in New Issue
Block a user