OpenCV3.0 with cuda run time error: getGpuMat is available only for cuda::GpuMat

asked 2015-11-19 15:42:55 -0600

updated 2015-11-20 02:21:36 -0600

thdrksdfthmn gravatar image

This is my first time to run OpenCV3.0 with CUDA. The thing is if I run the sample code in the opencv source folder (e.g. test_features2d.cpp), I can get results from CUDA function. However, if I create a standalone program and used CUDA code, it issues run time error (it does not have compiler error): (I DID USE GPUMAT !!)

OpenCV Error: The function/feature is not implemented (getGpuMat is available only for center code hereuda::GpuMat and cuda::HostMem) in getGpuMat, file /home/lixx2938/opencv-3.0.0/modules/core/src/matrix.cpp, line 1433 terminate called after throwing an instance of 'cv::Exception'
what(): /home/lixx2938/opencv-3.0.0/modules/core/src/matrix.cpp:1433: error: (-213) getGpuMat is available only for cuda::GpuMat and cuda::HostMem in function getGpuMat

Here is my trivial partial part of main function:

cv::Ptr<cv::cuda::ORB> orb = cv::cuda::ORB::create(200, 1.2, 4, 31, 0, 2, ORB::HARRIS_SCORE, 31, 20, true);
cv::Ptr<cv::cuda::FastFeatureDetector> fast = cv::cuda::FastFeatureDetector::create(threshold, nonmaxSuppression);
std::vector<cv::KeyPoint> fastkeypoints;
fast->detect(image, fastkeypoints);
std::vector<cv::KeyPoint> keypoints_cuda;
cv::cuda::GpuMat descriptors_cuda;
orb->detectAndCompute(image, noArray(), keypoints_cuda, descriptors2_gpu);

Here is my cmake file

cmake_minimum_required(VERSION 2.8)
project( test )
find_package( OpenCV REQUIRED )
add_executable( test test.cpp )
target_link_libraries( test ${OpenCV_LIBS} )

Does anyone know what I should do to run the opencv code with CUDA?

Thank you

edit retag flag offensive close merge delete