Using detector mode in detectorfactory

This commit is contained in:
Matt Hill
2015-03-18 18:12:02 -04:00
parent 27b665fe0a
commit c25bdf773e

View File

@@ -1,15 +1,16 @@
#include "detectorfactory.h" #include "detectorfactory.h"
#include "detectormorph.h"
namespace alpr namespace alpr
{ {
Detector* createDetector(Config* config) Detector* createDetector(Config* config)
{ {
if (config->gpu_mode == 0) if (config->detector == DETECTOR_LBP_CPU)
{ {
// CPU mode // CPU mode
return new DetectorCPU(config); return new DetectorCPU(config);
} }
else if (config->gpu_mode == 1) else if (config->detector == DETECTOR_LBP_GPU)
{ {
#ifdef COMPILE_GPU #ifdef COMPILE_GPU
return new DetectorCUDA(config); return new DetectorCUDA(config);
@@ -20,6 +21,15 @@ namespace alpr
return new DetectorCPU(config); return new DetectorCPU(config);
#endif #endif
} }
else if (config->detector == DETECTOR_MORPH_CPU)
{
return new DetectorMorph(config);
}
else
{
std::cerr << "Unknown detector requested. Using LBP CPU" << std::endl;
return new DetectorCPU(config);
}
} }
} }