Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/introlab/find-object
Browse files Browse the repository at this point in the history
  • Loading branch information
matlabbe committed May 27, 2020
2 parents 5cdda41 + f32bee7 commit d0b456f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 16 deletions.
22 changes: 16 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ ADD_DEFINITIONS(-DPROJECT_NAME="${PROJECT_NAME}")
####### DEPENDENCIES #######
FIND_PACKAGE(OpenCV REQUIRED) # tested on 2.3.1

# check if version status is "-dev" (SIFT compatibility issue between 4.3.0 vs 4.3.0-dev)
FIND_FILE(OpenCV_VERSION_HPP opencv2/core/version.hpp
PATHS ${OpenCV_INCLUDE_DIRS}
NO_DEFAULT_PATH)
FILE(READ ${OpenCV_VERSION_HPP} TMPTXT)
STRING(FIND "${TMPTXT}" "-dev" matchres)
IF(NOT ${matchres} EQUAL -1)
add_definitions(-DOPENCV_DEV)
ENDIF(NOT ${matchres} EQUAL -1)

# For SuperPoint
SET(TORCH 0)
FIND_PACKAGE(Torch QUIET)
Expand Down Expand Up @@ -289,21 +299,21 @@ IF(NOT CATKIN_BUILD)
ENDIF()
ELSE()
IF(OPENCV_XFEATURES2D_FOUND)
MESSAGE(STATUS " With OpenCV ${OpenCV_VERSION_MAJOR} xfeatures2d module (BRIEF/FREAK/KAZE) = YES")
MESSAGE(STATUS " With OpenCV ${OpenCV_VERSION} xfeatures2d module (BRIEF/FREAK/KAZE) = YES")
ELSE()
MESSAGE(STATUS " With OpenCV ${OpenCV_VERSION_MAJOR} xfeatures2d module (BRIEF/FREAK/KAZE) = NO (not found)")
MESSAGE(STATUS " With OpenCV ${OpenCV_VERSION} xfeatures2d module (BRIEF/FREAK/KAZE) = NO (not found)")
ENDIF()
IF(OpenCV_VERSION VERSION_GREATER "4.2.0")
IF(NONFREE)
MESSAGE(STATUS " With OpenCV ${OpenCV_VERSION_MAJOR} nonfree module (SURF) = YES")
MESSAGE(STATUS " With OpenCV ${OpenCV_VERSION} nonfree module (SURF) = YES")
ELSE()
MESSAGE(STATUS " With OpenCV ${OpenCV_VERSION_MAJOR} nonfree module (SURF) = NO")
MESSAGE(STATUS " With OpenCV ${OpenCV_VERSION} nonfree module (SURF) = NO")
ENDIF()
ELSEIF()
IF(NONFREE)
MESSAGE(STATUS " With OpenCV ${OpenCV_VERSION_MAJOR} nonfree module (SIFT/SURF) = YES")
MESSAGE(STATUS " With OpenCV ${OpenCV_VERSION} nonfree module (SIFT/SURF) = YES")
ELSE()
MESSAGE(STATUS " With OpenCV ${OpenCV_VERSION_MAJOR} nonfree module (SIFT/SURF) = NO")
MESSAGE(STATUS " With OpenCV ${OpenCV_VERSION} nonfree module (SIFT/SURF) = NO")
ENDIF()
ENDIF()
ENDIF()
Expand Down
4 changes: 2 additions & 2 deletions src/ParametersToolBox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ void ParametersToolBox::addParameter(QVBoxLayout * layout,
if(key.compare(Settings::kFeature2D_1Detector()) == 0)
{
#if FINDOBJECT_NONFREE == 0
#if CV_MAJOR_VERSION < 4 || (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION < 3) // <4.3.0
#if CV_MAJOR_VERSION < 4 || (CV_MAJOR_VERSION == 4 && (CV_MINOR_VERSION < 3 || (CV_MINOR_VERSION==3 && !defined(OPENCV_DEV))))
widget->setItemData(5, 0, Qt::UserRole - 1); // disable SIFT
#endif
widget->setItemData(7, 0, Qt::UserRole - 1); // disable SURF
Expand All @@ -368,7 +368,7 @@ void ParametersToolBox::addParameter(QVBoxLayout * layout,
if(key.compare(Settings::kFeature2D_2Descriptor()) == 0)
{
#if FINDOBJECT_NONFREE == 0
#if CV_MAJOR_VERSION < 4 || (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION < 3) // <4.3.0
#if CV_MAJOR_VERSION < 4 || (CV_MAJOR_VERSION == 4 && (CV_MINOR_VERSION < 3 || (CV_MINOR_VERSION==3 && !defined(OPENCV_DEV))))
widget->setItemData(2, 0, Qt::UserRole - 1); // disable SIFT
#endif
widget->setItemData(3, 0, Qt::UserRole - 1); // disable SURF
Expand Down
16 changes: 8 additions & 8 deletions src/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ ParametersMap Settings::loadSettings(const QString & fileName)
int index = str.split(':').first().toInt();
if(key.compare(Settings::kFeature2D_1Detector()) == 0)
{
#if CV_MAJOR_VERSION < 4 || (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION < 3)
#if CV_MAJOR_VERSION < 4 || (CV_MAJOR_VERSION == 4 && (CV_MINOR_VERSION < 3 || (CV_MINOR_VERSION==3 && !defined(OPENCV_DEV))))
#if FINDOBJECT_NONFREE == 0
if(index == 5 || index == 7)
{
Expand Down Expand Up @@ -171,7 +171,7 @@ ParametersMap Settings::loadSettings(const QString & fileName)
}
else if(key.compare(Settings::kFeature2D_2Descriptor()) == 0)
{
#if CV_MAJOR_VERSION < 4 || (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION < 3)
#if CV_MAJOR_VERSION < 4 || (CV_MAJOR_VERSION == 4 && (CV_MINOR_VERSION < 3 || (CV_MINOR_VERSION==3 && !defined(OPENCV_DEV))))
#if FINDOBJECT_NONFREE == 0
if(index == 2 || index == 3)
{
Expand Down Expand Up @@ -711,7 +711,7 @@ Feature2D * Settings::createKeypointDetector()
{

//check for nonfree stuff
#if CV_MAJOR_VERSION < 4 || (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION < 3)
#if CV_MAJOR_VERSION < 4 || (CV_MAJOR_VERSION == 4 && (CV_MINOR_VERSION < 3 || (CV_MINOR_VERSION==3 && !defined(OPENCV_DEV))))
#if FINDOBJECT_NONFREE == 0
if(strategies.at(index).compare("SIFT") == 0 ||
strategies.at(index).compare("SURF") == 0)
Expand Down Expand Up @@ -997,7 +997,7 @@ Feature2D * Settings::createKeypointDetector()
#endif
UDEBUG("type=%s", strategies.at(index).toStdString().c_str());
}
#if CV_MAJOR_VERSION < 4 || (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION < 3) // <4.3.0
#if CV_MAJOR_VERSION < 4 || (CV_MAJOR_VERSION == 4 && (CV_MINOR_VERSION < 3 || (CV_MINOR_VERSION==3 && !defined(OPENCV_DEV))))
#if FINDOBJECT_NONFREE == 1
else if(strategies.at(index).compare("SIFT") == 0)
{
Expand Down Expand Up @@ -1052,7 +1052,7 @@ Feature2D * Settings::createKeypointDetector()
}
}
#endif
#else // >= 4.3.0
#else // >= 4.3.0-dev
else if(strategies.at(index).compare("SIFT") == 0)
{
feature2D = new Feature2D(cv::SIFT::create(
Expand Down Expand Up @@ -1126,7 +1126,7 @@ Feature2D * Settings::createDescriptorExtractor()
{

//check for nonfree stuff
#if CV_MAJOR_VERSION < 4 || (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION < 3)
#if CV_MAJOR_VERSION < 4 || (CV_MAJOR_VERSION == 4 && (CV_MINOR_VERSION < 3 || (CV_MINOR_VERSION==3 && !defined(OPENCV_DEV))))
#if FINDOBJECT_NONFREE == 0
if(strategies.at(index).compare("SIFT") == 0 ||
strategies.at(index).compare("SURF") == 0)
Expand Down Expand Up @@ -1352,7 +1352,7 @@ Feature2D * Settings::createDescriptorExtractor()
UDEBUG("type=%s", strategies.at(index).toStdString().c_str());
}
#endif
#if CV_MAJOR_VERSION < 4 || (CV_MAJOR_VERSION == 4 && CV_MINOR_VERSION < 3) // <4.3.0
#if CV_MAJOR_VERSION < 4 || (CV_MAJOR_VERSION == 4 && (CV_MINOR_VERSION < 3 || (CV_MINOR_VERSION==3 && !defined(OPENCV_DEV))))
#if FINDOBJECT_NONFREE == 1
else if(strategies.at(index).compare("SIFT") == 0)
{
Expand Down Expand Up @@ -1407,7 +1407,7 @@ Feature2D * Settings::createDescriptorExtractor()
}
}
#endif
#else // >= 4.3.0
#else // >= 4.3.0-dev
else if(strategies.at(index).compare("SIFT") == 0)
{
feature2D = new Feature2D(cv::SIFT::create(
Expand Down

0 comments on commit d0b456f

Please sign in to comment.