mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-09 18:00:29 +08:00
Updated misc libraries to work with external state id library
This commit is contained in:
@@ -134,6 +134,7 @@ add_subdirectory(tests)
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
add_subdirectory(openalpr)
|
add_subdirectory(openalpr)
|
||||||
|
add_subdirectory(statedetection)
|
||||||
add_subdirectory(video)
|
add_subdirectory(video)
|
||||||
|
|
||||||
if (WITH_BINDING_JAVA)
|
if (WITH_BINDING_JAVA)
|
||||||
|
@@ -23,6 +23,7 @@ ADD_EXECUTABLE(openalpr-utils-benchmark
|
|||||||
)
|
)
|
||||||
TARGET_LINK_LIBRARIES(openalpr-utils-benchmark
|
TARGET_LINK_LIBRARIES(openalpr-utils-benchmark
|
||||||
${OPENALPR_LIB}
|
${OPENALPR_LIB}
|
||||||
|
statedetection
|
||||||
support
|
support
|
||||||
pthread
|
pthread
|
||||||
${OpenCV_LIBS}
|
${OpenCV_LIBS}
|
||||||
@@ -72,4 +73,3 @@ ENDIF()
|
|||||||
install (TARGETS openalpr-utils-prepcharsfortraining DESTINATION bin)
|
install (TARGETS openalpr-utils-prepcharsfortraining DESTINATION bin)
|
||||||
install (TARGETS openalpr-utils-tagplates DESTINATION bin)
|
install (TARGETS openalpr-utils-tagplates DESTINATION bin)
|
||||||
install (TARGETS openalpr-utils-calibrate DESTINATION bin)
|
install (TARGETS openalpr-utils-calibrate DESTINATION bin)
|
||||||
|
|
||||||
|
@@ -167,7 +167,7 @@ int main( int argc, const char** argv )
|
|||||||
alpr.setDetectRegion(true);
|
alpr.setDetectRegion(true);
|
||||||
|
|
||||||
Detector* plateDetector = createDetector(&config);
|
Detector* plateDetector = createDetector(&config);
|
||||||
StateIdentifier stateIdentifier(&config);
|
StateDetector stateDetector(country, config.runtimeBaseDir);
|
||||||
OCR ocr(&config);
|
OCR ocr(&config);
|
||||||
|
|
||||||
vector<double> endToEndTimes;
|
vector<double> endToEndTimes;
|
||||||
@@ -211,7 +211,7 @@ int main( int argc, const char** argv )
|
|||||||
|
|
||||||
getTimeMonotonic(&startTime);
|
getTimeMonotonic(&startTime);
|
||||||
|
|
||||||
stateIdentifier.recognize(&pipeline_data);
|
//stateDetector.detect(&pipeline_data);
|
||||||
getTimeMonotonic(&endTime);
|
getTimeMonotonic(&endTime);
|
||||||
double stateidTime = diffclock(startTime, endTime);
|
double stateidTime = diffclock(startTime, endTime);
|
||||||
cout << "\tRegion " << z << ": State ID time: " << stateidTime << "ms." << endl;
|
cout << "\tRegion " << z << ": State ID time: " << stateidTime << "ms." << endl;
|
||||||
|
@@ -26,7 +26,6 @@
|
|||||||
|
|
||||||
#include "postprocess/regexrule.h"
|
#include "postprocess/regexrule.h"
|
||||||
#include "licenseplatecandidate.h"
|
#include "licenseplatecandidate.h"
|
||||||
#include "stateidentifier.h"
|
|
||||||
#include "utility.h"
|
#include "utility.h"
|
||||||
#include "support/filesystem.h"
|
#include "support/filesystem.h"
|
||||||
#include "ocr.h"
|
#include "ocr.h"
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#include "licenseplatecandidate.h"
|
#include "licenseplatecandidate.h"
|
||||||
#include "stateidentifier.h"
|
#include "../statedetection/state_detector.h"
|
||||||
#include "utility.h"
|
#include "utility.h"
|
||||||
#include "support/filesystem.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.
|
// 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.
|
||||||
|
|
||||||
bool detectPlate( StateIdentifier* identifier, Mat frame);
|
bool detectPlate( StateDetector* identifier, Mat frame);
|
||||||
|
|
||||||
int main( int argc, const char** argv )
|
int main( int argc, const char** argv )
|
||||||
{
|
{
|
||||||
@@ -59,7 +59,7 @@ int main( int argc, const char** argv )
|
|||||||
}
|
}
|
||||||
|
|
||||||
Config config("us");
|
Config config("us");
|
||||||
StateIdentifier identifier(&config);
|
StateDetector identifier(config.country, config.runtimeBaseDir);
|
||||||
|
|
||||||
if (DirectoryExists(outDir.c_str()) == false)
|
if (DirectoryExists(outDir.c_str()) == false)
|
||||||
{
|
{
|
||||||
@@ -79,22 +79,17 @@ int main( int argc, const char** argv )
|
|||||||
cout << fullpath << endl;
|
cout << fullpath << endl;
|
||||||
frame = imread( fullpath.c_str() );
|
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";
|
cout << candidates[0].confidence << " : " << candidates[0].state_code;
|
||||||
pipeline_data.region_confidence = 100;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cout << pipeline_data.region_confidence << " : " << pipeline_data.region_code;
|
|
||||||
|
|
||||||
ostringstream convert; // stream used for the conversion
|
ostringstream convert; // stream used for the conversion
|
||||||
convert << i; // insert the textual representation of 'Number' in the characters in the stream
|
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() );
|
system( copyCommand.c_str() );
|
||||||
waitKey(50);
|
waitKey(50);
|
||||||
//while ((char) waitKey(50) != 'c') { }
|
//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);
|
||||||
|
@@ -12,8 +12,6 @@ set(lpr_source_files
|
|||||||
detection/detectormorph.cpp
|
detection/detectormorph.cpp
|
||||||
licenseplatecandidate.cpp
|
licenseplatecandidate.cpp
|
||||||
utility.cpp
|
utility.cpp
|
||||||
stateidentifier.cpp
|
|
||||||
featurematcher.cpp
|
|
||||||
ocr.cpp
|
ocr.cpp
|
||||||
postprocess/postprocess.cpp
|
postprocess/postprocess.cpp
|
||||||
postprocess/regexrule.cpp
|
postprocess/regexrule.cpp
|
||||||
@@ -51,6 +49,7 @@ set_target_properties(openalpr PROPERTIES SOVERSION ${OPENALPR_MAJOR_VERSION})
|
|||||||
|
|
||||||
TARGET_LINK_LIBRARIES(openalpr
|
TARGET_LINK_LIBRARIES(openalpr
|
||||||
support
|
support
|
||||||
|
statedetection
|
||||||
${OpenCV_LIBS}
|
${OpenCV_LIBS}
|
||||||
${Tesseract_LIBRARIES}
|
${Tesseract_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user