mirror of
https://github.com/kerberos-io/openalpr-base.git
synced 2025-10-06 06:46:53 +08:00
37 lines
883 B
C++
37 lines
883 B
C++
#include "detectorfactory.h"
|
|
#include "detectormorph.h"
|
|
|
|
namespace alpr
|
|
{
|
|
Detector* createDetector(Config* config)
|
|
{
|
|
if (config->detector == DETECTOR_LBP_CPU)
|
|
{
|
|
// CPU mode
|
|
return new DetectorCPU(config);
|
|
}
|
|
else if (config->detector == DETECTOR_LBP_GPU)
|
|
{
|
|
#ifdef COMPILE_GPU
|
|
return new DetectorCUDA(config);
|
|
#else
|
|
std::cerr << "Error: GPU detector requested, but GPU extensions are not compiled. " <<
|
|
"Add COMPILE_GPU=1 to the compiler definitions to enable GPU compilation." <<
|
|
std::endl;
|
|
return new DetectorCPU(config);
|
|
#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);
|
|
}
|
|
}
|
|
|
|
}
|
|
|