Skip to content

Commit 28b6aef

Browse files
committed
make xfeatures2d optional
1 parent 35c26c4 commit 28b6aef

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

M3T/CMakeLists.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ project(M3T)
1010
option(USE_AZURE_KINECT "Use Azure Kinect" ON)
1111
option(USE_REALSENSE "Use RealSense D435" ON)
1212
option(USE_GTEST "Use gtest" ON)
13+
option(USE_XFEATURES2D "Use OpenCV xfeatures2d" OFF)
1314

1415

1516
# Libraries
@@ -32,7 +33,14 @@ if (UNIX)
3233
endif ()
3334
find_package(OpenGL REQUIRED)
3435
find_package(glfw3 3.1.2 REQUIRED)
35-
find_package(OpenCV 4.3.0 REQUIRED COMPONENTS core imgproc highgui imgcodecs calib3d features2d xfeatures2d OPTIONAL_COMPONENTS cudafeatures2d)
36+
37+
set(OpenCV_COMPONENTS core imgproc highgui imgcodecs calib3d features2d)
38+
if(USE_XFEATURES2D)
39+
add_definitions( -DUSE_XFEATURES2D=TRUE )
40+
set(OpenCV_COMPONENTS ${OpenCV_COMPONENTS} xfeatures2d)
41+
endif()
42+
43+
find_package(OpenCV 4.3.0 REQUIRED COMPONENTS ${OpenCV_COMPONENTS} OPTIONAL_COMPONENTS cudafeatures2d)
3644

3745
if (USE_AZURE_KINECT)
3846
find_package(k4a 1.3.0 REQUIRED)
@@ -122,7 +130,7 @@ if (USE_REALSENSE)
122130
add_definitions( -DUSE_REALSENSE=TRUE )
123131
endif ()
124132
if(OpenCV_CUDA_VERSION)
125-
add_definitions( -DUSE_CUDA=TRUE )
133+
add_definitions( -DUSE_CUDA=TRUE )
126134
endif ()
127135
if (USE_GTEST)
128136
add_definitions( -DUSE_GTEST=TRUE )

M3T/include/m3t/texture_modality.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
#include <deque>
2424
#include <opencv2/features2d.hpp>
2525
#include <opencv2/opencv.hpp>
26+
#ifdef USE_XFEATURES2D
2627
#include <opencv2/xfeatures2d.hpp>
28+
#endif
2729
#include <string>
2830
#include <vector>
2931

M3T/src/texture_modality.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,7 @@ void TextureModality::SetUpFeatureDetectorAndMatcher() {
745745
feature_descriptor_ = cv::BRISK::create(brisk_threshold_, brisk_octave_,
746746
brisk_pattern_scale_);
747747
break;
748+
#ifdef USE_XFEATURES2D
748749
case DescriptorType::DAISY:
749750
feature_detector_ =
750751
cv::ORB::create(orb_n_features_, orb_scale_factor_, orb_n_levels_);
@@ -769,6 +770,7 @@ void TextureModality::SetUpFeatureDetectorAndMatcher() {
769770
sift_n_features_, sift_n_octave_layers_, sift_contrast_threshold_,
770771
sift_edge_threshold_, sift_sigma_);
771772
break;
773+
#endif
772774
#ifdef USE_CUDA
773775
case DescriptorType::ORB_CUDA:
774776
feature_detector_orb_cuda_ = cv::cuda::ORB::create(

0 commit comments

Comments
 (0)