changed all WITH_NONFREE to RTABMAP_NONFREE == 1

This commit is contained in:
Mathieu Labbe
2014-11-28 15:45:00 -05:00
parent a1301eeaab
commit e62b1e2769
4 changed files with 11 additions and 15 deletions

View File

@@ -132,7 +132,6 @@ ENDIF(APPLE)
####### DEPENDENCIES ####### ####### DEPENDENCIES #######
FIND_PACKAGE(OpenCV REQUIRED) FIND_PACKAGE(OpenCV REQUIRED)
IF(OPENCV_NONFREE_FOUND) IF(OPENCV_NONFREE_FOUND)
ADD_DEFINITIONS(-DWITH_NONFREE)
SET(NONFREE 1) SET(NONFREE 1)
ELSE() ELSE()
SET(NONFREE 0) SET(NONFREE 0)

View File

@@ -37,7 +37,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <opencv2/gpu/gpu.hpp> #include <opencv2/gpu/gpu.hpp>
#include <opencv2/core/version.hpp> #include <opencv2/core/version.hpp>
#ifdef WITH_NONFREE #if RTABMAP_NONFREE == 1
#if CV_MAJOR_VERSION > 2 || (CV_MAJOR_VERSION >=2 && CV_MINOR_VERSION >=4) #if CV_MAJOR_VERSION > 2 || (CV_MAJOR_VERSION >=2 && CV_MINOR_VERSION >=4)
#include <opencv2/nonfree/gpu.hpp> #include <opencv2/nonfree/gpu.hpp>
#include <opencv2/nonfree/features2d.hpp> #include <opencv2/nonfree/features2d.hpp>
@@ -354,7 +354,7 @@ Feature2D * Feature2D::create(Feature2D::Type & type, const ParametersMap & para
case Feature2D::kFeatureBrisk: case Feature2D::kFeatureBrisk:
feature2D = new BRISK(parameters); feature2D = new BRISK(parameters);
break; break;
#ifdef WITH_NONFREE #if RTABMAP_NONFREE == 1
default: default:
feature2D = new SURF(parameters); feature2D = new SURF(parameters);
type = Feature2D::kFeatureSurf; type = Feature2D::kFeatureSurf;
@@ -433,7 +433,7 @@ SURF::SURF(const ParametersMap & parameters) :
SURF::~SURF() SURF::~SURF()
{ {
#ifdef WITH_NONFREE #if RTABMAP_NONFREE == 1
if(_surf) if(_surf)
{ {
delete _surf; delete _surf;
@@ -455,7 +455,7 @@ void SURF::parseParameters(const ParametersMap & parameters)
Parameters::parse(parameters, Parameters::kSURFGpuKeypointsRatio(), gpuKeypointsRatio_); Parameters::parse(parameters, Parameters::kSURFGpuKeypointsRatio(), gpuKeypointsRatio_);
Parameters::parse(parameters, Parameters::kSURFGpuVersion(), gpuVersion_); Parameters::parse(parameters, Parameters::kSURFGpuVersion(), gpuVersion_);
#ifdef WITH_NONFREE #if RTABMAP_NONFREE == 1
if(_gpuSurf) if(_gpuSurf)
{ {
delete _gpuSurf; delete _gpuSurf;
@@ -490,7 +490,7 @@ std::vector<cv::KeyPoint> SURF::generateKeypointsImpl(const cv::Mat & image, con
UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U); UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
std::vector<cv::KeyPoint> keypoints; std::vector<cv::KeyPoint> keypoints;
#ifdef WITH_NONFREE #if RTABMAP_NONFREE == 1
cv::Mat imgRoi(image, roi); cv::Mat imgRoi(image, roi);
if(_gpuSurf) if(_gpuSurf)
{ {
@@ -511,7 +511,7 @@ cv::Mat SURF::generateDescriptorsImpl(const cv::Mat & image, std::vector<cv::Key
{ {
UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U); UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
cv::Mat descriptors; cv::Mat descriptors;
#ifdef WITH_NONFREE #if RTABMAP_NONFREE == 1
if(_gpuSurf) if(_gpuSurf)
{ {
cv::gpu::GpuMat imgGpu(image); cv::gpu::GpuMat imgGpu(image);
@@ -555,7 +555,7 @@ SIFT::SIFT(const ParametersMap & parameters) :
SIFT::~SIFT() SIFT::~SIFT()
{ {
#ifdef WITH_NONFREE #if RTABMAP_NONFREE == 1
if(_sift) if(_sift)
{ {
delete _sift; delete _sift;
@@ -573,7 +573,7 @@ void SIFT::parseParameters(const ParametersMap & parameters)
Parameters::parse(parameters, Parameters::kSIFTNOctaveLayers(), nOctaveLayers_); Parameters::parse(parameters, Parameters::kSIFTNOctaveLayers(), nOctaveLayers_);
Parameters::parse(parameters, Parameters::kSIFTSigma(), sigma_); Parameters::parse(parameters, Parameters::kSIFTSigma(), sigma_);
#ifdef WITH_NONFREE #if RTABMAP_NONFREE == 1
if(_sift) if(_sift)
{ {
delete _sift; delete _sift;
@@ -590,7 +590,7 @@ std::vector<cv::KeyPoint> SIFT::generateKeypointsImpl(const cv::Mat & image, con
{ {
UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U); UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
std::vector<cv::KeyPoint> keypoints; std::vector<cv::KeyPoint> keypoints;
#ifdef WITH_NONFREE #if RTABMAP_NONFREE == 1
cv::Mat imgRoi(image, roi); cv::Mat imgRoi(image, roi);
_sift->detect(imgRoi, keypoints); // Opencv keypoints _sift->detect(imgRoi, keypoints); // Opencv keypoints
#else #else
@@ -603,7 +603,7 @@ cv::Mat SIFT::generateDescriptorsImpl(const cv::Mat & image, std::vector<cv::Key
{ {
UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U); UASSERT(!image.empty() && image.channels() == 1 && image.depth() == CV_8U);
cv::Mat descriptors; cv::Mat descriptors;
#ifdef WITH_NONFREE #if RTABMAP_NONFREE == 1
_sift->compute(image, keypoints, descriptors); _sift->compute(image, keypoints, descriptors);
#else #else
UERROR("RTAB-Map is not built with OpenCV nonfree module so SIFT cannot be used!"); UERROR("RTAB-Map is not built with OpenCV nonfree module so SIFT cannot be used!");

View File

@@ -41,9 +41,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <pcl/ModelCoefficients.h> #include <pcl/ModelCoefficients.h>
#include <pcl/segmentation/sac_segmentation.h> #include <pcl/segmentation/sac_segmentation.h>
#ifdef WITH_NONFREE
#include <opencv2/nonfree/features2d.hpp>
#endif
#include <opencv2/calib3d/calib3d.hpp> #include <opencv2/calib3d/calib3d.hpp>
#include <opencv2/video/tracking.hpp> #include <opencv2/video/tracking.hpp>
#include <rtabmap/core/VWDictionary.h> #include <rtabmap/core/VWDictionary.h>

View File

@@ -43,7 +43,7 @@ AboutDialog::AboutDialog(QWidget * parent) :
version.append(" [DEMO]"); version.append(" [DEMO]");
#endif #endif
QString cv_version = CV_VERSION; QString cv_version = CV_VERSION;
#if WITH_NONFREE #if RTABMAP_NONFREE == 1
cv_version.append(" [With nonfree]"); cv_version.append(" [With nonfree]");
#else #else
cv_version.append(" [Without nonfree]"); cv_version.append(" [Without nonfree]");