diff --git a/src/openalpr/constants.h b/src/openalpr/constants.h index 6c07c40..cf1e3bb 100644 --- a/src/openalpr/constants.h +++ b/src/openalpr/constants.h @@ -31,10 +31,6 @@ #define DEFAULT_CONFIG_FILE "/etc/openalpr/openalpr.conf" #endif -#ifndef COMPILE_GPU - #define COMPILE_GPU 0 -#endif - #define ENV_VARIABLE_CONFIG_FILE "OPENALPR_CONFIG_FILE" #endif // OPENALPR_CONSTANTS_H \ No newline at end of file diff --git a/src/openalpr/detection/detectorcuda.cpp b/src/openalpr/detection/detectorcuda.cpp index 5a0dde6..d5c980e 100644 --- a/src/openalpr/detection/detectorcuda.cpp +++ b/src/openalpr/detection/detectorcuda.cpp @@ -17,14 +17,14 @@ * along with this program. If not, see . */ - #include "detectorcuda.h" -#if COMPILE_GPU using namespace cv; using namespace std; +#ifdef COMPILE_GPU + namespace alpr { diff --git a/src/openalpr/detection/detectorcuda.h b/src/openalpr/detection/detectorcuda.h index 4890f98..4eeefaa 100644 --- a/src/openalpr/detection/detectorcuda.h +++ b/src/openalpr/detection/detectorcuda.h @@ -20,7 +20,6 @@ #ifndef OPENALPR_DETECTORCUDA_H #define OPENALPR_DETECTORCUDA_H -#if COMPILE_GPU #include #include @@ -33,6 +32,10 @@ #include "opencv2/gpu/gpu.hpp" #include "detector.h" +#include "detectorcpu.h" + + +#ifdef COMPILE_GPU namespace alpr { diff --git a/src/openalpr/detection/detectorfactory.cpp b/src/openalpr/detection/detectorfactory.cpp index cab0427..d8c1f0f 100644 --- a/src/openalpr/detection/detectorfactory.cpp +++ b/src/openalpr/detection/detectorfactory.cpp @@ -11,12 +11,13 @@ namespace alpr } else if (config->gpu_mode == 1) { - #if COMPILE_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 } }