Updated misc libraries to work with external state id library

This commit is contained in:
Matt Hill
2015-08-09 19:22:39 -04:00
parent 226ff9eb03
commit 123f3a8fbf
6 changed files with 15 additions and 21 deletions

View File

@@ -134,6 +134,7 @@ add_subdirectory(tests)
ENDIF()
add_subdirectory(openalpr)
add_subdirectory(statedetection)
add_subdirectory(video)
if (WITH_BINDING_JAVA)

View File

@@ -23,6 +23,7 @@ ADD_EXECUTABLE(openalpr-utils-benchmark
)
TARGET_LINK_LIBRARIES(openalpr-utils-benchmark
${OPENALPR_LIB}
statedetection
support
pthread
${OpenCV_LIBS}
@@ -72,4 +73,3 @@ ENDIF()
install (TARGETS openalpr-utils-prepcharsfortraining DESTINATION bin)
install (TARGETS openalpr-utils-tagplates DESTINATION bin)
install (TARGETS openalpr-utils-calibrate DESTINATION bin)

View File

@@ -167,7 +167,7 @@ int main( int argc, const char** argv )
alpr.setDetectRegion(true);
Detector* plateDetector = createDetector(&config);
StateIdentifier stateIdentifier(&config);
StateDetector stateDetector(country, config.runtimeBaseDir);
OCR ocr(&config);
vector<double> endToEndTimes;
@@ -211,7 +211,7 @@ int main( int argc, const char** argv )
getTimeMonotonic(&startTime);
stateIdentifier.recognize(&pipeline_data);
//stateDetector.detect(&pipeline_data);
getTimeMonotonic(&endTime);
double stateidTime = diffclock(startTime, endTime);
cout << "\tRegion " << z << ": State ID time: " << stateidTime << "ms." << endl;

View File

@@ -26,7 +26,6 @@
#include "postprocess/regexrule.h"
#include "licenseplatecandidate.h"
#include "stateidentifier.h"
#include "utility.h"
#include "support/filesystem.h"
#include "ocr.h"

View File

@@ -25,7 +25,7 @@
#include <sys/stat.h>
#include "licenseplatecandidate.h"
#include "stateidentifier.h"
#include "../statedetection/state_detector.h"
#include "utility.h"
#include "support/filesystem.h"
@@ -36,7 +36,7 @@ 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.
bool detectPlate( StateIdentifier* identifier, Mat frame);
bool detectPlate( StateDetector* identifier, Mat frame);
int main( int argc, const char** argv )
{
@@ -59,7 +59,7 @@ int main( int argc, const char** argv )
}
Config config("us");
StateIdentifier identifier(&config);
StateDetector identifier(config.country, config.runtimeBaseDir);
if (DirectoryExists(outDir.c_str()) == false)
{
@@ -79,22 +79,17 @@ int main( int argc, const char** argv )
cout << fullpath << endl;
frame = imread( fullpath.c_str() );
PipelineData pipeline_data(frame, Rect(0, 0, frame.cols, frame.rows), &config);
identifier.recognize(&pipeline_data);
if (pipeline_data.region_confidence <= 20)
vector<StateCandidate> candidates = identifier.detect(frame.data, frame.elemSize(), frame.cols, frame.rows);
if (candidates.size() > 0)
{
pipeline_data.region_code = "zz";
pipeline_data.region_confidence = 100;
}
else
{
cout << pipeline_data.region_confidence << " : " << pipeline_data.region_code;
cout << candidates[0].confidence << " : " << candidates[0].state_code;
ostringstream convert; // stream used for the conversion
convert << i; // insert the textual representation of 'Number' in the characters in the stream
string copyCommand = "cp \"" + fullpath + "\" " + outDir + pipeline_data.region_code + convert.str() + ".png";
string copyCommand = "cp \"" + fullpath + "\" " + outDir + candidates[0].state_code + convert.str() + ".png";
system( copyCommand.c_str() );
waitKey(50);
//while ((char) waitKey(50) != 'c') { }
@@ -104,4 +99,4 @@ int main( int argc, const char** argv )
}
}
bool detectPlate( StateIdentifier* identifier, Mat frame);
bool detectPlate( StateDetector* identifier, Mat frame);

View File

@@ -12,8 +12,6 @@ set(lpr_source_files
detection/detectormorph.cpp
licenseplatecandidate.cpp
utility.cpp
stateidentifier.cpp
featurematcher.cpp
ocr.cpp
postprocess/postprocess.cpp
postprocess/regexrule.cpp
@@ -51,6 +49,7 @@ set_target_properties(openalpr PROPERTIES SOVERSION ${OPENALPR_MAJOR_VERSION})
TARGET_LINK_LIBRARIES(openalpr
support
statedetection
${OpenCV_LIBS}
${Tesseract_LIBRARIES}
)