Fixed build with OpenCV4+CUDA10 (#334)

This commit is contained in:
matlabbe
2019-01-28 19:28:24 -05:00
parent 76ef2c4b0e
commit f8b7421b59
3 changed files with 7 additions and 4 deletions

View File

@@ -900,9 +900,9 @@ IF(OpenCV_FOUND)
ENDIF() ENDIF()
ELSE() ELSE()
IF(OPENCV_XFEATURES2D_FOUND) IF(OPENCV_XFEATURES2D_FOUND)
MESSAGE(STATUS " *With OpenCV 3 xfeatures2d module (SIFT/SURF/BRIEF/FREAK) = YES (License: Non commercial)") MESSAGE(STATUS " *With OpenCV ${OpenCV_VERSION_MAJOR} xfeatures2d module (SIFT/SURF/BRIEF/FREAK) = YES (License: Non commercial)")
ELSE() ELSE()
MESSAGE(STATUS " *With OpenCV 3 xfeatures2d module (SIFT/SURF/BRIEF/FREAK) = NO (not found, License: BSD)") MESSAGE(STATUS " *With OpenCV ${OpenCV_VERSION_MAJOR} xfeatures2d module (SIFT/SURF/BRIEF/FREAK) = NO (not found, License: BSD)")
ENDIF() ENDIF()
ENDIF() ENDIF()
ENDIF(OpenCV_FOUND) ENDIF(OpenCV_FOUND)

View File

@@ -1082,17 +1082,19 @@ std::vector<int> VWDictionary::findNN(const cv::Mat & queryIn) const
#ifdef HAVE_OPENCV_CUDAFEATURES2D #ifdef HAVE_OPENCV_CUDAFEATURES2D
cv::cuda::GpuMat newDescriptorsGpu(query); cv::cuda::GpuMat newDescriptorsGpu(query);
cv::cuda::GpuMat lastDescriptorsGpu(_dataTree); cv::cuda::GpuMat lastDescriptorsGpu(_dataTree);
cv::cuda::GpuMat matchesGpu;
cv::Ptr<cv::cuda::DescriptorMatcher> gpuMatcher; cv::Ptr<cv::cuda::DescriptorMatcher> gpuMatcher;
if(query.type()==CV_8U) if(query.type()==CV_8U)
{ {
gpuMatcher = cv::cuda::DescriptorMatcher::createBFMatcher(cv::NORM_HAMMING); gpuMatcher = cv::cuda::DescriptorMatcher::createBFMatcher(cv::NORM_HAMMING);
gpuMatcher->knnMatchAsync(newDescriptorsGpu, lastDescriptorsGpu, matches, k); gpuMatcher->knnMatchAsync(newDescriptorsGpu, lastDescriptorsGpu, matchesGpu, k);
} }
else else
{ {
gpuMatcher = cv::cuda::DescriptorMatcher::createBFMatcher(cv::NORM_L2); gpuMatcher = cv::cuda::DescriptorMatcher::createBFMatcher(cv::NORM_L2);
gpuMatcher->knnMatchAsync(newDescriptorsGpu, lastDescriptorsGpu, matches, k); gpuMatcher->knnMatchAsync(newDescriptorsGpu, lastDescriptorsGpu, matchesGpu, k);
} }
gpuMatcher->knnMatchConvert(matchesGpu, matches);
#else #else
UERROR("Cannot use brute Force GPU because OpenCV is not built with cuda module."); UERROR("Cannot use brute Force GPU because OpenCV is not built with cuda module.");
#endif #endif

View File

@@ -34,6 +34,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <rtabmap/utilite/UTimer.h> #include <rtabmap/utilite/UTimer.h>
#include <rtabmap/utilite/UThreadC.h> #include <rtabmap/utilite/UThreadC.h>
#include <rtabmap/utilite/UConversion.h> #include <rtabmap/utilite/UConversion.h>
#include <opencv2/videoio/videoio_c.h>
namespace rtabmap namespace rtabmap