我对cuda很开心 . 我使用opencv2.4.6和CUDA4.2 . 我已成功用cuda编译opencv . 当我使用代码时:
int cuda_count;
cudaError_t error = cudaGetDeviceCount( &cuda_count );
它返回 cudaSuccess
和 cuda_count=1
但是,当我使用代码时:
int num_devices = cv::gpu::getCudaEnabledDeviceCount();
num_devices returns 0
为什么?
我的完整代码是:
int main()
{
int num_devices = cv::gpu::getCudaEnabledDeviceCount();
int cuda_count;
cudaError_t error = cudaGetDeviceCount( &cuda_count );
if(num_devices <=0 )
{
std::cerr << "no" << std::endl;
return -1;
}
int enable_devivce_id = -1;
}
1 回答
您必须在没有CUDA支持的情况下编译OpenCV