Added compile toggle for statedetection library

This commit is contained in:
Matt Hill
2016-02-25 22:14:51 -05:00
parent 0fc32038b1
commit 7fc6978fc9
4 changed files with 23 additions and 3 deletions

View File

@@ -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)

View File

@@ -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;

View File

@@ -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);

View File

@@ -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;
}