mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-07 04:50:54 +08:00
Added compile toggle for statedetection library
This commit is contained in:
@@ -27,6 +27,10 @@ IF ( NOT DEFINED WITH_DAEMON )
|
||||
SET(WITH_DAEMON ON)
|
||||
ENDIF()
|
||||
|
||||
IF ( NOT DEFINED WITH_STATEDETECTION )
|
||||
SET(WITH_STATEDETECTION ON)
|
||||
ENDIF()
|
||||
|
||||
if ( NOT DEFINED WITH_GPU_DETECTOR )
|
||||
SET(WITH_GPU_DETECTOR OFF)
|
||||
ENDIF()
|
||||
@@ -127,7 +131,13 @@ ELSE()
|
||||
SET(OPENALPR_LIB openalpr)
|
||||
ENDIF()
|
||||
|
||||
SET(STATE_DETECTION_LIB statedetection)
|
||||
IF (WITH_STATEDETECTION)
|
||||
SET(STATE_DETECTION_LIB statedetection)
|
||||
add_subdirectory(statedetection)
|
||||
ELSE()
|
||||
SET(STATE_DETECTION_LIB "")
|
||||
add_definitions( -DSKIP_STATE_DETECTION=1 )
|
||||
ENDIF()
|
||||
|
||||
if (NOT IOS)
|
||||
TARGET_LINK_LIBRARIES(alpr
|
||||
@@ -170,7 +180,6 @@ add_subdirectory(tests)
|
||||
ENDIF()
|
||||
|
||||
add_subdirectory(openalpr)
|
||||
add_subdirectory(statedetection)
|
||||
add_subdirectory(video)
|
||||
|
||||
if (WITH_BINDING_JAVA)
|
||||
|
@@ -167,7 +167,6 @@ int main( int argc, const char** argv )
|
||||
alpr.setDetectRegion(true);
|
||||
|
||||
Detector* plateDetector = createDetector(&config);
|
||||
StateDetector stateDetector(country, config.config_file_path, config.runtimeBaseDir);
|
||||
OCR ocr(&config);
|
||||
|
||||
vector<double> endToEndTimes;
|
||||
|
@@ -40,6 +40,8 @@ bool detectPlate( StateDetector* identifier, Mat frame);
|
||||
|
||||
int main( int argc, const char** argv )
|
||||
{
|
||||
#ifndef SKIP_STATE_DETECTION
|
||||
|
||||
string inDir;
|
||||
string outDir;
|
||||
Mat frame;
|
||||
@@ -97,6 +99,9 @@ int main( int argc, const char** argv )
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool detectPlate( StateDetector* identifier, Mat frame);
|
||||
|
@@ -279,6 +279,8 @@ namespace alpr
|
||||
plateResult.plate_points[pointidx].y = (int) cornerPoints[pointidx].y;
|
||||
}
|
||||
|
||||
|
||||
#ifndef SKIP_STATE_DETECTION
|
||||
if (detectRegion && country_recognizers.stateDetector->isLoaded())
|
||||
{
|
||||
std::vector<StateCandidate> state_candidates = country_recognizers.stateDetector->detect(pipeline_data.color_deskewed.data,
|
||||
@@ -292,6 +294,7 @@ namespace alpr
|
||||
plateResult.regionConfidence = (int) state_candidates[0].confidence;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (plateResult.region.length() > 0 && country_recognizers.ocr->postProcessor.regionIsValid(plateResult.region) == false)
|
||||
{
|
||||
@@ -705,7 +708,11 @@ namespace alpr
|
||||
recognizer.plateDetector = createDetector(config);
|
||||
recognizer.ocr = new OCR(config);
|
||||
|
||||
#ifndef SKIP_STATE_DETECTION
|
||||
recognizer.stateDetector = new StateDetector(this->config->country, this->config->config_file_path, this->config->runtimeBaseDir);
|
||||
#else
|
||||
recognizer.stateDetector = NULL;
|
||||
#endif
|
||||
|
||||
recognizers[config->country] = recognizer;
|
||||
}
|
||||
|
Reference in New Issue
Block a user