Opencvに明るい方へ

フォーラム(掲示板)ルール
フォーラム(掲示板)ルールはこちら  ※コードを貼り付ける場合は [code][/code] で囲って下さい。詳しくはこちら
zxcv

Opencvに明るい方へ

#1

投稿記事 by zxcv » 8年前

通常、コンパイル済みのOpencv LIBを利用すれば良いと思いますが、
CUDA GPUサポート機能を利用したい場合、そのために、
Opencvのソースコードを自分で、GPUサポートというようなコンパイルスイッチを入れて、
再コンパイルしなければならないのでしょうか。

宜しくお願いします

みえ
記事: 23
登録日時: 8年前

Re: Opencvに明るい方へ

#2

投稿記事 by みえ » 8年前

その通りです。CUDA のツールキットをインストールしてから OpenCV をビルドすると組み込まれます。以下に示すページに書かれていますが、CMake のときに WITH_CUDA=ON オプションが付加されていて、かつ、CUDA のツールキットがインストールされていれば CUDA を組み込む Makefile が生成されます。(確か WITH_CUDA オプションはデフォルトが ON だったと思います。)

GPU Module Introduction — OpenCV 2.4.13.2 documentation
http://docs.opencv.org/2.4/modules/gpu/ ... ction.html

zxcv

Re: Opencvに明るい方へ

#3

投稿記事 by zxcv » 8年前

みえ様
ありがとうございました!

=======================
To enable CUDA support, configure OpenCV using CMake with WITH_CUDA=ON .
When the flag is set and if CUDA is installed, the full-featured OpenCV GPU module is built.

Otherwise, the module is still built but at runtime all functions from the module throw Exception with CV_GpuNotSupported error code, except for
gpu::getCudaEnabledDeviceCount(). // これは旧版のOpencv [トピック主注]
cv::cuda::getCudaEnabledDeviceCount(). // これは新版のOpencv[トピック主注]
The latter function returns zero GPU count in this case.

Building OpenCV without CUDA support does not perform device code compilation, so it does not require the CUDA Toolkit installed. Therefore, using the gpu::getCudaEnabledDeviceCount() function, you can implement a high-level algorithm that will detect GPU presence at runtime and choose an appropriate implementation (CPU or GPU) accordingly.
========================

返信

“C言語何でも質問掲示板” へ戻る