Skip to content

Commit

Permalink
make xfeatures2d optional
Browse files Browse the repository at this point in the history
  • Loading branch information
nim65s committed May 15, 2024
1 parent 35c26c4 commit 75433c9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
12 changes: 10 additions & 2 deletions M3T/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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 )
Expand Down
2 changes: 2 additions & 0 deletions M3T/include/m3t/texture_modality.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
#include <deque>
#include <opencv2/features2d.hpp>
#include <opencv2/opencv.hpp>
#ifdef USE_XFEATURES2D
#include <opencv2/xfeatures2d.hpp>
#endif
#include <string>
#include <vector>

Expand Down
2 changes: 2 additions & 0 deletions M3T/src/texture_modality.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_);
Expand All @@ -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(
Expand Down

0 comments on commit 75433c9

Please sign in to comment.