2
我是一個新鮮的與cuda opencv。 我使用opencv2.4.6和CUDA4.2。 我成功地用cuda編譯opencv。 當我使用的代碼:OPENCV CUDA - getCudaEnabledDeviceCount返回0
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;
}
但是當我調試例如 「opencv_test_gpu」 的CV :: GPU :: getCudaEnabledDeviceCount()返回1;我真的很困惑。想! – user2873972