:param arr:Destination array (host or device memory, can be :ocv:class:`Mat` , :ocv:class:`gpu::GpuMat` , :ocv:class:`ogl::Buffer` or ``ogl::Texture2D`` ).
:param arr:Destination array (host or device memory, can be :ocv:class:`Mat` , :ocv:class:`cuda::GpuMat` , :ocv:class:`ogl::Buffer` or ``ogl::Texture2D`` ).
:param ddepth:Destination depth.
@ -528,12 +528,12 @@ Render OpenGL texture or primitives.
gpu::setGlDevice
----------------
cuda::setGlDevice
-----------------
Sets a CUDA device and initializes it for the current thread with OpenGL interoperability.
..ocv:function:: void gpu::setGlDevice( int device = 0 )
..ocv:function:: void cuda::setGlDevice( int device = 0 )
:param device:System index of a GPU device starting with 0.
:param device:System index of a CUDA device starting with 0.
This function should be explicitly called after OpenGL context creation and before any CUDA calls.
Lightweight class encapsulating pitched memory on a GPU and passed to nvcc-compiled code (CUDA kernels). Typically, it is used internally by OpenCV and by users who write device code. You can call its members from both host and device code. ::
@ -30,11 +30,11 @@ Lightweight class encapsulating pitched memory on a GPU and passed to nvcc-compi
gpu::PtrStep
------------
..ocv:class::gpu::PtrStep
cuda::PtrStep
-------------
..ocv:class::cuda::PtrStep
Structure similar to :ocv:class:`gpu::PtrStepSz` but containing only a pointer and row step. Width and height fields are excluded due to performance reasons. The structure is intended for internal use or for users who write device code. ::
Structure similar to :ocv:class:`cuda::PtrStepSz` but containing only a pointer and row step. Width and height fields are excluded due to performance reasons. The structure is intended for internal use or for users who write device code. ::
template <typename T> struct PtrStep : public DevPtr<T>
{
@ -57,9 +57,9 @@ Structure similar to :ocv:class:`gpu::PtrStepSz` but containing only a pointer a
gpu::GpuMat
-----------
..ocv:class::gpu::GpuMat
cuda::GpuMat
------------
..ocv:class::cuda::GpuMat
Base storage class for GPU memory with reference counting. Its interface matches the :ocv:class:`Mat` interface with the following limitations:
@ -67,7 +67,7 @@ Base storage class for GPU memory with reference counting. Its interface matches
* no functions that return references to their data (because references on GPU are not valid for CPU)
* no expression templates technique support
Beware that the latter limitation may lead to overloaded matrix operators that cause memory allocations. The ``GpuMat`` class is convertible to :ocv:class:`gpu::PtrStepSz` and :ocv:class:`gpu::PtrStep` so it can be passed directly to the kernel.
Beware that the latter limitation may lead to overloaded matrix operators that cause memory allocations. The ``GpuMat`` class is convertible to :ocv:class:`cuda::PtrStepSz` and :ocv:class:`cuda::PtrStep` so it can be passed directly to the kernel.
..note:: In contrast with :ocv:class:`Mat`, in most cases ``GpuMat::isContinuous() == false`` . This means that rows are aligned to a size depending on the hardware. Single-row ``GpuMat`` is always a continuous matrix.
@ -113,11 +113,11 @@ Beware that the latter limitation may lead to overloaded matrix operators that c
gpu::createContinuous
---------------------
cuda::createContinuous
----------------------
Creates a continuous matrix.
..ocv:function:: void gpu::createContinuous(int rows, int cols, int type, OutputArray arr)
..ocv:function:: void cuda::createContinuous(int rows, int cols, int type, OutputArray arr)
:param rows:Row count.
@ -131,11 +131,11 @@ Matrix is called continuous if its elements are stored continuously, that is, wi
gpu::ensureSizeIsEnough
-----------------------
cuda::ensureSizeIsEnough
------------------------
Ensures that the size of a matrix is big enough and the matrix has a proper type.
..ocv:function:: void gpu::ensureSizeIsEnough(int rows, int cols, int type, OutputArray arr)
..ocv:function:: void cuda::ensureSizeIsEnough(int rows, int cols, int type, OutputArray arr)
:param rows:Minimum desired number of rows.
@ -149,9 +149,9 @@ The function does not reallocate memory if the matrix has proper attributes alre
gpu::CudaMem
------------
..ocv:class::gpu::CudaMem
cuda::CudaMem
-------------
..ocv:class::cuda::CudaMem
Class with reference counting wrapping special memory type allocation functions from CUDA. Its interface is also :ocv:func:`Mat`-like but with additional memory type parameters.
@ -191,47 +191,47 @@ Class with reference counting wrapping special memory type allocation functions
gpu::CudaMem::createMatHeader
-----------------------------
Creates a header without reference counting to :ocv:class:`gpu::CudaMem` data.
cuda::CudaMem::createMatHeader
------------------------------
Creates a header without reference counting to :ocv:class:`cuda::CudaMem` data.
..ocv:function:: Mat gpu::CudaMem::createMatHeader() const
..ocv:function:: Mat cuda::CudaMem::createMatHeader() const
gpu::CudaMem::createGpuMatHeader
--------------------------------
Maps CPU memory to GPU address space and creates the :ocv:class:`gpu::GpuMat` header without reference counting for it.
cuda::CudaMem::createGpuMatHeader
---------------------------------
Maps CPU memory to GPU address space and creates the :ocv:class:`cuda::GpuMat` header without reference counting for it.
This can be done only if memory was allocated with the ``SHARED`` flag and if it is supported by the hardware. Laptops often share video and CPU memory, so address spaces can be mapped, which eliminates an extra copy.
gpu::registerPageLocked
-----------------------
cuda::registerPageLocked
------------------------
Page-locks the memory of matrix and maps it for the device(s).
..ocv:function:: void gpu::registerPageLocked(Mat& m)
..ocv:function:: void cuda::registerPageLocked(Mat& m)
:param m:Input matrix.
gpu::unregisterPageLocked
-------------------------
cuda::unregisterPageLocked
--------------------------
Unmaps the memory of matrix and makes it pageable again.
..ocv:function:: void gpu::unregisterPageLocked(Mat& m)
..ocv:function:: void cuda::unregisterPageLocked(Mat& m)
:param m:Input matrix.
gpu::Stream
-----------
..ocv:class::gpu::Stream
cuda::Stream
------------
..ocv:class::cuda::Stream
This class encapsulates a queue of asynchronous calls.
@ -265,45 +265,45 @@ This class encapsulates a queue of asynchronous calls.
gpu::Stream::queryIfComplete
----------------------------
cuda::Stream::queryIfComplete
-----------------------------
Returns ``true`` if the current stream queue is finished. Otherwise, it returns false.
..note:: Callbacks must not make any CUDA API calls. Callbacks must not perform any synchronization that may depend on outstanding device work or other callbacks that are not mandated to run earlier. Callbacks without a mandated order (in independent streams) execute in undefined order and may be serialized.
gpu::StreamAccessor
-------------------
..ocv:struct::gpu::StreamAccessor
cuda::StreamAccessor
--------------------
..ocv:struct::cuda::StreamAccessor
Class that enables getting ``cudaStream_t`` from :ocv:class:`gpu::Stream` and is declared in ``stream_accessor.hpp`` because it is the only public header that depends on the CUDA Runtime API. Including it brings a dependency to your code. ::
Class that enables getting ``cudaStream_t`` from :ocv:class:`cuda::Stream` and is declared in ``stream_accessor.hpp`` because it is the only public header that depends on the CUDA Runtime API. Including it brings a dependency to your code. ::
The OpenCV GPU module is a set of classes and functions to utilize GPU computational capabilities. It is implemented using NVIDIA* CUDA* Runtime API and supports only NVIDIA GPUs. The OpenCV GPU module includes utility functions, low-level vision primitives, and high-level algorithms. The utility functions and low-level primitives provide a powerful infrastructure for developing fast vision algorithms taking advantage of GPU whereas the high-level functionality includes some state-of-the-art algorithms (such as stereo correspondence, face and people detectors, and others) ready to be used by the application developers.
The OpenCV CUDA module is a set of classes and functions to utilize CUDA computational capabilities. It is implemented using NVIDIA* CUDA* Runtime API and supports only NVIDIA GPUs. The OpenCV CUDA module includes utility functions, low-level vision primitives, and high-level algorithms. The utility functions and low-level primitives provide a powerful infrastructure for developing fast vision algorithms taking advantage of CUDA whereas the high-level functionality includes some state-of-the-art algorithms (such as stereo correspondence, face and people detectors, and others) ready to be used by the application developers.
The GPU module is designed as a host-level API. This means that if you have pre-compiled OpenCV GPU binaries, you are not required to have the CUDA Toolkit installed or write any extra code to make use of the GPU.
The CUDA module is designed as a host-level API. This means that if you have pre-compiled OpenCV CUDA binaries, you are not required to have the CUDA Toolkit installed or write any extra code to make use of the CUDA.
The OpenCV GPU module is designed for ease of use and does not require any knowledge of CUDA. Though, such a knowledge will certainly be useful to handle non-trivial cases or achieve the highest performance. It is helpful to understand the cost of various operations, what the GPU does, what the preferred data formats are, and so on. The GPU module is an effective instrument for quick implementation of GPU-accelerated computer vision algorithms. However, if your algorithm involves many simple operations, then, for the best possible performance, you may still need to write your own kernels to avoid extra write and read operations on the intermediate results.
The OpenCV CUDA module is designed for ease of use and does not require any knowledge of CUDA. Though, such a knowledge will certainly be useful to handle non-trivial cases or achieve the highest performance. It is helpful to understand the cost of various operations, what the GPU does, what the preferred data formats are, and so on. The CUDA module is an effective instrument for quick implementation of CUDA-accelerated computer vision algorithms. However, if your algorithm involves many simple operations, then, for the best possible performance, you may still need to write your own kernels to avoid extra write and read operations on the intermediate results.
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
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 CUDA module is built. Otherwise, the module is still built but at runtime all functions from the module throw
:ocv:class:`Exception` with ``CV_GpuNotSupported`` error code, except for
:ocv:func:`gpu::getCudaEnabledDeviceCount()`. 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
:ocv:func:`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.
:ocv:func:`cuda::getCudaEnabledDeviceCount()`. 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
:ocv:func:`cuda::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.
Compilation for Different NVIDIA* Platforms
-------------------------------------------
@ -23,7 +25,7 @@ Compilation for Different NVIDIA* Platforms
NVIDIA* compiler enables generating binary code (cubin and fatbin) and intermediate code (PTX). Binary code often implies a specific GPU architecture and generation, so the compatibility with other GPUs is not guaranteed. PTX is targeted for a virtual platform that is defined entirely by the set of capabilities or features. Depending on the selected virtual platform, some of the instructions are emulated or disabled, even if the real hardware supports all the features.
At the first call, the PTX code is compiled to binary code for the particular GPU using a JIT compiler. When the target GPU has a compute capability (CC) lower than the PTX code, JIT fails.
By default, the OpenCV GPU module includes:
By default, the OpenCV CUDA module includes:
*
Binaries for compute capabilities 1.3 and 2.0 (controlled by ``CUDA_ARCH_BIN`` in ``CMake``)
@ -34,16 +36,16 @@ By default, the OpenCV GPU module includes:
This means that for devices with CC 1.3 and 2.0 binary images are ready to run. For all newer platforms, the PTX code for 1.3 is JIT'ed to a binary image. For devices with CC 1.1 and 1.2, the PTX for 1.1 is JIT'ed. For devices with CC 1.0, no code is available and the functions throw
:ocv:class:`Exception`. For platforms where JIT compilation is performed first, the run is slow.
On a GPU with CC 1.0, you can still compile the GPU module and most of the functions will run flawlessly. To achieve this, add "1.0" to the list of binaries, for example, ``CUDA_ARCH_BIN="1.0 1.3 2.0"`` . The functions that cannot be run on CC 1.0 GPUs throw an exception.
On a GPU with CC 1.0, you can still compile the CUDA module and most of the functions will run flawlessly. To achieve this, add "1.0" to the list of binaries, for example, ``CUDA_ARCH_BIN="1.0 1.3 2.0"`` . The functions that cannot be run on CC 1.0 GPUs throw an exception.
You can always determine at runtime whether the OpenCV GPU-built binaries (or PTX code) are compatible with your GPU. The function
:ocv:func:`gpu::DeviceInfo::isCompatible` returns the compatibility status (true/false).
:ocv:func:`cuda::DeviceInfo::isCompatible` returns the compatibility status (true/false).
Utilizing Multiple GPUs
-----------------------
In the current version, each of the OpenCV GPU algorithms can use only a single GPU. So, to utilize multiple GPUs, you have to manually distribute the work between GPUs.
Switching active devie can be done using :ocv:func:`gpu::setDevice()` function. For more details please read Cuda C Programing Guide.
In the current version, each of the OpenCV CUDA algorithms can use only a single GPU. So, to utilize multiple GPUs, you have to manually distribute the work between GPUs.
Switching active devie can be done using :ocv:func:`cuda::setDevice()` function. For more details please read Cuda C Programing Guide.
While developing algorithms for multiple GPUs, note a data passing overhead. For primitive functions and small images, it can be significant, which may eliminate all the advantages of having multiple GPUs. But for high-level algorithms, consider using multi-GPU acceleration. For example, the Stereo Block Matching algorithm has been successfully parallelized using the following algorithm:
@ -56,7 +58,4 @@ While developing algorithms for multiple GPUs, note a data passing overhead. For
3. Merge the results into a single disparity map.
With this algorithm, a dual GPU gave a 180
%
performance increase comparing to the single Fermi GPU. For a source code example, see
With this algorithm, a dual GPU gave a 180% performance increase comparing to the single Fermi GPU. For a source code example, see http://code.opencv.org/projects/opencv/repository/revisions/master/entry/samples/gpu/.
:param filename:Name of the file from which the classifier is loaded. Only the old ``haar`` classifier (trained by the ``haar`` training application) and NVIDIA's ``nvbin`` are supported for HAAR and only new type of OpenCV XML cascade supported for LBP.
:param filename:Name of the file from which the classifier is loaded. Only the old ``haar`` classifier (trained by the ``haar`` training application) and NVIDIA's ``nvbin`` are supported for HAAR and only new type of OpenCV XML cascade supported for LBP.
@ -123,11 +123,11 @@ Creates implementation for :ocv:class:`gpu::LookUpTable` .
gpu::copyMakeBorder
-----------------------
cuda::copyMakeBorder
--------------------
Forms a border around an image.
..ocv:function:: void gpu::copyMakeBorder(InputArray src, OutputArray dst, int top, int bottom, int left, int right, int borderType, Scalar value = Scalar(), Stream& stream = Stream::Null())
..ocv:function:: void cuda::copyMakeBorder(InputArray src, OutputArray dst, int top, int bottom, int left, int right, int borderType, Scalar value = Scalar(), Stream& stream = Stream::Null())
:param src:Source image. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_32SC1`` , and ``CV_32FC1`` types are supported.
..ocv:class::gpu::BackgroundSubtractorMOG : public cv::BackgroundSubtractorMOG
..ocv:class::cuda::BackgroundSubtractorMOG : public cv::BackgroundSubtractorMOG
The class discriminates between foreground and background pixels by building and maintaining a model of the background. Any pixel which does not fit this model is then deemed to be foreground. The class implements algorithm described in [MOG2001]_.
@ -20,11 +20,12 @@ The class discriminates between foreground and background pixels by building and
* An example on gaussian mixture based background/foreground segmantation can be found at opencv_source_code/samples/gpu/bgfg_segm.cpp
gpu::createBackgroundSubtractorMOG
----------------------------------
cuda::createBackgroundSubtractorMOG
-----------------------------------
Creates mixture-of-gaussian background subtractor
..ocv:function:: Ptr<gpu::BackgroundSubtractorMOG> gpu::createBackgroundSubtractorMOG(int history=200, int nmixtures=5, double backgroundRatio=0.7, double noiseSigma=0)
..ocv:function:: Ptr<cuda::BackgroundSubtractorMOG> cuda::createBackgroundSubtractorMOG(int history=200, int nmixtures=5, double backgroundRatio=0.7, double noiseSigma=0)
..ocv:class::gpu::BackgroundSubtractorMOG2 : public cv::BackgroundSubtractorMOG2
..ocv:class::cuda::BackgroundSubtractorMOG2 : public cv::BackgroundSubtractorMOG2
The class discriminates between foreground and background pixels by building and maintaining a model of the background. Any pixel which does not fit this model is then deemed to be foreground. The class implements algorithm described in [MOG2004]_.
@ -48,11 +49,11 @@ The class discriminates between foreground and background pixels by building and
gpu::createBackgroundSubtractorMOG2
-----------------------------------
cuda::createBackgroundSubtractorMOG2
------------------------------------
Creates MOG2 Background Subtractor
..ocv:function:: Ptr<gpu::BackgroundSubtractorMOG2> gpu::createBackgroundSubtractorMOG2( int history=500, double varThreshold=16, bool detectShadows=true )
..ocv:function:: Ptr<cuda::BackgroundSubtractorMOG2> cuda::createBackgroundSubtractorMOG2( int history=500, double varThreshold=16, bool detectShadows=true )
..ocv:class::gpu::BackgroundSubtractorGMG : public cv::BackgroundSubtractorGMG
..ocv:class::cuda::BackgroundSubtractorGMG : public cv::BackgroundSubtractorGMG
The class discriminates between foreground and background pixels by building and maintaining a model of the background. Any pixel which does not fit this model is then deemed to be foreground. The class implements algorithm described in [GMG2012]_.
..ocv:class::gpu::BackgroundSubtractorFGD : public cv::BackgroundSubtractor
..ocv:class::cuda::BackgroundSubtractorFGD : public cv::BackgroundSubtractor
The class discriminates between foreground and background pixels by building and maintaining a model of the background. Any pixel which does not fit this model is then deemed to be foreground. The class implements algorithm described in [FGD2003]_. ::
@ -101,21 +102,21 @@ The class discriminates between foreground and background pixels by building and
If no frames has been grabbed (there are no more frames in video file), the methods return ``false`` . The method throws :ocv:class:`Exception` if error occurs.
:param fileName:Name of the output video file. Only AVI file format is supported.
@ -49,19 +49,19 @@ Creates video writer.
:param fps:Framerate of the created video stream.
:param params:Encoder parameters. See :ocv:struct:`gpucodec::EncoderParams` .
:param params:Encoder parameters. See :ocv:struct:`cudacodec::EncoderParams` .
:param format:Surface format of input frames ( ``SF_UYVY`` , ``SF_YUY2`` , ``SF_YV12`` , ``SF_NV12`` , ``SF_IYUV`` , ``SF_BGR`` or ``SF_GRAY``). BGR or gray frames will be converted to YV12 format before encoding, frames with other formats will be used as is.
:param encoderCallback:Callbacks for video encoder. See :ocv:class:`gpucodec::EncoderCallBack` . Use it if you want to work with raw video stream.
:param encoderCallback:Callbacks for video encoder. See :ocv:class:`cudacodec::EncoderCallBack` . Use it if you want to work with raw video stream.
The constructors initialize video writer. FFMPEG is used to write videos. User can implement own multiplexing with :ocv:class:`gpucodec::EncoderCallBack` .
The constructors initialize video writer. FFMPEG is used to write videos. User can implement own multiplexing with :ocv:class:`cudacodec::EncoderCallBack` .
gpucodec::EncoderParams
-----------------------
..ocv:struct::gpucodec::EncoderParams
cudacodec::EncoderParams
------------------------
..ocv:struct::cudacodec::EncoderParams
Different parameters for CUDA video encoder. ::
@ -96,12 +96,12 @@ Different parameters for CUDA video encoder. ::
Brute-force descriptor matcher. For each descriptor in the first set, this matcher finds the closest descriptor in the second set by trying each one. This descriptor matcher supports masking permissible matches between descriptor sets. ::
class BFMatcher_GPU
class BFMatcher_CUDA
{
public:
explicit BFMatcher_GPU(int norm = cv::NORM_L2);
explicit BFMatcher_CUDA(int norm = cv::NORM_L2);
// Add descriptors to train descriptor collection.
@ -375,67 +375,67 @@ Brute-force descriptor matcher. For each descriptor in the first set, this match
};
The class ``BFMatcher_GPU`` has an interface similar to the class :ocv:class:`DescriptorMatcher`. It has two groups of ``match`` methods: for matching descriptors of one image with another image or with an image set. Also, all functions have an alternative to save results either to the GPU memory or to the CPU memory.
The class ``BFMatcher_CUDA`` has an interface similar to the class :ocv:class:`DescriptorMatcher`. It has two groups of ``match`` methods: for matching descriptors of one image with another image or with an image set. Also, all functions have an alternative to save results either to the GPU memory or to the CPU memory.
Downloads matrices obtained via :ocv:func:`gpu::BFMatcher_GPU::matchSingle` or :ocv:func:`gpu::BFMatcher_GPU::matchCollection` to vector with :ocv:class:`DMatch`.
cuda::BFMatcher_CUDA::matchDownload
-----------------------------------
Downloads matrices obtained via :ocv:func:`cuda::BFMatcher_CUDA::matchSingle` or :ocv:func:`cuda::BFMatcher_CUDA::matchCollection` to vector with :ocv:class:`DMatch`.
Converts matrices obtained via :ocv:func:`gpu::BFMatcher_GPU::matchSingle` or :ocv:func:`gpu::BFMatcher_GPU::matchCollection` to vector with :ocv:class:`DMatch`.
cuda::BFMatcher_CUDA::matchConvert
----------------------------------
Converts matrices obtained via :ocv:func:`cuda::BFMatcher_CUDA::matchSingle` or :ocv:func:`cuda::BFMatcher_CUDA::matchCollection` to vector with :ocv:class:`DMatch`.
@ -457,41 +457,41 @@ The third variant of the method stores the results in GPU memory.
gpu::BFMatcher_GPU::knnMatchDownload
------------------------------------------------
Downloads matrices obtained via :ocv:func:`gpu::BFMatcher_GPU::knnMatchSingle` or :ocv:func:`gpu::BFMatcher_GPU::knnMatch2Collection` to vector with :ocv:class:`DMatch`.
cuda::BFMatcher_CUDA::knnMatchDownload
--------------------------------------
Downloads matrices obtained via :ocv:func:`cuda::BFMatcher_CUDA::knnMatchSingle` or :ocv:func:`cuda::BFMatcher_CUDA::knnMatch2Collection` to vector with :ocv:class:`DMatch`.
If ``compactResult`` is ``true`` , the ``matches`` vector does not contain matches for fully masked-out query descriptors.
gpu::BFMatcher_GPU::knnMatchConvert
------------------------------------------------
Converts matrices obtained via :ocv:func:`gpu::BFMatcher_GPU::knnMatchSingle` or :ocv:func:`gpu::BFMatcher_GPU::knnMatch2Collection` to CPU vector with :ocv:class:`DMatch`.
cuda::BFMatcher_CUDA::knnMatchConvert
-------------------------------------
Converts matrices obtained via :ocv:func:`cuda::BFMatcher_CUDA::knnMatchSingle` or :ocv:func:`cuda::BFMatcher_CUDA::knnMatch2Collection` to CPU vector with :ocv:class:`DMatch`.
Downloads matrices obtained via :ocv:func:`gpu::BFMatcher_GPU::radiusMatchSingle` or :ocv:func:`gpu::BFMatcher_GPU::radiusMatchCollection` to vector with :ocv:class:`DMatch`.
cuda::BFMatcher_CUDA::radiusMatchDownload
-----------------------------------------
Downloads matrices obtained via :ocv:func:`cuda::BFMatcher_CUDA::radiusMatchSingle` or :ocv:func:`cuda::BFMatcher_CUDA::radiusMatchCollection` to vector with :ocv:class:`DMatch`.
Converts matrices obtained via :ocv:func:`gpu::BFMatcher_GPU::radiusMatchSingle` or :ocv:func:`gpu::BFMatcher_GPU::radiusMatchCollection` to vector with :ocv:class:`DMatch`.
cuda::BFMatcher_CUDA::radiusMatchConvert
----------------------------------------
Converts matrices obtained via :ocv:func:`cuda::BFMatcher_CUDA::radiusMatchSingle` or :ocv:func:`cuda::BFMatcher_CUDA::radiusMatchCollection` to vector with :ocv:class:`DMatch`.
@ -37,11 +39,11 @@ Applies the specified filter to the image.
gpu::createBoxFilter
--------------------
cuda::createBoxFilter
---------------------
Creates a normalized 2D box filter.
..ocv:function:: Ptr<Filter> gpu::createBoxFilter(int srcType, int dstType, Size ksize, Point anchor = Point(-1,-1), int borderMode = BORDER_DEFAULT, Scalar borderVal = Scalar::all(0))
..ocv:function:: Ptr<Filter> cuda::createBoxFilter(int srcType, int dstType, Size ksize, Point anchor = Point(-1,-1), int borderMode = BORDER_DEFAULT, Scalar borderVal = Scalar::all(0))
:param srcType:Input image type. Only ``CV_8UC1`` and ``CV_8UC4`` are supported for now.
@ -59,11 +61,11 @@ Creates a normalized 2D box filter.
gpu::createLinearFilter
-----------------------
cuda::createLinearFilter
------------------------
Creates a non-separable linear 2D filter.
..ocv:function:: Ptr<Filter> gpu::createLinearFilter(int srcType, int dstType, InputArray kernel, Point anchor = Point(-1,-1), int borderMode = BORDER_DEFAULT, Scalar borderVal = Scalar::all(0))
..ocv:function:: Ptr<Filter> cuda::createLinearFilter(int srcType, int dstType, InputArray kernel, Point anchor = Point(-1,-1), int borderMode = BORDER_DEFAULT, Scalar borderVal = Scalar::all(0))
:param srcType:Input image type. Supports ``CV_8U`` , ``CV_16U`` and ``CV_32F`` one and four channel image.
@ -81,11 +83,11 @@ Creates a non-separable linear 2D filter.
gpu::createLaplacianFilter
--------------------------
cuda::createLaplacianFilter
---------------------------
Creates a Laplacian operator.
..ocv:function:: Ptr<Filter> gpu::createLaplacianFilter(int srcType, int dstType, int ksize = 1, double scale = 1, int borderMode = BORDER_DEFAULT, Scalar borderVal = Scalar::all(0))
..ocv:function:: Ptr<Filter> cuda::createLaplacianFilter(int srcType, int dstType, int ksize = 1, double scale = 1, int borderMode = BORDER_DEFAULT, Scalar borderVal = Scalar::all(0))
:param srcType:Input image type. Supports ``CV_8U`` , ``CV_16U`` and ``CV_32F`` one and four channel image.
@ -103,11 +105,11 @@ Creates a Laplacian operator.
gpu::createSeparableLinearFilter
--------------------------------
cuda::createSeparableLinearFilter
---------------------------------
Creates a separable linear filter.
..ocv:function:: Ptr<Filter> gpu::createSeparableLinearFilter(int srcType, int dstType, InputArray rowKernel, InputArray columnKernel, Point anchor = Point(-1,-1), int rowBorderMode = BORDER_DEFAULT, int columnBorderMode = -1)
..ocv:function:: Ptr<Filter> cuda::createSeparableLinearFilter(int srcType, int dstType, InputArray rowKernel, InputArray columnKernel, Point anchor = Point(-1,-1), int rowBorderMode = BORDER_DEFAULT, int columnBorderMode = -1)
:param srcType:Source array type.
@ -127,11 +129,11 @@ Creates a separable linear filter.
gpu::createDerivFilter
----------------------
cuda::createDerivFilter
-----------------------
Creates a generalized Deriv operator.
..ocv:function:: Ptr<Filter> gpu::createDerivFilter(int srcType, int dstType, int dx, int dy, int ksize, bool normalize = false, double scale = 1, int rowBorderMode = BORDER_DEFAULT, int columnBorderMode = -1)
..ocv:function:: Ptr<Filter> cuda::createDerivFilter(int srcType, int dstType, int dx, int dy, int ksize, bool normalize = false, double scale = 1, int rowBorderMode = BORDER_DEFAULT, int columnBorderMode = -1)
:param srcType:Source image type.
@ -153,11 +155,11 @@ Creates a generalized Deriv operator.
gpu::createSobelFilter
----------------------
cuda::createSobelFilter
-----------------------
Creates a Sobel operator.
..ocv:function:: Ptr<Filter> gpu::createSobelFilter(int srcType, int dstType, int dx, int dy, int ksize = 3, double scale = 1, int rowBorderMode = BORDER_DEFAULT, int columnBorderMode = -1)
..ocv:function:: Ptr<Filter> cuda::createSobelFilter(int srcType, int dstType, int dx, int dy, int ksize = 3, double scale = 1, int rowBorderMode = BORDER_DEFAULT, int columnBorderMode = -1)
:param srcType:Source image type.
@ -179,11 +181,11 @@ Creates a Sobel operator.
gpu::createScharrFilter
-----------------------
cuda::createScharrFilter
------------------------
Creates a vertical or horizontal Scharr operator.
..ocv:function:: Ptr<Filter> gpu::createScharrFilter(int srcType, int dstType, int dx, int dy, double scale = 1, int rowBorderMode = BORDER_DEFAULT, int columnBorderMode = -1)
..ocv:function:: Ptr<Filter> cuda::createScharrFilter(int srcType, int dstType, int dx, int dy, double scale = 1, int rowBorderMode = BORDER_DEFAULT, int columnBorderMode = -1)
:param srcType:Source image type.
@ -203,11 +205,11 @@ Creates a vertical or horizontal Scharr operator.
gpu::createGaussianFilter
-------------------------
cuda::createGaussianFilter
--------------------------
Creates a Gaussian filter.
..ocv:function:: Ptr<Filter> gpu::createGaussianFilter(int srcType, int dstType, Size ksize, double sigma1, double sigma2 = 0, int rowBorderMode = BORDER_DEFAULT, int columnBorderMode = -1)
..ocv:function:: Ptr<Filter> cuda::createGaussianFilter(int srcType, int dstType, Size ksize, double sigma1, double sigma2 = 0, int rowBorderMode = BORDER_DEFAULT, int columnBorderMode = -1)
:param srcType:Source image type.
@ -227,11 +229,11 @@ Creates a Gaussian filter.
gpu::createMorphologyFilter
---------------------------
cuda::createMorphologyFilter
----------------------------
Creates a 2D morphological filter.
..ocv:function:: Ptr<Filter> gpu::createMorphologyFilter(int op, int srcType, InputArray kernel, Point anchor = Point(-1, -1), int iterations = 1)
..ocv:function:: Ptr<Filter> cuda::createMorphologyFilter(int op, int srcType, InputArray kernel, Point anchor = Point(-1, -1), int iterations = 1)
:param op:Type of morphological operation. The following types are possible:
@ -261,11 +263,11 @@ Creates a 2D morphological filter.
gpu::createBoxMaxFilter
-----------------------
cuda::createBoxMaxFilter
------------------------
Creates the maximum filter.
..ocv:function:: Ptr<Filter> gpu::createBoxMaxFilter(int srcType, Size ksize, Point anchor = Point(-1, -1), int borderMode = BORDER_DEFAULT, Scalar borderVal = Scalar::all(0))
..ocv:function:: Ptr<Filter> cuda::createBoxMaxFilter(int srcType, Size ksize, Point anchor = Point(-1, -1), int borderMode = BORDER_DEFAULT, Scalar borderVal = Scalar::all(0))
:param srcType:Input/output image type. Only ``CV_8UC1`` and ``CV_8UC4`` are supported.
@ -279,11 +281,11 @@ Creates the maximum filter.
gpu::createBoxMinFilter
-----------------------
cuda::createBoxMinFilter
------------------------
Creates the minimum filter.
..ocv:function:: Ptr<Filter> gpu::createBoxMinFilter(int srcType, Size ksize, Point anchor = Point(-1, -1), int borderMode = BORDER_DEFAULT, Scalar borderVal = Scalar::all(0))
..ocv:function:: Ptr<Filter> cuda::createBoxMinFilter(int srcType, Size ksize, Point anchor = Point(-1, -1), int borderMode = BORDER_DEFAULT, Scalar borderVal = Scalar::all(0))
:param srcType:Input/output image type. Only ``CV_8UC1`` and ``CV_8UC4`` are supported.
@ -297,11 +299,11 @@ Creates the minimum filter.
gpu::createRowSumFilter
-----------------------
cuda::createRowSumFilter
------------------------
Creates a horizontal 1D box filter.
..ocv:function:: Ptr<Filter> gpu::createRowSumFilter(int srcType, int dstType, int ksize, int anchor = -1, int borderMode = BORDER_DEFAULT, Scalar borderVal = Scalar::all(0))
..ocv:function:: Ptr<Filter> cuda::createRowSumFilter(int srcType, int dstType, int ksize, int anchor = -1, int borderMode = BORDER_DEFAULT, Scalar borderVal = Scalar::all(0))
:param srcType:Input image type. Only ``CV_8UC1`` type is supported for now.
@ -317,11 +319,11 @@ Creates a horizontal 1D box filter.
gpu::createColumnSumFilter
--------------------------
cuda::createColumnSumFilter
---------------------------
Creates a vertical 1D box filter.
..ocv:function:: Ptr<Filter> gpu::createColumnSumFilter(int srcType, int dstType, int ksize, int anchor = -1, int borderMode = BORDER_DEFAULT, Scalar borderVal = Scalar::all(0))
..ocv:function:: Ptr<Filter> cuda::createColumnSumFilter(int srcType, int dstType, int ksize, int anchor = -1, int borderMode = BORDER_DEFAULT, Scalar borderVal = Scalar::all(0))
:param srcType:Input image type. Only ``CV_8UC1`` type is supported for now.
@ -83,11 +83,11 @@ Creates implementation for :ocv:class:`gpu::CLAHE` .
gpu::evenLevels
---------------
cuda::evenLevels
----------------
Computes levels with even distribution.
..ocv:function:: void gpu::evenLevels(OutputArray levels, int nLevels, int lowerLevel, int upperLevel)
..ocv:function:: void cuda::evenLevels(OutputArray levels, int nLevels, int lowerLevel, int upperLevel)
:param levels:Destination array. ``levels`` has 1 row, ``nLevels`` columns, and the ``CV_32SC1`` type.
@ -99,17 +99,17 @@ Computes levels with even distribution.
gpu::histEven
-------------
cuda::histEven
--------------
Calculates a histogram with evenly distributed bins.
..ocv:function:: void gpu::histEven(InputArray src, OutputArray hist, int histSize, int lowerLevel, int upperLevel, Stream& stream = Stream::Null())
..ocv:function:: void cuda::histEven(InputArray src, OutputArray hist, int histSize, int lowerLevel, int upperLevel, Stream& stream = Stream::Null())
..ocv:function:: void gpu::histEven(InputArray src, OutputArray hist, InputOutputArray buf, int histSize, int lowerLevel, int upperLevel, Stream& stream = Stream::Null())
..ocv:function:: void cuda::histEven(InputArray src, OutputArray hist, InputOutputArray buf, int histSize, int lowerLevel, int upperLevel, Stream& stream = Stream::Null())
..ocv:function:: void gpu::histEven(InputArray src, GpuMat hist[4], int histSize[4], int lowerLevel[4], int upperLevel[4], Stream& stream = Stream::Null())
..ocv:function:: void cuda::histEven(InputArray src, GpuMat hist[4], int histSize[4], int lowerLevel[4], int upperLevel[4], Stream& stream = Stream::Null())
..ocv:function:: void gpu::histEven(InputArray src, GpuMat hist[4], InputOutputArray buf, int histSize[4], int lowerLevel[4], int upperLevel[4], Stream& stream = Stream::Null())
..ocv:function:: void cuda::histEven(InputArray src, GpuMat hist[4], InputOutputArray buf, int histSize[4], int lowerLevel[4], int upperLevel[4], Stream& stream = Stream::Null())
:param src:Source image. ``CV_8U``, ``CV_16U``, or ``CV_16S`` depth and 1 or 4 channels are supported. For a four-channel image, all channels are processed separately.
@ -127,17 +127,17 @@ Calculates a histogram with evenly distributed bins.
gpu::histRange
--------------
cuda::histRange
---------------
Calculates a histogram with bins determined by the ``levels`` array.
:param src:Source image. ``CV_8U`` , ``CV_16U`` , or ``CV_16S`` depth and 1 or 4 channels are supported. For a four-channel image, all channels are processed separately.
@ -127,11 +127,11 @@ Finds line segments in a binary image using the probabilistic Hough transform.
gpu::createHoughSegmentDetector
-------------------------------
Creates implementation for :ocv:class:`gpu::HoughSegmentDetector` .
cuda::createHoughSegmentDetector
--------------------------------
Creates implementation for :ocv:class:`cuda::HoughSegmentDetector` .
..ocv:function:: Ptr<HoughSegmentDetector> gpu::createHoughSegmentDetector(float rho, float theta, int minLineLength, int maxLineGap, int maxLines = 4096)
..ocv:function:: Ptr<HoughSegmentDetector> cuda::createHoughSegmentDetector(float rho, float theta, int minLineLength, int maxLineGap, int maxLines = 4096)
:param rho:Distance resolution of the accumulator in pixels.
@ -145,9 +145,9 @@ Creates implementation for :ocv:class:`gpu::HoughSegmentDetector` .
gpu::HoughCirclesDetector
-------------------------
..ocv:class::gpu::HoughCirclesDetector : public Algorithm
cuda::HoughCirclesDetector
--------------------------
..ocv:class::cuda::HoughCirclesDetector : public Algorithm
Base class for circles detector algorithm. ::
@ -180,11 +180,11 @@ Base class for circles detector algorithm. ::
gpu::HoughCirclesDetector::detect
---------------------------------
cuda::HoughCirclesDetector::detect
----------------------------------
Finds circles in a grayscale image using the Hough transform.
@ -194,11 +194,11 @@ Finds circles in a grayscale image using the Hough transform.
gpu::createHoughCirclesDetector
-------------------------------
Creates implementation for :ocv:class:`gpu::HoughCirclesDetector` .
cuda::createHoughCirclesDetector
--------------------------------
Creates implementation for :ocv:class:`cuda::HoughCirclesDetector` .
..ocv:function:: Ptr<HoughCirclesDetector> gpu::createHoughCirclesDetector(float dp, float minDist, int cannyThreshold, int votesThreshold, int minRadius, int maxRadius, int maxCircles = 4096)
..ocv:function:: Ptr<HoughCirclesDetector> cuda::createHoughCirclesDetector(float dp, float minDist, int cannyThreshold, int votesThreshold, int minRadius, int maxRadius, int maxCircles = 4096)
:param dp:Inverse ratio of the accumulator resolution to the image resolution. For example, if ``dp=1`` , the accumulator has the same resolution as the input image. If ``dp=2`` , the accumulator has half as big width and height.
@ -216,19 +216,19 @@ Creates implementation for :ocv:class:`gpu::HoughCirclesDetector` .
gpu::createGeneralizedHoughBallard
----------------------------------
cuda::createGeneralizedHoughBallard
-----------------------------------
Creates implementation for generalized hough transform from [Ballard1981]_ .
* A stereo matching example using several GPU's can be found at opencv_source_code/samples/gpu/stereo_multi.cpp
* A stereo matching example using several GPU's and driver API can be found at opencv_source_code/samples/gpu/driver_api_stereo_multi.cpp
gpu::StereoBM
-------------
..ocv:class:: gpu::StereoBM : public cv::StereoBM
cuda::StereoBM
--------------
..ocv:class:: cuda::StereoBM : public cv::StereoBM
Class computing stereo correspondence (disparity map) using the block matching algorithm. ::
@ -19,11 +21,11 @@ Class computing stereo correspondence (disparity map) using the block matching a
gpu::createStereoBM
-------------------
cuda::createStereoBM
--------------------
Creates StereoBM object.
..ocv:function:: Ptr<gpu::StereoBM> gpu::createStereoBM(int numDisparities = 64, int blockSize = 19)
..ocv:function:: Ptr<cuda::StereoBM> cuda::createStereoBM(int numDisparities = 64, int blockSize = 19)
:param numDisparities:the disparity search range. For each pixel algorithm will find the best disparity from 0 (default minimum disparity) to ``numDisparities``. The search range can then be shifted by changing the minimum disparity.
@ -31,9 +33,9 @@ Creates StereoBM object.
gpu::StereoBeliefPropagation
----------------------------
..ocv:class::gpu::StereoBeliefPropagation : public cv::StereoMatcher
cuda::StereoBeliefPropagation
-----------------------------
..ocv:class::cuda::StereoBeliefPropagation : public cv::StereoMatcher
Class computing stereo correspondence using the belief propagation algorithm. ::
@ -118,11 +120,11 @@ By default, ``StereoBeliefPropagation`` uses floating-point arithmetics and the
gpu::createStereoBeliefPropagation
----------------------------------
cuda::createStereoBeliefPropagation
-----------------------------------
Creates StereoBeliefPropagation object.
..ocv:function:: Ptr<gpu::StereoBeliefPropagation> gpu::createStereoBeliefPropagation(int ndisp = 64, int iters = 5, int levels = 5, int msg_type = CV_32F)
..ocv:function:: Ptr<cuda::StereoBeliefPropagation> cuda::createStereoBeliefPropagation(int ndisp = 64, int iters = 5, int levels = 5, int msg_type = CV_32F)
Uses a heuristic method to compute the recommended parameters ( ``ndisp``, ``iters`` and ``levels`` ) for the specified image size ( ``width`` and ``height`` ).
@ -142,13 +142,13 @@ The function is parallelized with the TBB library.
If you are using the C version, make sure you call ``cv::initModule_nonfree()`` from ``nonfree/nonfree.hpp``.
gpu::SURF_GPU
-------------
..ocv:class::gpu::SURF_GPU
cuda::SURF_CUDA
---------------
..ocv:class::cuda::SURF_CUDA
Class used for extracting Speeded Up Robust Features (SURF) from an image. ::
class SURF_GPU
class SURF_CUDA
{
public:
enum KeypointLayout
@ -164,9 +164,9 @@ Class used for extracting Speeded Up Robust Features (SURF) from an image. ::
};
//! the default constructor
SURF_GPU();
SURF_CUDA();
//! the full constructor taking all the necessary parameters
explicit SURF_GPU(double _hessianThreshold, int _nOctaves=4,
explicit SURF_CUDA(double _hessianThreshold, int _nOctaves=4,
int _nOctaveLayers=2, bool _extended=false, float _keypointsRatio=0.01f);
//! returns the descriptor size in float's (64 or 128)
@ -225,9 +225,9 @@ Class used for extracting Speeded Up Robust Features (SURF) from an image. ::
};
The class ``SURF_GPU`` implements Speeded Up Robust Features descriptor. There is a fast multi-scale Hessian keypoint detector that can be used to find the keypoints (which is the default option). But the descriptors can also be computed for the user-specified keypoints. Only 8-bit grayscale images are supported.
The class ``SURF_CUDA`` implements Speeded Up Robust Features descriptor. There is a fast multi-scale Hessian keypoint detector that can be used to find the keypoints (which is the default option). But the descriptors can also be computed for the user-specified keypoints. Only 8-bit grayscale images are supported.
The class ``SURF_GPU`` can store results in the GPU and CPU memory. It provides functions to convert results between CPU and GPU version ( ``uploadKeypoints``, ``downloadKeypoints``, ``downloadDescriptors`` ). The format of CPU results is the same as ``SURF`` results. GPU results are stored in ``GpuMat``. The ``keypoints`` matrix is :math:`\texttt{nFeatures} \times 7` matrix with the ``CV_32FC1`` type.
The class ``SURF_CUDA`` can store results in the GPU and CPU memory. It provides functions to convert results between CPU and GPU version ( ``uploadKeypoints``, ``downloadKeypoints``, ``downloadDescriptors`` ). The format of CPU results is the same as ``SURF`` results. GPU results are stored in ``GpuMat``. The ``keypoints`` matrix is :math:`\texttt{nFeatures} \times 7` matrix with the ``CV_32FC1`` type.
* ``keypoints.ptr<float>(X_ROW)[i]`` contains x coordinate of the i-th feature.
* ``keypoints.ptr<float>(Y_ROW)[i]`` contains y coordinate of the i-th feature.
@ -239,7 +239,7 @@ The class ``SURF_GPU`` can store results in the GPU and CPU memory. It provides
The ``descriptors`` matrix is :math:`\texttt{nFeatures} \times \texttt{descriptorSize}` matrix with the ``CV_32FC1`` type.
The class ``SURF_GPU`` uses some buffers and provides access to it. All buffers can be safely released between function calls.
The class ``SURF_CUDA`` uses some buffers and provides access to it. All buffers can be safely released between function calls.
@ -99,11 +99,11 @@ The function converts images to CIELAB colorspace and then separately denoise L
gpu::nonLocalMeans
cuda::nonLocalMeans
-------------------
Performs pure non local means denoising without any simplification, and thus it is not fast.
..ocv:function:: void gpu::nonLocalMeans(const GpuMat& src, GpuMat& dst, float h, int search_window = 21, int block_size = 7, int borderMode = BORDER_DEFAULT, Stream& s = Stream::Null())
..ocv:function:: void cuda::nonLocalMeans(const GpuMat& src, GpuMat& dst, float h, int search_window = 21, int block_size = 7, int borderMode = BORDER_DEFAULT, Stream& s = Stream::Null())
:param src:Source image. Supports only CV_8UC1, CV_8UC2 and CV_8UC3.
@ -125,9 +125,9 @@ Performs pure non local means denoising without any simplification, and thus it
gpu::FastNonLocalMeansDenoising
-------------------------------
..ocv:class::gpu::FastNonLocalMeansDenoising
cuda::FastNonLocalMeansDenoising
--------------------------------
..ocv:class::cuda::FastNonLocalMeansDenoising
::
@ -144,11 +144,11 @@ The class implements fast approximate Non Local Means Denoising algorithm.
gpu::FastNonLocalMeansDenoising::simpleMethod()
-----------------------------------------------
cuda::FastNonLocalMeansDenoising::simpleMethod()
------------------------------------------------
Perform image denoising using Non-local Means Denoising algorithm http://www.ipol.im/pub/algo/bcm_non_local_means_denoising with several computational optimizations. Noise expected to be a gaussian white noise
..ocv:function:: void gpu::FastNonLocalMeansDenoising::simpleMethod(const GpuMat& src, GpuMat& dst, float h, int search_window = 21, int block_size = 7, Stream& s = Stream::Null())
..ocv:function:: void cuda::FastNonLocalMeansDenoising::simpleMethod(const GpuMat& src, GpuMat& dst, float h, int search_window = 21, int block_size = 7, Stream& s = Stream::Null())
:param src:Input 8-bit 1-channel, 2-channel or 3-channel image.
@ -170,11 +170,11 @@ This function expected to be applied to grayscale images. For colored images loo
gpu::FastNonLocalMeansDenoising::labMethod()
--------------------------------------------
cuda::FastNonLocalMeansDenoising::labMethod()
---------------------------------------------
Modification of ``FastNonLocalMeansDenoising::simpleMethod`` for color images
..ocv:function:: void gpu::FastNonLocalMeansDenoising::labMethod(const GpuMat& src, GpuMat& dst, float h_luminance, float h_color, int search_window = 21, int block_size = 7, Stream& s = Stream::Null())
..ocv:function:: void cuda::FastNonLocalMeansDenoising::labMethod(const GpuMat& src, GpuMat& dst, float h_luminance, float h_color, int search_window = 21, int block_size = 7, Stream& s = Stream::Null())