Opencv - Gpu - Opencv Wiki
Opencv - Gpu - Opencv Wiki
Opencv - Gpu - Opencv Wiki
Contents 1. OpenCV_GPU 1. Request Feature 2. Getting Started 1. Compiling OpenCV with CUDA Support 2. Adding OpenCV to your project via Cmake 3. Warning!!! First Function Call Perfomance 4. Short Sample 3. Asking questions 4. List of Ported Functions 5. Documentation 6. Frequently Asked Questions 7. Leave Feedback
The OpenCV GPU module is a set of classes and functions to utilize GPU computational capabilities. It is implemented using NVidia CUDA Runtime API , so only that vendor GPUs are supported. It includes utility functions, low level vision primitives as well as high level algorithms. I.e. the module is being developed as a powerful infrastructure for fast vision algorithms building on GPU with some high level state of the art functionality.
Request Feature
OpenCV GPU Feature Request form
Getting Started
Compiling OpenCV with CUDA Support
Prerequisites: Sources from SVN or SourceForge NVIDIA Display Driver CMake (minimum 2.8.0) Cuda Toolkit 4.0 (the latest) Build steps: 1. Checkout the latest OpenCV from SVN: https://code.ros.org/svn/opencv/trunk/opencv. 2. Open CMake-Gui Set source and build folders Set WITH_CUDA flag Configure for your favorite IDE or for make files. If you want to generate for NMake, please run CMake-Gui from Visual Studio Command Prompt. If CMake can't find "FindCuda.cmake", please set environment variable
,p CMAKE_MODULE_PATH = <path to location of FindCUDA.cmake> Check that all CUDA paths are detected correctly. If not, specify CUDA_TOOLKIT_ROOT_DIR manually. Generate project for your favorite IDE. (Optional) You can reduce build time by setting target architecture variables (in order to build only for your GPU) CUDA_ARCH_BIN = "X.X", where XX is your GPU Compute Capability CUDA_ARCH_PTX = "empty" 3. Open and build project generated, or run make.
Short Sample
#include <iostream> #include "opencv2/opencv.hpp" #include "opencv2/gpu/gpu.hpp" int main (int argc, char* argv[]) { try { cv::Mat src_host = cv::imread("file.png", CV_LOAD_IMAGE_GRAYSCALE); cv::gpu::GpuMat dst, src; src.upload(src_host); cv::gpu::threshold(src, dst, 128.0, 255.0, CV_THRESH_BINARY); cv::Mat result_host = dst; cv::imshow("Result", result_host); cv::waitKey(); } catch(const cv::Exception& ex) { std::cout << "Error: " << ex.what() << std::endl; } return 0; }
Asking questions
Send your question to OpenCV Yahoo Group using recommendations below:
Place [GPU] or [CUDA] in question's topic (OpenCV GPU team can't read the group entirely). In case of some strange problems, specify your GPU, OS, Cuda Toolkit, NPP, message from caught cv::Exception (if it is), etc.
Reductions with/without mask ( meanStdDev, norm, sum, sqrSum, minMax, minMaxLoc, countNonZero, integral, sqrIntegral, columnSum, rectStdDev) Template matching (matchTemplate) Filter engine (low-level filter classes, middle-level filtering engines, and high level filtering functions: boxFilter, blur, erode, dilate, morphologyEx, filter2D, sepFilter2D, Sobel, Scharr, GaussianBlur, Laplacian) Histograms (evenLevels, histEven, histRange) Stereo correspondence (StereoBlockMatching, StereoBeliefPropagation, StereoConstantSpaceBP, DisparityBilateralFilter, drawColorDisp) Pedestrian detection (Histograms of oriented gradients (HOG) descriptor) Universal descriptor matcher (BruteForceMatcher) Haar features detection, face detection (CascadeClassifier based on code contributed by Anton Obukhov, NVidia) Feature detection for object recognition ( Speeded Up Robust Features, SURF ) Other image transforms (flip, LUT, merge, split, magnitude, magnitudeSqr, phase, cartToPolar, polarToCart, reprojectImageTo3D, graphcut, threshold, copyMakeBorder, dft, convolve, mulSpectrums, mulAndScaleSpectrums)
Documentation
Documenation is available here: https://code.ros.org/svn/opencv/trunk/opencv/doc/opencv.pdf (it contains GPU subsection). Or here: http://opencv.itseez.com (regenerated each night).
Leave Feedback
OpenCV GPU Feedback form Back to Main Wiki Page Back to the User Wiki Pages