I have compiled OpenCV 3.0.0 from latest source (2014.09.22)
I'm trying to use opencv_contrib/modules/xfeatures2d/samples/surf_matcher.cpp
without success.
My code:
int surf() {
cv::cuda::printShortCudaDeviceInfo( cv::cuda::getDevice( ) );
cv::cuda::SURF_CUDA surf;
std::cerr << "- 1 -" << std::endl;
cv::cuda::GpuMat img1, keypoints1GPU, descriptors1GPU;
std::cerr << "- 2 -" << std::endl;
cv::Mat im1( imread( "shapes.jpg", cv::IMREAD_GRAYSCALE ));
std::cerr << "- 3 - load(): " << ( im1.data ? "OK" : "failed" ) << std::endl;
img1.upload( im1 );
std::cerr << "- 4 -" << std::endl;
surf( img1, cv::cuda::GpuMat(), keypoints1GPU, descriptors1GPU );
std::cerr << "- 5 -" << std::endl;
The console:
Device 0: "GeForce 8600 GT" 256Mb, sm_11 (not Fermi), 32 cores,
Driver/Runtime ver.6.50/6.50
- 1 -
- 2 -
- 3 - load(): OK
- 4 -
OpenCV Error: Gpu API call (too many resources requested for launch) in
cv::cuda::device::surf::compute_descriptors_gpu,
file D:/opencv_contrib/modules/xfeatures2d/src/cuda/surf.cu, line 947
D:/opencv_contrib/modules/xfeatures2d/src/cuda/surf.cu:947: error: (-217)
too many resources requested for launch in function
cv::cuda::device::surf::compute_descriptors_gpu
FYI here is the code of surf.cu
:
void compute_descriptors_gpu(
PtrStepSz<float4> descriptors,
const float * featureX,
const float * featureY,
const float * featureSize,
const float * featureDir,
int nFeatures )
{
if( descriptors.cols == 64 ) {
...
}
else {
compute_descriptors_128<<<nFeatures, dim3(32, 16)>>>(
descriptors, featureX, featureY, featureSize, featureDir );
cudaSafeCall( cudaGetLastError()); <<<<<<<<<<<<<<<<<<<<< line 947
OS: WINDOWS 7 64 bit
VisualStudio Express 2013, target Win32, debug mode