我从最新源(2014.09.22)编译了OpenCV 3.0.0
我试图使用opencv_contrib/modules/xfeatures2d/samples/surf_matcher.cpp
但没有成功。
我的代码:
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;
控制台:
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
仅供参考,这里是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
操作系统:WINDOWS 7 64位
VisualStudio Express 2013,目标是Win32,调试模式