opencv2.4.13 getcudaenableddevice admin enabledcount函数怎么调用

Ask Your Question
I use cuda. cudaError_t error = cudaGetDeviceCount(&count);
count is 1 and getCudaEnabledDeviceCount() returns 0 and I do not understand why... Is it linked to HAVE_CUDA?
I have build OpenCV with CMake WITH_CUDA checked. //cuda_info.cpp
int cv::cuda::getCudaEnabledDeviceCount()
#ifndef HAVE_CUDA
cudaError_t error = cudaGetDeviceCount(&count);
if (error == cudaErrorInsufficientDriver)
return -1;
if (error == cudaErrorNoDevice)
cudaSafeCall( error );
Login/Signup to Answer
Question Tools
1 follower
Seen: 475 times
Last updated: Jul 08 '15
Related questions
Please note: OpenCV answers requires javascript to work properly, please enable javascript in your browser,64位Windows 7上配置支持GPU版(CUDA7.5)的OpenCV2.4.13过程详解_Linux教程_Linux公社-Linux系统门户网站
你好,游客
64位Windows 7上配置支持GPU版(CUDA7.5)的OpenCV2.4.13过程详解
来源:Linux社区&
作者:fengbingchun
32位Windows 7 上配置过GPU版的OpenCV可参考
64位Windows7下CUDA7.5的配置可以参考:这里是在CUDA7.5已正确安装后的操作步骤:
1.& & & 从下载opencv-2.4.13.exe,并解压缩;
2.& & & 打开cmake-gui:如图
(1)、勾选:CUDA_FAST_MATH、WITH_CUBLAS、WITH_CUDA、WITH_CUFFT、WITH_NVCUVID
(2)、指定CUDA正确路径:CUDA_TOOLKIT_ROOT_DIR:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v7.5;CUDA_GENERATION: Auto
(3)、如果想缩短编译的时间:可以去掉BUILD_EXAMPLES的勾选;对CUDA_ARCH_BIN的值进行设置,默认会有2.0 /2.1(2.0)/3.0/3.5,只设置其中一个;
(4)、依次点击Configure和Generate按钮,会在D:\soft\OpenCV2.4.13\vs2013_cuda_dll目录下生成OpenCV.sln工程,如下图:
3.& & & 打开OpenCV.sln工程:
(1)、分别在Release和Debug下,选中工程解决方案&OpenCV&,点击重新生成解决方案;
(2)、在编译过程中会弹出对话框(检测到文件修改),如下图,点击全部重新加载;
(3)、编译完后,依次点击CMakeTargets,INSTALL,生成
(4)、将D:\soft\OpenCV2.4.13\vs2013_cuda_dll\install\x64\vc12\bin添加到系统环境变量中,重启系统;
4.& & & 新建一个控制台工程,验证GPU版OpenCV库的正确性,测试代码如下:
#include &iostream&#include &string&#include &opencv2/opencv.hpp&#include &opencv2/gpu/gpu.hpp&
int main(){&int device_num = cv::gpu::getCudaEnabledDeviceCount();&fprintf(stdout, "device count: %d\n", device_num);
&std::string image_name = "D:/soft/OpenCV2.4.13/opencv/sources/doc/tutorials/introduction/clojure_dev_intro/images/lena.png";&cv::Mat mat = cv::imread(image_name, 1);&if (!mat.data) {& fprintf(stderr, "read image fail\n");& return -1;&}
&cv::gpu::GpuMat src(mat);&int width = src.&int height = src.&int channels = src.channels();&fprintf(stdout, "image width: %d, height: %d, channels: %d\n", width, height, channels);
&cv::gpu::GpuM&cv::gpu::resize(src, dst, cv::Size(300, 400), 0.0, 0.0, 1);
&cv::Mat mat2(dst);&cv::imwrite("resize.jpg", mat2);
&return 0;}
执行结果如下,一切正常:
14.04 安装配置CUDA&
Ubuntu 12.04配置NVIDIA CUDA5.5实录&
Ubuntu安装Theano+CUDA&
关于Ubuntu 12.04 下 CUDA5.5 的安装请参看如下链接
Caffe配置简明教程 ( Ubuntu 14.04 / CUDA 7.5 / cuDNN 5.1 / OpenCV 3.1 )
在Ubuntu 14.04上配置CUDA+Caffe+cuDNN+Anaconda+DIGITS&
本文永久更新链接地址:
相关资讯 & & &
& (01月12日)
& (12/27/:04)
& (03月12日)
& (12/31/:28)
& (12/15/:37)
   同意评论声明
   发表
尊重网上道德,遵守中华人民共和国的各项有关法律法规
承担一切因您的行为而直接或间接导致的民事或刑事法律责任
本站管理人员有权保留或删除其管辖留言中的任意内容
本站有权在网站内转载或引用您的评论
参与本评论即表明您已经阅读并接受上述条款cv::gpu:getCudaEnabledDevice() it returns me zero (opencv 2.4.3)
13 messages
Open this post in threaded view
Report Content as Inappropriate
cv::gpu:getCudaEnabledDevice() it returns me zero (opencv 2.4.3)
Hi, I have install the last version of OpenCV from .
I try to execute the following program but getCudaEnabledDeviceCount() always returns &0&. I have no idea where is the problem ? Thanks for you help.
& & & & int nb_gpu = cv::gpu::getCudaEnabledDeviceCount();
& & & & cv::gpu::DeviceInfo info = cv::gpu::getDevice();
& & & & std::cout && info.name() && std::
& & & & cv::gpu::GpuM
& & & & //src = cv::imread(baboon, 1);
& & catch (const cv::Exception* ex)
& & & & std::cout && &Error: & && ex-&what() && std::
My configuration is :
- windows 7.
- visual studio 2010.
- openCv 2.4.3
Open this post in threaded view
Report Content as Inappropriate
Re: cv::gpu:getCudaEnabledDevice() it returns me zero (opencv 2.4.3)
Hi, any one use GPU and OpenCV 2.4.3 ?
--- In , &mjboumediene& &ipvoice75@...& wrote:
& Hi, I have install the last version of OpenCV from .
& I try to execute the following program but getCudaEnabledDeviceCount() always returns &0&. I have no idea where is the problem ? Thanks for you help.
int nb_gpu = cv::gpu::getCudaEnabledDeviceCount();
cv::gpu::DeviceInfo info = cv::gpu::getDevice();
& & & & & std::cout && info.name() && std::
& & & & & cv::gpu::GpuM
& & & & & //src = cv::imread(baboon, 1);
& & & catch (const cv::Exception* ex)
& & & & & std::cout && &Error: & && ex-&what() && std::
& My configuration is :
& - windows 7.
& - visual studio 2010.
& - openCv 2.4.3
Open this post in threaded view
Report Content as Inappropriate
Re: cv::gpu:getCudaEnabledDevice() it returns me zero (opencv 2.4.3)
use libraries from &opencv directory&/Build/gpu/vc10/[x86 | x64]
--- In , &mjboumediene& &ipvoice75@...& wrote:
& Hi, any one use GPU and OpenCV 2.4.3 ?
& --- In , &mjboumediene& &ipvoice75@& wrote:
& & Hi, I have install the last version of OpenCV from .
& & I try to execute the following program but getCudaEnabledDeviceCount() always returns &0&. I have no idea where is the problem ? Thanks for you help.
int nb_gpu = cv::gpu::getCudaEnabledDeviceCount();
cv::gpu::DeviceInfo info = cv::gpu::getDevice();
& & & & & & std::cout && info.name() && std::
& & & & & & cv::gpu::GpuM
& & & & & & //src = cv::imread(baboon, 1);
& & & & catch (const cv::Exception* ex)
& & & & & & std::cout && &Error: & && ex-&what() && std::
& & My configuration is :
& & - windows 7.
& & - visual studio 2010.
& & - openCv 2.4.3
Open this post in threaded view
Report Content as Inappropriate
Re: cv::gpu:getCudaEnabledDevice() it returns me zero (opencv 2.4.3)
I use it, I have no error when generating the solution. But getCudaEnabledDevice() return &0& ! why ?
--- In , &vlad.vinogradov& &vlad.vinogradov@...& wrote:
& use libraries from &opencv directory&/Build/gpu/vc10/[x86 | x64]
& --- In , &mjboumediene& &ipvoice75@& wrote:
& & Hi, any one use GPU and OpenCV 2.4.3 ?
& & --- In , &mjboumediene& &ipvoice75@& wrote:
& & & Hi, I have install the last version of OpenCV from .
& & & I try to execute the following program but getCudaEnabledDeviceCount() always returns &0&. I have no idea where is the problem ? Thanks for you help.
& & & & & {
int nb_gpu = cv::gpu::getCudaEnabledDeviceCount();
cv::gpu::DeviceInfo info = cv::gpu::getDevice();
& & & & & & & std::cout && info.name() && std::
& & & & & & & cv::gpu::GpuM
& & & & & & & //src = cv::imread(baboon, 1);
& & & & & }
& & & & & catch (const cv::Exception* ex)
& & & & & {
& & & & & & & std::cout && &Error: & && ex-&what() && std::
& & & & & }
& & & My configuration is :
& & & - windows 7.
& & & - visual studio 2010.
& & & - openCv 2.4.3
Open this post in threaded view
Report Content as Inappropriate
Re: cv::gpu:getCudaEnabledDevice() it returns me zero (opencv 2.4.3)
Hi, any expert on GPU can help me ?
--- In , &mjboumediene& &ipvoice75@...& wrote:
& I use it, I have no error when generating the solution. But getCudaEnabledDevice() return &0& ! why ?
& --- In , &vlad.vinogradov& &vlad.vinogradov@& wrote:
& & use libraries from &opencv directory&/Build/gpu/vc10/[x86 | x64]
& & --- In , &mjboumediene& &ipvoice75@& wrote:
& & & Hi, any one use GPU and OpenCV 2.4.3 ?
& & & --- In , &mjboumediene& &ipvoice75@& wrote:
& & & & Hi, I have install the last version of OpenCV from .
& & & & I try to execute the following program but getCudaEnabledDeviceCount() always returns &0&. I have no idea where is the problem ? Thanks for you help.
& & & & try
& & & & & & {
int nb_gpu = cv::gpu::getCudaEnabledDeviceCount();
cv::gpu::DeviceInfo info = cv::gpu::getDevice();
& & & & & & & & std::cout && info.name() && std::
& & & & & & & & cv::gpu::GpuM
& & & & & & & & //src = cv::imread(baboon, 1);
& & & & & & }
& & & & & & catch (const cv::Exception* ex)
& & & & & & {
& & & & & & & & std::cout && &Error: & && ex-&what() && std::
& & & & & & }
& & & & My configuration is :
& & & & - windows 7.
& & & & - visual studio 2010.
& & & & - openCv 2.4.3
Open this post in threaded view
Report Content as Inappropriate
Re: cv::gpu:getCudaEnabledDevice() it returns me zero (opencv 2.4.3)
I suppose, Windows load wrong dll when your application starts (opencv_gpu.dll from &opencv directory&/Build/vc10/..., not from &opencv directory&/Build/gpu/vc10). Copy dlls from &opencv directory&/Build/gpu/vc10 and place it in your application's folder.
Check PATH enviroment variable, it shouldn't contain any &opencv directory&/Build/* path.
--- In , &mjboumediene& &ipvoice75@...& wrote:
& Hi, any expert on GPU can help me ?
& --- In , &mjboumediene& &ipvoice75@& wrote:
& & I use it, I have no error when generating the solution. But getCudaEnabledDevice() return &0& ! why ?
& & --- In , &vlad.vinogradov& &vlad.vinogradov@& wrote:
& & & use libraries from &opencv directory&/Build/gpu/vc10/[x86 | x64]
& & & --- In , &mjboumediene& &ipvoice75@& wrote:
& & & & Hi, any one use GPU and OpenCV 2.4.3 ?
& & & & --- In , &mjboumediene& &ipvoice75@& wrote:
& & & & & Hi, I have install the last version of OpenCV from .
& & & & & I try to execute the following program but getCudaEnabledDeviceCount() always returns &0&. I have no idea where is the problem ? Thanks for you help.
& & & & & try
& & & & & & & {
int nb_gpu = cv::gpu::getCudaEnabledDeviceCount();
cv::gpu::DeviceInfo info = cv::gpu::getDevice();
& & & & & & & & & std::cout && info.name() && std::
& & & & & & & & & cv::gpu::GpuM
& & & & & & & & & //src = cv::imread(baboon, 1);
& & & & & & & }
& & & & & & & catch (const cv::Exception* ex)
& & & & & & & {
& & & & & & & & & std::cout && &Error: & && ex-&what() && std::
& & & & & & & }
& & & & & My configuration is :
& & & & & - windows 7.
& & & & & - visual studio 2010.
& & & & & - openCv 2.4.3
Open this post in threaded view
Report Content as Inappropriate
Re: cv::gpu:getCudaEnabledDevice() it returns me zero (opencv 2.4.3)
I have installed the CUDA tools 5.0 and not 4.2. Perhaps it's the problem because now I have error : npp32_42_9.dll not found.
Do you have any suggestions to resolve this error ?
Date: Mon, 26 Nov :19 +0000
Subject: [OpenCV] Re: cv::gpu:getCudaEnabledDevice() it returns me zero (opencv 2.4.3)
& & & I suppose, Windows load wrong dll when your application starts (opencv_gpu.dll from &opencv directory&/Build/vc10/..., not from &opencv directory&/Build/gpu/vc10). Copy dlls from &opencv directory&/Build/gpu/vc10 and place it in your application's folder.
Check PATH enviroment variable, it shouldn't contain any &opencv directory&/Build/* path.
--- In , &mjboumediene& &ipvoice75@...& wrote:
& Hi, any expert on GPU can help me ?
& --- In , &mjboumediene& &ipvoice75@& wrote:
& & I use it, I have no error when generating the solution. But getCudaEnabledDevice() return &0& ! why ?
& & --- In , &vlad.vinogradov& &vlad.vinogradov@& wrote:
& & & use libraries from &opencv directory&/Build/gpu/vc10/[x86 | x64]
& & & --- In , &mjboumediene& &ipvoice75@& wrote:
& & & & Hi, any one use GPU and OpenCV 2.4.3 ?
& & & & --- In , &mjboumediene& &ipvoice75@& wrote:
& & & & & Hi, I have install the last version of OpenCV from .
& & & & & I try to execute the following program but getCudaEnabledDeviceCount() always returns &0&. I have no idea where is the problem ? Thanks for you help.
& & & & & try
& & & & & & & {
int nb_gpu = cv::gpu::getCudaEnabledDeviceCount();
cv::gpu::DeviceInfo info = cv::gpu::getDevice();
& & & & & & & & & std::cout && info.name() && std::
& & & & & & & & & cv::gpu::GpuM
& & & & & & & & & //src = cv::imread(baboon, 1);
& & & & & & & }
& & & & & & & catch (const cv::Exception* ex)
& & & & & & & {
& & & & & & & & & std::cout && &Error: & && ex-&what() && std::
& & & & & & & }
& & & & & My configuration is :
& & & & & - windows 7.
& & & & & - visual studio 2010.
& & & & & - openCv 2.4.3
Open this post in threaded view
Report Content as Inappropriate
Re: cv::gpu:getCudaEnabledDevice() it returns me zero (opencv 2.4.3)
OpenCV was compiled with CUDA 4.2, so you should install CUDA 4.2 SDK. Or rebuild OpenCV with CUDA 5.0.
--- In , moh moh &ipvoice75@...& wrote:
& I have installed the CUDA tools 5.0 and not 4.2. Perhaps it's the problem because now I have error : npp32_42_9.dll not found.
& Do you have any suggestions to resolve this error ?
& From: vlad.vinogradov@...
& Date: Mon, 26 Nov :19 +0000
& Subject: [OpenCV] Re: cv::gpu:getCudaEnabledDevice() it returns me zero (opencv 2.4.3)
& & & & I suppose, Windows load wrong dll when your application starts (opencv_gpu.dll from &opencv directory&/Build/vc10/..., not from &opencv directory&/Build/gpu/vc10). Copy dlls from &opencv directory&/Build/gpu/vc10 and place it in your application's folder.
& Check PATH enviroment variable, it shouldn't contain any &opencv directory&/Build/* path.
& --- In , &mjboumediene& &ipvoice75@& wrote:
& & Hi, any expert on GPU can help me ?
& & Thanks.
& & --- In , &mjboumediene& &ipvoice75@& wrote:
& & & I use it, I have no error when generating the solution. But getCudaEnabledDevice() return &0& ! why ?
& & & --- In , &vlad.vinogradov& &vlad.vinogradov@& wrote:
& & & & use libraries from &opencv directory&/Build/gpu/vc10/[x86 | x64]
& & & & --- In , &mjboumediene& &ipvoice75@& wrote:
& & & & & Hi, any one use GPU and OpenCV 2.4.3 ?
& & & & & --- In , &mjboumediene& &ipvoice75@& wrote:
& & & & & &
& & & & & & Hi, I have install the last version of OpenCV from .
& & & & & &
& & & & & & I try to execute the following program but getCudaEnabledDeviceCount() always returns &0&. I have no idea where is the problem ? Thanks for you help.
& & & & & &
& & & & & & try
& & & & & & & & {
& & & & & &
int nb_gpu = cv::gpu::getCudaEnabledDeviceCount();
& & & & & &
cv::gpu::DeviceInfo info = cv::gpu::getDevice();
& & & & & & & & & & std::cout && info.name() && std::
& & & & & &
& & & & & & & & & & cv::gpu::GpuM
& & & & & &
& & & & & & & & & & //src = cv::imread(baboon, 1);
& & & & & & & & }
& & & & & & & & catch (const cv::Exception* ex)
& & & & & & & & {
& & & & & & & & & & std::cout && &Error: & && ex-&what() && std::
& & & & & & & & }
& & & & & &
& & & & & &
& & & & & & My configuration is :
& & & & & &
& & & & & & - windows 7.
& & & & & & - visual studio 2010.
& & & & & & - openCv 2.4.3
& & & & & &
Open this post in threaded view
Report Content as Inappropriate
Re: cv::gpu:getCudaEnabledDevice() it returns me zero (opencv 2.4.3)
from the NVIDIA website it's possible? because I found juste the 5.0Version.
--- In , &vlad.vinogradov& &vlad.vinogradov@...& wrote:
& OpenCV was compiled with CUDA 4.2, so you should install CUDA 4.2 SDK. Or rebuild OpenCV with CUDA 5.0.
& --- In , moh moh &ipvoice75@& wrote:
& & I have installed the CUDA tools 5.0 and not 4.2. Perhaps it's the problem because now I have error : npp32_42_9.dll not found.
& & Do you have any suggestions to resolve this error ?
& & Thanks
& & From: vlad.vinogradov@
& & Date: Mon, 26 Nov :19 +0000
& & Subject: [OpenCV] Re: cv::gpu:getCudaEnabledDevice() it returns me zero (opencv 2.4.3)
& & & & & I suppose, Windows load wrong dll when your application starts (opencv_gpu.dll from &opencv directory&/Build/vc10/..., not from &opencv directory&/Build/gpu/vc10). Copy dlls from &opencv directory&/Build/gpu/vc10 and place it in your application's folder.
& & Check PATH enviroment variable, it shouldn't contain any &opencv directory&/Build/* path.
& & --- In , &mjboumediene& &ipvoice75@& wrote:
& & & Hi, any expert on GPU can help me ?
& & & Thanks.
& & & --- In , &mjboumediene& &ipvoice75@& wrote:
& & & & I use it, I have no error when generating the solution. But getCudaEnabledDevice() return &0& ! why ?
& & & & --- In , &vlad.vinogradov& &vlad.vinogradov@& wrote:
& & & & & use libraries from &opencv directory&/Build/gpu/vc10/[x86 | x64]
& & & & & --- In , &mjboumediene& &ipvoice75@& wrote:
& & & & & &
& & & & & & Hi, any one use GPU and OpenCV 2.4.3 ?
& & & & & &
& & & & & & --- In , &mjboumediene& &ipvoice75@& wrote:
& & & & & & &
& & & & & & & Hi, I have install the last version of OpenCV from .
& & & & & & &
& & & & & & & I try to execute the following program but getCudaEnabledDeviceCount() always returns &0&. I have no idea where is the problem ? Thanks for you help.
& & & & & & &
& & & & & & & try
& & & & & & & & & {
& & & & & & &
int nb_gpu = cv::gpu::getCudaEnabledDeviceCount();
& & & & & & &
cv::gpu::DeviceInfo info = cv::gpu::getDevice();
& & & & & & & & & & & std::cout && info.name() && std::
& & & & & & &
& & & & & & & & & & & cv::gpu::GpuM
& & & & & & &
& & & & & & & & & & & //src = cv::imread(baboon, 1);
& & & & & & & & & }
& & & & & & & & & catch (const cv::Exception* ex)
& & & & & & & & & {
& & & & & & & & & & & std::cout && &Error: & && ex-&what() && std::
& & & & & & & & & }
& & & & & & &
& & & & & & &
& & & & & & & My configuration is :
& & & & & & &
& & & & & & & - windows 7.
& & & & & & & - visual studio 2010.
& & & & & & & - openCv 2.4.3
& & & & & & &
& & & & & &
Open this post in threaded view
Report Content as Inappropriate
Re: cv::gpu:getCudaEnabledDevice() it returns me zero (opencv 2.4.3)
--- In , &mjboumediene& &ipvoice75@...& wrote:
& from the NVIDIA website it's possible? because I found juste the 5.0Version.
& --- In , &vlad.vinogradov& &vlad.vinogradov@& wrote:
& & OpenCV was compiled with CUDA 4.2, so you should install CUDA 4.2 SDK. Or rebuild OpenCV with CUDA 5.0.
& & --- In , moh moh &ipvoice75@& wrote:
& & & I have installed the CUDA tools 5.0 and not 4.2. Perhaps it's the problem because now I have error : npp32_42_9.dll not found.
& & & Do you have any suggestions to resolve this error ?
& & & Thanks
& & & From: vlad.vinogradov@
& & & Date: Mon, 26 Nov :19 +0000
& & & Subject: [OpenCV] Re: cv::gpu:getCudaEnabledDevice() it returns me zero (opencv 2.4.3)
& & & & & &
& & & & & &
& & & & & & I suppose, Windows load wrong dll when your application starts (opencv_gpu.dll from &opencv directory&/Build/vc10/..., not from &opencv directory&/Build/gpu/vc10). Copy dlls from &opencv directory&/Build/gpu/vc10 and place it in your application's folder.
& & & Check PATH enviroment variable, it shouldn't contain any &opencv directory&/Build/* path.
& & & --- In , &mjboumediene& &ipvoice75@& wrote:
& & & & Hi, any expert on GPU can help me ?
& & & & Thanks.
& & & & --- In , &mjboumediene& &ipvoice75@& wrote:
& & & & & I use it, I have no error when generating the solution. But getCudaEnabledDevice() return &0& ! why ?
& & & & & --- In , &vlad.vinogradov& &vlad.vinogradov@& wrote:
& & & & & &
& & & & & & use libraries from &opencv directory&/Build/gpu/vc10/[x86 | x64]
& & & & & &
& & & & & & --- In , &mjboumediene& &ipvoice75@& wrote:
& & & & & & &
& & & & & & & Hi, any one use GPU and OpenCV 2.4.3 ?
& & & & & & &
& & & & & & & --- In , &mjboumediene& &ipvoice75@& wrote:
& & & & & & & &
& & & & & & & & Hi, I have install the last version of OpenCV from .
& & & & & & & &
& & & & & & & & I try to execute the following program but getCudaEnabledDeviceCount() always returns &0&. I have no idea where is the problem ? Thanks for you help.
& & & & & & & &
& & & & & & & & try
& & & & & & & & & & {
& & & & & & & &
int nb_gpu = cv::gpu::getCudaEnabledDeviceCount();
& & & & & & & &
cv::gpu::DeviceInfo info = cv::gpu::getDevice();
& & & & & & & & & & & & std::cout && info.name() && std::
& & & & & & & &
& & & & & & & & & & & & cv::gpu::GpuM
& & & & & & & &
& & & & & & & & & & & & //src = cv::imread(baboon, 1);
& & & & & & & & & & }
& & & & & & & & & & catch (const cv::Exception* ex)
& & & & & & & & & & {
& & & & & & & & & & & & std::cout && &Error: & && ex-&what() && std::
& & & & & & & & & & }
& & & & & & & &
& & & & & & & &
& & & & & & & & My configuration is :
& & & & & & & &
& & & & & & & & - windows 7.
& & & & & & & & - visual studio 2010.
& & & & & & & & - openCv 2.4.3
& & & & & & & &
& & & & & & &
& & & & & &
Open this post in threaded view
Report Content as Inappropriate
Re: cv::gpu:getCudaEnabledDevice() it returns me zero (opencv 2.4.3)
Hi, actually the project is generated correctly (0 error) but I have always 0 gpu device. getCudaEnabledDeviceCount() returns 0 !
I have no idea where is the problem
Thank you for your help.
My program:
#include &iostream&#include &opencv2/core/core.hpp&#include &opencv2/gpu/gpu.hpp&#include &opencv2/core/internal.hpp& // For TBB wrappers
using namespace cv::
struct Worker { void operator()(int device_id) };
int main(){ & &int num_devices = getCudaEnabledDeviceCount(); & &if (num_devices & 2) & &{ & & & &std::cout && &Two or more GPUs are required\n&; & & & &return -1; & &} & &for (int i = 0; i & num_ ++i) & &{ & & & &cv::gpu::printShortCudaDeviceInfo(i);
& & & & DeviceInfo dev_info(i); & & & &if (!dev_info.isCompatible()) & & & &{ & & & & & &std::cout && &GPU module isn't built for GPU #& && i && & (& & & & & & & & & && dev_info.name() && &, CC & && dev_info.majorVersion() & & & & & & & & && dev_info.minorVersion() && &\n&; & & & & & &return -1; & & & &} & &}
& & // Execute calculation in two threads using two GPUs & &int devices[] = {0, 1}; & &parallel_do(devices, devices + 2, Worker());
& & return 0;} &
Date: Mon, 26 Nov :59 +0000
Subject: [OpenCV] Re: cv::gpu:getCudaEnabledDevice() it returns me zero (opencv 2.4.3)
& & & --- In , &mjboumediene& &ipvoice75@...& wrote:
& from the NVIDIA website it's possible? because I found juste the 5.0Version.
& --- In , &vlad.vinogradov& &vlad.vinogradov@& wrote:
& & OpenCV was compiled with CUDA 4.2, so you should install CUDA 4.2 SDK. Or rebuild OpenCV with CUDA 5.0.
& & --- In , moh moh &ipvoice75@& wrote:
& & & I have installed the CUDA tools 5.0 and not 4.2. Perhaps it's the problem because now I have error : npp32_42_9.dll not found.
& & & Do you have any suggestions to resolve this error ?
& & & Thanks
& & & From: vlad.vinogradov@
& & & Date: Mon, 26 Nov :19 +0000
& & & Subject: [OpenCV] Re: cv::gpu:getCudaEnabledDevice() it returns me zero (opencv 2.4.3)
& & & & & &
& & & & & &
& & & & & & I suppose, Windows load wrong dll when your application starts (opencv_gpu.dll from &opencv directory&/Build/vc10/..., not from &opencv directory&/Build/gpu/vc10). Copy dlls from &opencv directory&/Build/gpu/vc10 and place it in your application's folder.
& & & Check PATH enviroment variable, it shouldn't contain any &opencv directory&/Build/* path.
& & & --- In , &mjboumediene& &ipvoice75@& wrote:
& & & & Hi, any expert on GPU can help me ?
& & & & Thanks.
& & & & --- In , &mjboumediene& &ipvoice75@& wrote:
& & & & & I use it, I have no error when generating the solution. But getCudaEnabledDevice() return &0& ! why ?
& & & & & --- In , &vlad.vinogradov& &vlad.vinogradov@& wrote:
& & & & & &
& & & & & & use libraries from &opencv directory&/Build/gpu/vc10/[x86 | x64]
& & & & & &
& & & & & & --- In , &mjboumediene& &ipvoice75@& wrote:
& & & & & & &
& & & & & & & Hi, any one use GPU and OpenCV 2.4.3 ?
& & & & & & &
& & & & & & & --- In , &mjboumediene& &ipvoice75@& wrote:
& & & & & & & &
& & & & & & & & Hi, I have install the last version of OpenCV from .
& & & & & & & &
& & & & & & & & I try to execute the following program but getCudaEnabledDeviceCount() always returns &0&. I have no idea where is the problem ? Thanks for you help.
& & & & & & & &
& & & & & & & & try
& & & & & & & & & & {
& & & & & & & &
int nb_gpu = cv::gpu::getCudaEnabledDeviceCount();
& & & & & & & &
cv::gpu::DeviceInfo info = cv::gpu::getDevice();
& & & & & & & & & & & & std::cout && info.name() && std::
& & & & & & & &
& & & & & & & & & & & & cv::gpu::GpuM
& & & & & & & &
& & & & & & & & & & & & //src = cv::imread(baboon, 1);
& & & & & & & & & & }
& & & & & & & & & & catch (const cv::Exception* ex)
& & & & & & & & & & {
& & & & & & & & & & & & std::cout && &Error: & && ex-&what() && std::
& & & & & & & & & & }
& & & & & & & &
& & & & & & & &
& & & & & & & & My configuration is :
& & & & & & & &
& & & & & & & & - windows 7.
& & & & & & & & - visual studio 2010.
& & & & & & & & - openCv 2.4.3
& & & & & & & &
& & & & & & &
& & & & & &
Open this post in threaded view
Report Content as Inappropriate
Re: cv::gpu:getCudaEnabledDevice() it returns me zero (opencv 2.4.3)
In reply to
by moh moh
First of all, what is the model of your graphic card ?
Secondly, what is the version of your drivers ? Are they recent ? If not update them at --- In , &mjboumediene& &ipvoice75@...& wrote:
& Hi, I have install the last version of OpenCV from .
& I try to execute the following program but getCudaEnabledDeviceCount() always returns &0&. I have no idea where is the problem ? Thanks for you help.
int nb_gpu = cv::gpu::getCudaEnabledDeviceCount();
cv::gpu::DeviceInfo info = cv::gpu::getDevice();
& & & & & std::cout && info.name() && std::
& & & & & cv::gpu::GpuM
& & & & & //src = cv::imread(baboon, 1);
& & & catch (const cv::Exception* ex)
& & & & & std::cout && &Error: & && ex-&what() && std::
& My configuration is :
& - windows 7.
& - visual studio 2010.
& - openCv 2.4.3
Open this post in threaded view
Report Content as Inappropriate
Re: cv::gpu:getCudaEnabledDevice() it returns me zero (opencv 2.4.3)
Hi, my card is NVIDIA GeoForce GT 540M and the driver is updated (version 9.18.13.694). &
What can I do ? now
--- In , &yvonnic2m& &yvonnic2m@...& wrote:
& First of all, what is the model of your graphic card ?
& Secondly, what is the version of your drivers ? Are they recent ? If not update them at &
& --- In , &mjboumediene& &ipvoice75@& wrote:
& & Hi, I have install the last version of OpenCV from .
& & I try to execute the following program but getCudaEnabledDeviceCount() always returns &0&. I have no idea where is the problem ? Thanks for you help.
int nb_gpu = cv::gpu::getCudaEnabledDeviceCount();
cv::gpu::DeviceInfo info = cv::gpu::getDevice();
& & & & & & std::cout && info.name() && std::
& & & & & & cv::gpu::GpuM
& & & & & & //src = cv::imread(baboon, 1);
& & & & catch (const cv::Exception* ex)
& & & & & & std::cout && &Error: & && ex-&what() && std::
& & My configuration is :
& & - windows 7.
& & - visual studio 2010.
& & - openCv 2.4.3
Loading...}

我要回帖

更多关于 cuda opencv 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信