diff --git a/M3T/CMakeLists.txt b/M3T/CMakeLists.txt index db9f86b..7f0bda4 100644 --- a/M3T/CMakeLists.txt +++ b/M3T/CMakeLists.txt @@ -10,6 +10,7 @@ project(M3T) option(USE_AZURE_KINECT "Use Azure Kinect" ON) option(USE_REALSENSE "Use RealSense D435" ON) option(USE_GTEST "Use gtest" ON) +option(USE_XFEATURES2D "Use OpenCV xfeatures2d" OFF) # Libraries @@ -32,7 +33,14 @@ if (UNIX) endif () find_package(OpenGL REQUIRED) find_package(glfw3 3.1.2 REQUIRED) -find_package(OpenCV 4.3.0 REQUIRED COMPONENTS core imgproc highgui imgcodecs calib3d features2d xfeatures2d OPTIONAL_COMPONENTS cudafeatures2d) + +set(OpenCV_COMPONENTS core imgproc highgui imgcodecs calib3d features2d xfeatures2d) +if(USE_XFEATURES2D) + add_definitions( -DUSE_XFEATURES2D=TRUE ) + set(OpenCV_COMPONENTS ${OpenCV_COMPONENTS} xfeatures2d) +endif() + +find_package(OpenCV 4.3.0 REQUIRED COMPONENTS ${OpenCV_COMPONENTS} OPTIONAL_COMPONENTS cudafeatures2d) if (USE_AZURE_KINECT) find_package(k4a 1.3.0 REQUIRED) @@ -122,7 +130,7 @@ if (USE_REALSENSE) add_definitions( -DUSE_REALSENSE=TRUE ) endif () if(OpenCV_CUDA_VERSION) - add_definitions( -DUSE_CUDA=TRUE ) + add_definitions( -DUSE_CUDA=TRUE ) endif () if (USE_GTEST) add_definitions( -DUSE_GTEST=TRUE ) diff --git a/M3T/include/m3t/texture_modality.h b/M3T/include/m3t/texture_modality.h index e0720bc..b4fe8f1 100644 --- a/M3T/include/m3t/texture_modality.h +++ b/M3T/include/m3t/texture_modality.h @@ -23,7 +23,9 @@ #include #include #include +#ifdef USE_XFEATURES2D #include +#endif #include #include diff --git a/M3T/src/texture_modality.cpp b/M3T/src/texture_modality.cpp index 922a814..9ce1618 100644 --- a/M3T/src/texture_modality.cpp +++ b/M3T/src/texture_modality.cpp @@ -745,6 +745,7 @@ void TextureModality::SetUpFeatureDetectorAndMatcher() { feature_descriptor_ = cv::BRISK::create(brisk_threshold_, brisk_octave_, brisk_pattern_scale_); break; +#ifdef USE_XFEATURES2D case DescriptorType::DAISY: feature_detector_ = cv::ORB::create(orb_n_features_, orb_scale_factor_, orb_n_levels_); @@ -769,6 +770,7 @@ void TextureModality::SetUpFeatureDetectorAndMatcher() { sift_n_features_, sift_n_octave_layers_, sift_contrast_threshold_, sift_edge_threshold_, sift_sigma_); break; +#endif #ifdef USE_CUDA case DescriptorType::ORB_CUDA: feature_detector_orb_cuda_ = cv::cuda::ORB::create(