diff --git a/src/openalpr/CMakeLists.txt b/src/openalpr/CMakeLists.txt index d979f90..9ca6c59 100644 --- a/src/openalpr/CMakeLists.txt +++ b/src/openalpr/CMakeLists.txt @@ -22,7 +22,8 @@ set(lpr_source_files segmentation/verticalhistogram.cpp platecorners.cpp colorfilter.cpp - characteranalysis.cpp + textdetection/characteranalysis.cpp + textdetection/characteranalysis2l.cpp pipeline_data.cpp trex.c cjson.c diff --git a/src/openalpr/characterregion.h b/src/openalpr/characterregion.h index 1890fe9..94a1d90 100644 --- a/src/openalpr/characterregion.h +++ b/src/openalpr/characterregion.h @@ -23,7 +23,7 @@ #include "opencv2/imgproc/imgproc.hpp" #include "constants.h" #include "utility.h" -#include "characteranalysis.h" +#include "textdetection/characteranalysis.h" #include "config.h" #include "pipeline_data.h" diff --git a/src/openalpr/characteranalysis.cpp b/src/openalpr/textdetection/characteranalysis.cpp similarity index 100% rename from src/openalpr/characteranalysis.cpp rename to src/openalpr/textdetection/characteranalysis.cpp diff --git a/src/openalpr/characteranalysis.h b/src/openalpr/textdetection/characteranalysis.h similarity index 100% rename from src/openalpr/characteranalysis.h rename to src/openalpr/textdetection/characteranalysis.h diff --git a/src/openalpr/textdetection/characteranalysis2l.cpp b/src/openalpr/textdetection/characteranalysis2l.cpp new file mode 100644 index 0000000..6bfc957 --- /dev/null +++ b/src/openalpr/textdetection/characteranalysis2l.cpp @@ -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 . +*/ + +#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 > > allContours; + std::vector > allHierarchy; + + timespec startTime; + getTime(&startTime); + + for (uint i = 0; i < pipeline_data->thresholds.size(); i++) + { + vector > contours; + vector 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); + } +} diff --git a/src/openalpr/textdetection/characteranalysis2l.h b/src/openalpr/textdetection/characteranalysis2l.h new file mode 100644 index 0000000..9efdb26 --- /dev/null +++ b/src/openalpr/textdetection/characteranalysis2l.h @@ -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 . +*/ + +#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 */ +