.. highlight:: cpp
+
+
gpu::StereoBM_GPU
-----------------
.. ocv:class:: gpu::StereoBM_GPU
-Class computing stereo correspondence (disparity map) using the block matching algorithm.
-::
+Class computing stereo correspondence (disparity map) using the block matching algorithm. ::
class StereoBM_GPU
{
int winSize = DEFAULT_WINSZ);
void operator() (const GpuMat& left, const GpuMat& right,
- GpuMat& disparity);
- void operator() (const GpuMat& left, const GpuMat& right,
- GpuMat& disparity, const Stream & stream);
+ GpuMat& disparity, Stream& stream = Stream::Null());
static bool checkIfGpuCallReasonable();
};
-The class also performs pre- and post-filtering steps: Sobel pre-filtering (if ``PREFILTER_XSOBEL`` flag is set) and low textureness filtering (if ``averageTexThreshols > 0``). If ``avergeTexThreshold = 0``, low textureness filtering is disabled. Otherwise, the disparity is set to 0 in each point ``(x, y)``, where for the left image
+The class also performs pre- and post-filtering steps: Sobel pre-filtering (if ``PREFILTER_XSOBEL`` flag is set) and low textureness filtering (if ``averageTexThreshols > 0`` ). If ``avergeTexThreshold = 0`` , low textureness filtering is disabled. Otherwise, the disparity is set to 0 in each point ``(x, y)`` , where for the left image
.. math::
\sum HorizontalGradiensInWindow(x, y, winSize) < (winSize \cdot winSize) \cdot avergeTexThreshold
This means that the input left image is low textured.
-.. index:: gpu::StereoBM_GPU::StereoBM_GPU
+
gpu::StereoBM_GPU::StereoBM_GPU
-----------------------------------
+Enables :ocv:class:`gpu::StereoBM_GPU` constructors.
+
.. ocv:function:: gpu::StereoBM_GPU::StereoBM_GPU()
.. ocv:function:: gpu::StereoBM_GPU::StereoBM_GPU(int preset, int ndisparities = DEFAULT_NDISP, int winSize = DEFAULT_WINSZ)
- Enables ``StereoBM_GPU`` constructors.
-
:param preset: Parameter presetting:
* **BASIC_PRESET** Basic mode without pre-processing.
:param winSize: Block size.
-.. index:: gpu::StereoBM_GPU::operator ()
-.. _gpu::StereoBM_GPU::operator ():
gpu::StereoBM_GPU::operator ()
----------------------------------
-.. ocv:function:: void gpu::StereoBM_GPU::operator() (const GpuMat& left, const GpuMat& right, GpuMat& disparity)
+Enables the stereo correspondence operator that finds the disparity for the specified rectified stereo pair.
-.. ocv:function:: void gpu::StereoBM_GPU::operator() (const GpuMat& left, const GpuMat& right, GpuMat& disparity, const Stream& stream)
-
- Enables the stereo correspondence operator that finds the disparity for the specified rectified stereo pair.
+.. ocv:function:: void gpu::StereoBM_GPU::operator ()(const GpuMat& left, const GpuMat& right, GpuMat& disparity, Stream& stream = Stream::Null())
:param left: Left image. Only ``CV_8UC1`` type is supported.
:param stream: Stream for the asynchronous version.
+
+
gpu::StereoBM_GPU::checkIfGpuCallReasonable
-----------------------------------------------
+Uses a heuristic method to estimate whether the current GPU is faster than the CPU in this algorithm. It queries the currently active device.
+
.. ocv:function:: bool gpu::StereoBM_GPU::checkIfGpuCallReasonable()
- Uses a heuristic method to estimate whether the current GPU is faster than the CPU in this algorithm. It queries the currently active device.
+
gpu::StereoBeliefPropagation
----------------------------
int msg_type = CV_32F);
void operator()(const GpuMat& left, const GpuMat& right,
- GpuMat& disparity);
- void operator()(const GpuMat& left, const GpuMat& right,
- GpuMat& disparity, Stream& stream);
- void operator()(const GpuMat& data, GpuMat& disparity);
- void operator()(const GpuMat& data, GpuMat& disparity, Stream& stream);
+ GpuMat& disparity, Stream& stream = Stream::Null());
+ void operator()(const GpuMat& data, GpuMat& disparity, Stream& stream = Stream::Null());
int ndisp;
``width_step`` is the number of bytes in a line including padding.
+
gpu::StereoBeliefPropagation::StereoBeliefPropagation
---------------------------------------------------------
-.. ocv:function:: gpu::StereoBeliefPropagation::StereoBeliefPropagation( int ndisp = DEFAULT_NDISP, int iters = DEFAULT_ITERS, int levels = DEFAULT_LEVELS, int msg_type = CV_32F)
+Enables the :ocv:class:`gpu::StereoBeliefPropagation` constructors.
-.. ocv:function:: gpu::StereoBeliefPropagation::StereoBeliefPropagation( int ndisp, int iters, int levels, float max_data_term, float data_weight, float max_disc_term, float disc_single_jump, int msg_type = CV_32F)
+.. ocv:function:: gpu::StereoBeliefPropagation::StereoBeliefPropagation(int ndisp = DEFAULT_NDISP, int iters = DEFAULT_ITERS, int levels = DEFAULT_LEVELS, int msg_type = CV_32F)
- Enables the ``StereoBeliefPropagation`` constructors.
+.. ocv:function:: gpu::StereoBeliefPropagation::StereoBeliefPropagation(int ndisp, int iters, int levels, float max_data_term, float data_weight, float max_disc_term, float disc_single_jump, int msg_type = CV_32F)
:param ndisp: Number of disparities.
:param disc_single_jump: Discontinuity single jump.
:param msg_type: Type for messages. ``CV_16SC1`` and ``CV_32FC1`` types are supported.
-
+
``StereoBeliefPropagation`` uses a truncated linear model for the data cost and discontinuity terms:
.. math::
10 \cdot 2^{levels-1} \cdot max \_ data \_ term < SHRT \_ MAX
+
+
gpu::StereoBeliefPropagation::estimateRecommendedParams
-----------------------------------------------------------
+Uses a heuristic method to compute the recommended parameters ( ``ndisp``, ``iters`` and ``levels`` ) for the specified image size ( ``width`` and ``height`` ).
+
+.. ocv:function:: void gpu::StereoBeliefPropagation::estimateRecommendedParams(int width, int height, int& ndisp, int& iters, int& levels)
-.. ocv:function:: void gpu::StereoBeliefPropagation::estimateRecommendedParams( int width, int height, int& ndisp, int& iters, int& levels)
- Uses a heuristic method to compute the recommended parameters (``ndisp``, ``iters`` and ``levels``) for the specified image size (``width`` and ``height``).
gpu::StereoBeliefPropagation::operator ()
---------------------------------------------
-.. ocv:function:: void gpu::StereoBeliefPropagation::operator()( const GpuMat& left, const GpuMat& right, GpuMat& disparity)
-
-.. ocv:function:: void gpu::StereoBeliefPropagation::operator()( const GpuMat& left, const GpuMat& right, GpuMat& disparity, Stream& stream)
-
-.. ocv:function:: void gpu::StereoBeliefPropagation::operator()( const GpuMat& data, GpuMat& disparity)
+Enables the stereo correspondence operator that finds the disparity for the specified rectified stereo pair or data cost.
-.. ocv:function:: void gpu::StereoBeliefPropagation::operator()( const GpuMat& data, GpuMat& disparity, Stream& stream)
+.. ocv:function:: void gpu::StereoBeliefPropagation::operator ()(const GpuMat& left, const GpuMat& right, GpuMat& disparity, Stream& stream = Stream::Null())
- Enables the stereo correspondence operator that finds the disparity for the specified rectified stereo pair or data cost.
+.. ocv:function:: void gpu::StereoBeliefPropagation::operator ()(const GpuMat& data, GpuMat& disparity, Stream& stream = Stream::Null())
:param left: Left image. ``CV_8UC1`` , ``CV_8UC3`` and ``CV_8UC4`` types are supported.
:param stream: Stream for the asynchronous version.
+
+
gpu::StereoConstantSpaceBP
--------------------------
.. ocv:class:: gpu::StereoConstantSpaceBP
int msg_type = CV_32F);
void operator()(const GpuMat& left, const GpuMat& right,
- GpuMat& disparity);
- void operator()(const GpuMat& left, const GpuMat& right,
- GpuMat& disparity, Stream& stream);
+ GpuMat& disparity, Stream& stream = Stream::Null());
int ndisp;
};
-The class implements algorithm described in [Yang2010]_. ``StereoConstantSpaceBP`` supports both local minimum and global minimum data cost initialization algortihms. For more details, see the paper mentioned above. By default, a local algorithm is used. To enable a global algorithm, set ``use_local_init_data_cost`` to ``false``.
+The class implements algorithm described in [Yang2010]_. ``StereoConstantSpaceBP`` supports both local minimum and global minimum data cost initialization algortihms. For more details, see the paper mentioned above. By default, a local algorithm is used. To enable a global algorithm, set ``use_local_init_data_cost`` to ``false`` .
+
+
gpu::StereoConstantSpaceBP::StereoConstantSpaceBP
-----------------------------------------------------
+Enables the :ocv:class:`gpu::StereoConstantSpaceBP` constructors.
+
.. ocv:function:: gpu::StereoConstantSpaceBP::StereoConstantSpaceBP(int ndisp = DEFAULT_NDISP, int iters = DEFAULT_ITERS, int levels = DEFAULT_LEVELS, int nr_plane = DEFAULT_NR_PLANE, int msg_type = CV_32F)
.. ocv:function:: StereoConstantSpaceBP::StereoConstantSpaceBP(int ndisp, int iters, int levels, int nr_plane, float max_data_term, float data_weight, float max_disc_term, float disc_single_jump, int min_disp_th = 0, int msg_type = CV_32F)
- Enables the ``StereoConstantSpaceBP`` constructors.
-
:param ndisp: Number of disparities.
:param iters: Number of BP iterations on each level.
:param min_disp_th: Minimal disparity threshold.
:param msg_type: Type for messages. ``CV_16SC1`` and ``CV_32FC1`` types are supported.
-
+
``StereoConstantSpaceBP`` uses a truncated linear model for the data cost and discontinuity terms:
.. math::
10 \cdot 2^{levels-1} \cdot max \_ data \_ term < SHRT \_ MAX
+
+
gpu::StereoConstantSpaceBP::estimateRecommendedParams
---------------------------------------------------------
+Uses a heuristic method to compute parameters (ndisp, iters, levelsand nrplane) for the specified image size (widthand height).
+
+.. ocv:function:: void gpu::StereoConstantSpaceBP::estimateRecommendedParams(int width, int height, int& ndisp, int& iters, int& levels, int& nr_plane)
-.. ocv:function:: void gpu::StereoConstantSpaceBP::estimateRecommendedParams( int width, int height, int& ndisp, int& iters, int& levels, int& nr_plane)
- Uses a heuristic method to compute parameters (ndisp, iters, levelsand nrplane) for the specified image size (widthand height).
gpu::StereoConstantSpaceBP::operator ()
-------------------------------------------
-.. ocv:function:: void gpu::StereoConstantSpaceBP::operator()( const GpuMat& left, const GpuMat& right, GpuMat& disparity)
+Enables the stereo correspondence operator that finds the disparity for the specified rectified stereo pair.
-.. ocv:function:: void gpu::StereoConstantSpaceBP::operator()( const GpuMat& left, const GpuMat& right, GpuMat& disparity, Stream& stream)
-
- Enables the stereo correspondence operator that finds the disparity for the specified rectified stereo pair.
+.. ocv:function:: void gpu::StereoConstantSpaceBP::operator ()(const GpuMat& left, const GpuMat& right, GpuMat& disparity, Stream& stream = Stream::Null())
:param left: Left image. ``CV_8UC1`` , ``CV_8UC3`` and ``CV_8UC4`` types are supported.
:param stream: Stream for the asynchronous version.
+
+
gpu::DisparityBilateralFilter
-----------------------------
.. ocv:class:: gpu::DisparityBilateralFilter
float sigma_range);
void operator()(const GpuMat& disparity, const GpuMat& image,
- GpuMat& dst);
- void operator()(const GpuMat& disparity, const GpuMat& image,
- GpuMat& dst, Stream& stream);
+ GpuMat& dst, Stream& stream = Stream::Null());
...
};
The class implements [Yang2010]_ algorithm.
+
+
gpu::DisparityBilateralFilter::DisparityBilateralFilter
-----------------------------------------------------------
-.. ocv:function:: gpu::DisparityBilateralFilter::DisparityBilateralFilter( int ndisp = DEFAULT_NDISP, int radius = DEFAULT_RADIUS, int iters = DEFAULT_ITERS)
+Enables the :ocv:class:`gpu::DisparityBilateralFilter` constructors.
-.. ocv:function:: gpu::DisparityBilateralFilter::DisparityBilateralFilter( int ndisp, int radius, int iters, float edge_threshold, float max_disc_threshold, float sigma_range)
+.. ocv:function:: gpu::DisparityBilateralFilter::DisparityBilateralFilter(int ndisp = DEFAULT_NDISP, int radius = DEFAULT_RADIUS, int iters = DEFAULT_ITERS)
- Enables the ``DisparityBilateralFilter`` constructors.
+.. ocv:function:: gpu::DisparityBilateralFilter::DisparityBilateralFilter(int ndisp, int radius, int iters, float edge_threshold, float max_disc_threshold, float sigma_range)
:param ndisp: Number of disparities.
:param sigma_range: Filter range.
+
+
gpu::DisparityBilateralFilter::operator ()
----------------------------------------------
-.. ocv:function:: void gpu::DisparityBilateralFilter::operator()( const GpuMat& disparity, const GpuMat& image, GpuMat& dst)
+Refines a disparity map using joint bilateral filtering.
-.. ocv:function:: void gpu::DisparityBilateralFilter::operator()( const GpuMat& disparity, const GpuMat& image, GpuMat& dst, Stream& stream)
-
- Refines a disparity map using joint bilateral filtering.
+.. ocv:function:: void gpu::DisparityBilateralFilter::operator ()(const GpuMat& disparity, const GpuMat& image, GpuMat& dst, Stream& stream = Stream::Null())
:param disparity: Input disparity map. ``CV_8UC1`` and ``CV_16SC1`` types are supported.
:param stream: Stream for the asynchronous version.
+
+
gpu::drawColorDisp
----------------------
-.. ocv:function:: void gpu::drawColorDisp(const GpuMat& src_disp, GpuMat& dst_disp, int ndisp)
-
-.. ocv:function:: void gpu::drawColorDisp(const GpuMat& src_disp, GpuMat& dst_disp, int ndisp, const Stream& stream)
+Colors a disparity image.
- Colors a disparity image.
+.. ocv:function:: void gpu::drawColorDisp(const GpuMat& src_disp, GpuMat& dst_disp, int ndisp, Stream& stream = Stream::Null())
:param src_disp: Source disparity image. ``CV_8UC1`` and ``CV_16SC1`` types are supported.
This function draws a colored disparity map by converting disparity values from ``[0..ndisp)`` interval first to ``HSV`` color space (where different disparity values correspond to different hues) and then converting the pixels to ``RGB`` for visualization.
+
+
gpu::reprojectImageTo3D
---------------------------
-.. ocv:function:: void gpu::reprojectImageTo3D(const GpuMat& disp, GpuMat& xyzw, const Mat& Q)
-
-.. ocv:function:: void gpu::reprojectImageTo3D(const GpuMat& disp, GpuMat& xyzw, const Mat& Q, const Stream& stream)
+Reprojects a disparity image to 3D space.
- Reprojects a disparity image to 3D space.
+.. ocv:function:: void gpu::reprojectImageTo3D(const GpuMat& disp, GpuMat& xyzw, const Mat& Q, Stream& stream = Stream::Null())
:param disp: Input disparity image. ``CV_8U`` and ``CV_16S`` types are supported.
:param stream: Stream for the asynchronous version.
+.. seealso:: :ocv:func:`reprojectImageTo3D`
+
+
+
gpu::solvePnPRansac
-------------------
+Finds the object pose from 3D-2D point correspondences.
.. ocv:function:: void gpu::solvePnPRansac(const Mat& object, const Mat& image, const Mat& camera_mat, const Mat& dist_coef, Mat& rvec, Mat& tvec, bool use_extrinsic_guess=false, int num_iters=100, float max_dist=8.0, int min_inlier_count=100, vector<int>* inliers=NULL)
- Finds the object pose from 3D-2D point correspondences.
-
:param object: Single-row matrix of object points.
-
+
:param image: Single-row matrix of image points.
-
+
:param camera_mat: 3x3 matrix of intrinsic camera parameters.
-
+
:param dist_coef: Distortion coefficients. See :ocv:func:`undistortPoints` for details.
-
+
:param rvec: Output 3D rotation vector.
-
+
:param tvec: Output 3D translation vector.
-
+
:param use_extrinsic_guess: Flag to indicate that the function must use ``rvec`` and ``tvec`` as an initial transformation guess. It is not supported for now.
-
+
:param num_iters: Maximum number of RANSAC iterations.
-
+
:param max_dist: Euclidean distance threshold to detect whether point is inlier or not.
-
+
:param min_inlier_count: Flag to indicate that the function must stop if greater or equal number of inliers is achieved. It is not supported for now.
-
- :param inliers: Output vector of inlier indices.
-See Also :ocv:func:`solvePnPRansac`.
+ :param inliers: Output vector of inlier indices.
+
+.. seealso:: :ocv:func:`solvePnPRansac`
+
.. [Felzenszwalb2006] Pedro F. Felzenszwalb algorithm [Pedro F. Felzenszwalb and Daniel P. Huttenlocher. *Efficient belief propagation for early vision*. International Journal of Computer Vision, 70(1), October 2006
.. highlight:: cpp
-.. index:: gpu::DevMem2D\_
+
gpu::DevMem2D\_
---------------
typedef DevMem2D_<float> DevMem2Df;
typedef DevMem2D_<int> DevMem2Di;
-..
-
-.. index:: gpu::PtrStep\_
gpu::PtrStep\_
--------------
.. ocv:class:: gpu::PtrStep\_
-Structure similar to
-:ocv:class:`gpu::DevMem2D_` 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:`gpu::DevMem2D_` 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_
{
typedef PtrStep_<int> PtrStepi;
-.. index:: gpu::PtrElemStrp\_
gpu::PtrElemStrp\_
------------------
.. ocv:class:: gpu::PtrElemStrp\_
-Structure similar to
-:ocv:class:`gpu::DevMem2D_` but containing only a pointer and a row step in elements. Width and height fields are excluded due to performance reasons. This class can only be constructed if ``sizeof(T)`` is a multiple of 256. The structure is intended for internal use or for users who write device code.
-::
+Structure similar to :ocv:class:`gpu::DevMem2D_` but containing only a pointer and a row step in elements. Width and height fields are excluded due to performance reasons. This class can only be constructed if ``sizeof(T)`` is a multiple of 256. The structure is intended for internal use or for users who write device code. ::
template<typename T> struct PtrElemStep_ : public PtrStep_<T>
{
};
-.. index:: gpu::GpuMat
gpu::GpuMat
-----------
.. ocv:class:: gpu::GpuMat
-Base storage class for GPU memory with reference counting. Its interface matches the
-:ocv:class:`Mat` interface with the following limitations:
+Base storage class for GPU memory with reference counting. Its interface matches the :ocv:class:`Mat` interface with the following limitations:
+
+* no arbitrary dimensions support (only 2D)
+* no functions that return references to their data (because references on GPU are not valid for CPU)
+* no expression templates technique support
-*
- no arbitrary dimensions support (only 2D)
-*
- 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::DevMem2D_` and :ocv:class:`gpu::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.
+.. 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.
::
};
-.. note::
+.. note:: You are not recommended to leave static or global ``GpuMat`` variables allocated, that is, to rely on its destructor. The destruction order of such variables and CUDA context is undefined. GPU memory release function returns error if the CUDA context has been destroyed before.
+
+.. seealso:: :ocv:class:`Mat`
+
+
+
+gpu::createContinuous
+-------------------------
+Creates a continuous matrix in the GPU memory.
+
+.. ocv:function:: void gpu::createContinuous(int rows, int cols, int type, GpuMat& m)
+
+.. ocv:function:: GpuMat gpu::createContinuous(int rows, int cols, int type)
+
+.. ocv:function:: void gpu::createContinuous(Size size, int type, GpuMat& m)
+
+.. ocv:function:: GpuMat gpu::createContinuous(Size size, int type)
+
+ :param rows: Row count.
+
+ :param cols: Column count.
+
+ :param type: Type of the matrix.
+
+ :param m: Destination matrix. This parameter changes only if it has a proper type and area ( :math:`\texttt{rows} \times \texttt{cols}` ).
+
+Matrix is called continuous if its elements are stored continuously, that is, without gaps at the end of each row.
+
+
+
+gpu::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, GpuMat& m)
+
+.. ocv:function:: void gpu::ensureSizeIsEnough(Size size, int type, GpuMat& m)
+
+ :param rows: Minimum desired number of rows.
+
+ :param cols: Minimum desired number of columns.
+
+ :param size: Rows and coumns passed as a structure.
+
+ :param type: Desired matrix type.
+
+ :param m: Destination matrix.
+
+The function does not reallocate memory if the matrix has proper attributes already.
+
+
- You are not recommended to leave static or global ``GpuMat`` variables allocated, that is, to rely on its destructor. The destruction order of such variables and CUDA context is undefined. GPU memory release function returns error if the CUDA context has been destroyed before.
+gpu::registerPageLocked
+-------------------------------
+Page-locks the memory of matrix and maps it for the device(s).
+
+.. ocv:function:: void gpu::registerPageLocked(Mat& m)
+
+ :param m: Input matrix.
+
+
+
+gpu::unregisterPageLocked
+-------------------------------
+Unmaps the memory of matrix and makes it pageable again.
+
+.. ocv:function:: void gpu::unregisterPageLocked(Mat& m)
+
+ :param m: Input matrix.
-.. seealso::
- :ocv:class:`Mat`
-.. index:: gpu::CudaMem
gpu::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.
-
-*
- ``ALLOC_PAGE_LOCKED`` sets a page locked memory type used commonly for fast and asynchronous uploading/downloading data from/to GPU.
-*
- ``ALLOC_ZEROCOPY`` specifies a zero copy memory allocation that enables mapping the host memory to GPU address space, if supported.
-*
- ``ALLOC_WRITE_COMBINED`` sets the write combined buffer that is not cached by CPU. Such buffers are used to supply GPU with data when GPU only reads it. The advantage is a better CPU cache utilization.
-.. note::
- Allocation size of such memory types is usually limited. For more details, see *CUDA 2.2 Pinned Memory APIs* document or *CUDA C Programming Guide*.
+* **ALLOC_PAGE_LOCKED** sets a page locked memory type used commonly for fast and asynchronous uploading/downloading data from/to GPU.
+* **ALLOC_ZEROCOPY** specifies a zero copy memory allocation that enables mapping the host memory to GPU address space, if supported.
+* **ALLOC_WRITE_COMBINED** sets the write combined buffer that is not cached by CPU. Such buffers are used to supply GPU with data when GPU only reads it. The advantage is a better CPU cache utilization.
+
+.. note:: Allocation size of such memory types is usually limited. For more details, see *CUDA 2.2 Pinned Memory APIs* document or *CUDA C Programming Guide*.
::
};
-.. index:: gpu::CudaMem::createMatHeader
gpu::CudaMem::createMatHeader
---------------------------------
+Creates a header without reference counting to :ocv:class:`gpu::CudaMem` data.
.. ocv:function:: Mat gpu::CudaMem::createMatHeader() const
- Creates a header without reference counting to :ocv:class:`gpu::CudaMem` data.
-.. index:: gpu::CudaMem::createGpuMatHeader
gpu::CudaMem::createGpuMatHeader
------------------------------------
+Maps CPU memory to GPU address space and creates the :ocv:class:`gpu::GpuMat` header without reference counting for it.
.. ocv:function:: GpuMat gpu::CudaMem::createGpuMatHeader() const
- Maps CPU memory to GPU address space and creates the :ocv:class:`gpu::GpuMat` header without reference counting for it. This can be done only if memory was allocated with the ``ALLOC_ZEROCOPY`` 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.
+This can be done only if memory was allocated with the ``ALLOC_ZEROCOPY`` 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.
+
-.. index:: gpu::CudaMem::canMapHostMemory
gpu::CudaMem::canMapHostMemory
----------------------------------
+Returns ``true`` if the current hardware supports address space mapping and ``ALLOC_ZEROCOPY`` memory allocation.
+
.. ocv:function:: static bool gpu::CudaMem::canMapHostMemory()
- Returns ``true`` if the current hardware supports address space mapping and ``ALLOC_ZEROCOPY`` memory allocation.
-.. index:: gpu::Stream
gpu::Stream
-----------
This class encapsulates a queue of asynchronous calls. Some functions have overloads with the additional ``gpu::Stream`` parameter. The overloads do initialization work (allocate output buffers, upload constants, and so on), start the GPU kernel, and return before results are ready. You can check whether all operations are complete via :ocv:func:`gpu::Stream::queryIfComplete`. You can asynchronously upload/download data from/to page-locked buffers, using the :ocv:class:`gpu::CudaMem` or :ocv:class:`Mat` header that points to a region of :ocv:class:`gpu::CudaMem`.
-.. note::
- Currently, you may face problems if an operation is enqueued twice with different data. Some functions use the constant GPU memory, and next call may update the memory before the previous one has been finished. But calling different operations asynchronously is safe because each operation has its own constant buffer. Memory copy/upload/download/set operations to the buffers you hold are also safe.
+.. note:: Currently, you may face problems if an operation is enqueued twice with different data. Some functions use the constant GPU memory, and next call may update the memory before the previous one has been finished. But calling different operations asynchronously is safe because each operation has its own constant buffer. Memory copy/upload/download/set operations to the buffers you hold are also safe.
::
};
-.. index:: gpu::Stream::queryIfComplete
gpu::Stream::queryIfComplete
--------------------------------
+Returns ``true`` if the current stream queue is finished. Otherwise, it returns false.
+
.. ocv:function:: bool gpu::Stream::queryIfComplete()
- Returns ``true`` if the current stream queue is finished. Otherwise, it returns false.
-.. index:: gpu::Stream::waitForCompletion
gpu::Stream::waitForCompletion
----------------------------------
+Blocks the current CPU thread until all operations in the stream are complete.
+
.. ocv:function:: void gpu::Stream::waitForCompletion()
- Blocks the current CPU thread until all operations in the stream are complete.
-.. index:: gpu::StreamAccessor
gpu::StreamAccessor
-------------------
.. ocv:class:: gpu::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:`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. ::
struct StreamAccessor
{
CV_EXPORTS static cudaStream_t getStream(const Stream& stream);
};
-
-.. index:: gpu::createContinuous
-
-gpu::createContinuous
--------------------------
-.. ocv:function:: void gpu::createContinuous(int rows, int cols, int type, GpuMat& m)
-
- Creates a continuous matrix in the GPU memory.
-
- :param rows: Row count.
-
- :param cols: Column count.
-
- :param type: Type of the matrix.
-
- :param m: Destination matrix. This parameter changes only if it has a proper type and area (``rows x cols``).
-
- The following wrappers are also available:
-
-
- * .. ocv:function:: GpuMat gpu::createContinuous(int rows, int cols, int type)
-
- * .. ocv:function:: void gpu::createContinuous(Size size, int type, GpuMat& m)
-
- * .. ocv:function:: GpuMat gpu::createContinuous(Size size, int type)
-
- Matrix is called continuous if its elements are stored continuously, that is, without gaps at the end of each row.
-
-.. index:: gpu::ensureSizeIsEnough
-
-gpu::ensureSizeIsEnough
----------------------------
-.. ocv:function:: void gpu::ensureSizeIsEnough(int rows, int cols, int type, GpuMat& m)
-
-.. ocv:function:: void gpu::ensureSizeIsEnough(Size size, int type, GpuMat& m)
-
- Ensures that the size of a matrix is big enough and the matrix has a proper type. The function does not reallocate memory if the matrix has proper attributes already.
-
- :param rows: Minimum desired number of rows.
-
- :param cols: Minimum desired number of columns.
-
- :param size: Rows and coumns passed as a structure.
-
- :param type: Desired matrix type.
-
- :param m: Destination matrix.
-
-------------
.. ocv:class:: gpu::SURF_GPU
-Class used for extracting Speeded Up Robust Features (SURF) from an image.
-::
+Class used for extracting Speeded Up Robust Features (SURF) from an image. ::
class SURF_GPU : public CvSURFParams
{
public:
- enum KeypointLayout
+ enum KeypointLayout
{
SF_X = 0,
SF_Y,
bool useProvidedKeypoints = false,
bool calcOrientation = true);
+ void releaseMemory();
+
//! max keypoints = keypointsRatio * img.size().area()
float keypointsRatio;
- bool upright;
-
GpuMat sum, mask1, maskSum, intBuffer;
GpuMat det, trace;
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_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 6` matrix with the ``CV_32FC1`` type.
+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 6` matrix with the ``CV_32FC1`` type.
-* ``keypoints.ptr<float>(SF_X)[i]`` contains x coordinate of the i-th feature.
-* ``keypoints.ptr<float>(SF_Y)[i]`` contains y coordinate of the i-th feature.
-* ``keypoints.ptr<float>(SF_LAPLACIAN)[i]`` contains the laplacian sign of the i-th feature.
-* ``keypoints.ptr<float>(SF_SIZE)[i]`` contains the size of the i-th feature.
-* ``keypoints.ptr<float>(SF_DIR)[i]`` contain orientation of the i-th feature.
-* ``keypoints.ptr<float>(SF_HESSIAN)[i]`` contains the response of the i-th feature.
+* ``keypoints.ptr<float>(SF_X)[i]`` contains x coordinate of the i-th feature.
+* ``keypoints.ptr<float>(SF_Y)[i]`` contains y coordinate of the i-th feature.
+* ``keypoints.ptr<float>(SF_LAPLACIAN)[i]`` contains the laplacian sign of the i-th feature.
+* ``keypoints.ptr<float>(SF_SIZE)[i]`` contains the size of the i-th feature.
+* ``keypoints.ptr<float>(SF_DIR)[i]`` contain orientation of the i-th feature.
+* ``keypoints.ptr<float>(SF_HESSIAN)[i]`` contains the response of the i-th feature.
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.
-.. seealso::
- :ocv:class:`SURF`
+.. seealso:: :ocv:class:`SURF`
void matchSingle(const GpuMat& queryDescs, const GpuMat& trainDescs,
GpuMat& trainIdx, GpuMat& distance,
- const GpuMat& mask = GpuMat());
+ const GpuMat& mask = GpuMat(), Stream& stream = Stream::Null());
static void matchDownload(const GpuMat& trainIdx,
const GpuMat& distance, std::vector<DMatch>& matches);
+ static void matchConvert(const Mat& trainIdx,
+ const Mat& distance, std::vector<DMatch>& matches);
void match(const GpuMat& queryDescs, const GpuMat& trainDescs,
std::vector<DMatch>& matches, const GpuMat& mask = GpuMat());
void matchCollection(const GpuMat& queryDescs,
const GpuMat& trainCollection,
GpuMat& trainIdx, GpuMat& imgIdx, GpuMat& distance,
- const GpuMat& maskCollection);
+ const GpuMat& maskCollection, Stream& stream = Stream::Null());
static void matchDownload(const GpuMat& trainIdx, GpuMat& imgIdx,
const GpuMat& distance, std::vector<DMatch>& matches);
+ static void matchConvert(const Mat& trainIdx, const Mat& imgIdx,
+ const Mat& distance, std::vector<DMatch>& matches);
void match(const GpuMat& queryDescs, std::vector<DMatch>& matches,
const std::vector<GpuMat>& masks = std::vector<GpuMat>());
void knnMatch(const GpuMat& queryDescs, const GpuMat& trainDescs,
GpuMat& trainIdx, GpuMat& distance, GpuMat& allDist, int k,
- const GpuMat& mask = GpuMat());
+ const GpuMat& mask = GpuMat(), Stream& stream = Stream::Null());
static void knnMatchDownload(const GpuMat& trainIdx,
const GpuMat& distance, std::vector< std::vector<DMatch> >& matches,
bool compactResult = false);
+ static void knnMatchConvert(const Mat& trainIdx,
+ const Mat& distance, std::vector< std::vector<DMatch> >& matches,
+ bool compactResult = false);
void knnMatch(const GpuMat& queryDescs, const GpuMat& trainDescs,
std::vector< std::vector<DMatch> >& matches, int k,
void radiusMatch(const GpuMat& queryDescs, const GpuMat& trainDescs,
GpuMat& trainIdx, GpuMat& nMatches, GpuMat& distance,
- float maxDistance, const GpuMat& mask = GpuMat());
+ float maxDistance, const GpuMat& mask = GpuMat(), Stream& stream = Stream::Null());
static void radiusMatchDownload(const GpuMat& trainIdx,
const GpuMat& nMatches, const GpuMat& distance,
std::vector< std::vector<DMatch> >& matches,
bool compactResult = false);
+ static void radiusMatchConvert(const Mat& trainIdx,
+ const Mat& nMatches, const Mat& distance,
+ std::vector< std::vector<DMatch> >& matches,
+ bool compactResult = false);
void radiusMatch(const GpuMat& queryDescs, const GpuMat& trainDescs,
std::vector< std::vector<DMatch> >& matches, float maxDistance,
The class ``BruteForceMatcher_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 ``Distance`` template parameter is kept for CPU/GPU interfaces similarity. ``BruteForceMatcher_GPU`` supports only the ``L1<float>``, ``L2<float>``, and ``Hamming`` distance types.
-.. seealso::
- :ocv:class:`DescriptorMatcher`,
- :ocv:class:`BruteForceMatcher`
+.. seealso:: :ocv:class:`DescriptorMatcher`, :ocv:class:`BruteForceMatcher`
gpu::BruteForceMatcher_GPU::match
-------------------------------------
+Finds the best match for each descriptor from a query set with train descriptors.
+
.. ocv:function:: void gpu::BruteForceMatcher_GPU::match(const GpuMat& queryDescs, const GpuMat& trainDescs, std::vector<DMatch>& matches, const GpuMat& mask = GpuMat())
.. ocv:function:: void gpu::BruteForceMatcher_GPU::match(const GpuMat& queryDescs, std::vector<DMatch>& matches, const std::vector<GpuMat>& masks = std::vector<GpuMat>())
- Finds the best match for each descriptor from a query set with train descriptors.
-
-.. seealso::
- :ocv:func:`DescriptorMatcher::match`
+.. seealso:: :ocv:func:`DescriptorMatcher::match`
gpu::BruteForceMatcher_GPU::matchSingle
-------------------------------------------
-.. ocv:function:: void gpu::BruteForceMatcher_GPU::matchSingle(const GpuMat& queryDescs, const GpuMat& trainDescs, GpuMat& trainIdx, GpuMat& distance, const GpuMat& mask = GpuMat())
+Finds the best match for each query descriptor.
- Finds the best match for each query descriptor. Results are stored in the GPU memory.
+.. ocv:function:: void gpu::BruteForceMatcher_GPU::matchSingle(const GpuMat& queryDescs, const GpuMat& trainDescs, GpuMat& trainIdx, GpuMat& distance, const GpuMat& mask = GpuMat(), Stream& stream = Stream::Null())
:param queryDescs: Query set of descriptors.
-
+
:param trainDescs: Training set of descriptors. It is not added to train descriptors collection stored in the class object.
-
- :param trainIdx: Output single-row ``CV_32SC1`` matrix that contains the best train index for each query. If some query descriptors are masked out in ``mask`` , it contains -1.
-
- :param distance: Output single-row ``CV_32FC1`` matrix that contains the best distance for each query. If some query descriptors are masked out in ``mask``, it contains ``FLT_MAX``.
+
+ :param trainIdx: Output matrix that contains the best train index for each query.
+
+ :param distance: Output matrix that contains the best distance for each query.
:param mask: Mask specifying permissible matches between the input query and train matrices of descriptors.
+ :param stream: Stream for the asynchronous version.
+
+Results are stored in the GPU memory.
+
gpu::BruteForceMatcher_GPU::matchCollection
-----------------------------------------------
-.. ocv:function:: void gpu::BruteForceMatcher_GPU::matchCollection(const GpuMat& queryDescs, const GpuMat& trainCollection, GpuMat& trainIdx, GpuMat& imgIdx, GpuMat& distance, const GpuMat& maskCollection)
+Finds the best match for each query descriptor from train collection.
+
+.. ocv:function:: void gpu::BruteForceMatcher_GPU::matchCollection(const GpuMat& queryDescs, const GpuMat& trainCollection, GpuMat& trainIdx, GpuMat& imgIdx, GpuMat& distance, const GpuMat& maskCollection, Stream& stream = Stream::Null())
+
+ :param queryDescs: Query set of descriptors.
+
+ :param trainCollection: :ocv:class:`gpu::GpuMat` containing train collection. It can be obtained from the collection of train descriptors that was set using the ``add`` method by :ocv:func:`gpu::BruteForceMatcher_GPU::makeGpuCollection`. Or it may contain a user-defined collection. This is a one-row matrix where each element is ``DevMem2D`` pointing out to a matrix of train descriptors.
- Finds the best match for each query descriptor from train collection. Results are stored in the GPU memory.
+ :param trainIdx: Output matrix that contains the best train index for each query.
- :param queryDescs: Query set of descriptors.
-
- :param trainCollection: :ocv:class:`gpu::GpuMat` containing train collection. It can be obtained from the collection of train descriptors that was set using the ``add`` method by :ocv:func:`gpu::BruteForceMatcher_GPU::makeGpuCollection`. Or it may contain a user-defined collection. This is a one-row matrix where each element is ``DevMem2D`` pointing out to a matrix of train descriptors.
-
- :param trainIdx: Output single-row ``CV_32SC1`` matrix that contains the best train index for each query. If some query descriptors are masked out in ``maskCollection`` , it contains -1.
-
- :param imgIdx: Output single-row ``CV_32SC1`` matrix that contains image train index for each query. If some query descriptors are masked out in ``maskCollection`` , it contains -1.
-
- :param distance: Output single-row ``CV_32FC1`` matrix that contains the best distance for each query. If some query descriptors are masked out in ``maskCollection`` , it contains ``FLT_MAX``.
+ :param imgIdx: Output matrix that contains image train index for each query.
- :param maskCollection: ``GpuMat`` containing a set of masks. It can be obtained from ``std::vector<GpuMat>`` by :ocv:func:`gpu::BruteForceMatcher_GPU::makeGpuCollection` or it may contain a user-defined mask set. This is an empty matrix or one-row matrix where each element is a ``PtrStep`` that points to one mask.
+ :param distance: Output matrix that contains the best distance for each query.
+
+ :param maskCollection: ``GpuMat`` containing a set of masks. It can be obtained from ``std::vector<GpuMat>`` by :ocv:func:`gpu::BruteForceMatcher_GPU::makeGpuCollection` or it may contain a user-defined mask set. This is an empty matrix or one-row matrix where each element is a ``PtrStep`` that points to one mask.
+
+ :param stream: Stream for the asynchronous version.
+
+Results are stored in the GPU memory.
gpu::BruteForceMatcher_GPU::makeGpuCollection
-------------------------------------------------
-.. ocv:function:: void gpu::BruteForceMatcher_GPU::makeGpuCollection(GpuMat& trainCollection, GpuMat& maskCollection, const vector<GpuMat>&masks = std::vector<GpuMat>())
+Performs a GPU collection of train descriptors and masks in a suitable format for the :ocv:func:`gpu::BruteForceMatcher_GPU::matchCollection` function.
- Performs a GPU collection of train descriptors and masks in a suitable format for the
- :ocv:func:`gpu::BruteForceMatcher_GPU::matchCollection` function.
+.. ocv:function:: void gpu::BruteForceMatcher_GPU::makeGpuCollection(GpuMat& trainCollection, GpuMat& maskCollection, const vector<GpuMat>&masks = std::vector<GpuMat>())
gpu::BruteForceMatcher_GPU::matchDownload
---------------------------------------------
+Downloads matrices obtained via :ocv:func:`gpu::BruteForceMatcher_GPU::matchSingle` or :ocv:func:`gpu::BruteForceMatcher_GPU::matchCollection` to vector with :ocv:class:`DMatch`.
+
.. ocv:function:: void gpu::BruteForceMatcher_GPU::matchDownload(const GpuMat& trainIdx, const GpuMat& distance, std::vector<DMatch>&matches)
.. ocv:function:: void gpu::BruteForceMatcher_GPU::matchDownload(const GpuMat& trainIdx, GpuMat& imgIdx, const GpuMat& distance, std::vector<DMatch>&matches)
- Downloads ``trainIdx``, ``imgIdx``, and ``distance`` matrices obtained via
- :ocv:func:`gpu::BruteForceMatcher_GPU::matchSingle` or
- :ocv:func:`gpu::BruteForceMatcher_GPU::matchCollection` to CPU vector with :ocv:class:`DMatch`.
+
+
+gpu::BruteForceMatcher_GPU::matchConvert
+---------------------------------------------
+Converts matrices obtained via :ocv:func:`gpu::BruteForceMatcher_GPU::matchSingle` or :ocv:func:`gpu::BruteForceMatcher_GPU::matchCollection` to vector with :ocv:class:`DMatch`.
+
+.. ocv:function:: void gpu::BruteForceMatcher_GPU::matchConvert(const Mat& trainIdx, const Mat& distance, std::vector<DMatch>&matches)
+
+.. ocv:function:: void gpu::BruteForceMatcher_GPU::matchConvert(const Mat& trainIdx, const Mat& imgIdx, const Mat& distance, std::vector<DMatch>&matches)
gpu::BruteForceMatcher_GPU::knnMatch
----------------------------------------
+Finds the k best matches for each descriptor from a query set with train descriptors.
+
.. ocv:function:: void gpu::BruteForceMatcher_GPU::knnMatch(const GpuMat& queryDescs, const GpuMat& trainDescs, std::vector< std::vector<DMatch> >&matches, int k, const GpuMat& mask = GpuMat(), bool compactResult = false)
.. ocv:function:: void gpu::BruteForceMatcher_GPU::knnMatch(const GpuMat& queryDescs, std::vector< std::vector<DMatch> >&matches, int k, const std::vector<GpuMat>&masks = std::vector<GpuMat>(), bool compactResult = false )
-.. ocv:function:: void gpu::BruteForceMatcher_GPU::knnMatch(const GpuMat& queryDescs, const GpuMat& trainDescs, GpuMat& trainIdx, GpuMat& distance, GpuMat& allDist, int k, const GpuMat& mask = GpuMat())
-
- Finds the k best matches for each descriptor from a query set with train descriptors. The function returns detected k (or less if not possible) matches in the increasing order by distance.
+.. ocv:function:: void gpu::BruteForceMatcher_GPU::knnMatch(const GpuMat& queryDescs, const GpuMat& trainDescs, GpuMat& trainIdx, GpuMat& distance, GpuMat& allDist, int k, const GpuMat& mask = GpuMat(), Stream& stream = Stream::Null())
:param queryDescs: Query set of descriptors.
+
:param trainDescs: Training set of descriptors. It is not be added to train descriptors collection stored in the class object.
- :param trainIdx: Output matrix of ``queryDescs.rows x k`` size and ``CV_32SC1`` type. ``trainIdx.at<int>(i, j)`` contains an index of the j-th best match for the i-th query descriptor. If some query descriptors are masked out in ``mask``, it contains -1.
- :param distance: Output matrix of ``queryDescs.rows x k`` size and ``CV_32FC1`` type. ``distance.at<float>(i, j)`` contains a distance from the j-th best match for the i-th query descriptor to the query descriptor. If some query descriptors are masked out in ``mask``, it contains ``FLT_MAX``.
- :param allDist: Floating-point matrix of the size ``queryDescs.rows x trainDescs.rows``. This is a buffer to store all distances between each query descriptors and each train descriptor. On output, ``allDist.at<float>(queryIdx, trainIdx)`` contains ``FLT_MAX`` if ``trainIdx`` is one from k best.
+
+ :param trainIdx: Output matrix that contains the best train index for each query.
+
+ :param distance: Output matrix that contains the best distance for each query.
+
+ :param allDist: Output matrix that contains all distances between each query descriptors and each train descriptor.
:param k: Number of the best matches per each query descriptor (or less if it is not possible).
:param mask: Mask specifying permissible matches between the input query and train matrices of descriptors.
+ :param compactResult: If ``compactResult`` is ``true`` , the ``matches`` vector does not contain matches for fully masked-out query descriptors.
+
+ :param stream: Stream for the asynchronous version.
+
+The function returns detected k (or less if not possible) matches in the increasing order by distance.
+
The third variant of the method stores the results in GPU memory.
-.. seealso::
- :ocv:func:`DescriptorMatcher::knnMatch`
+.. seealso:: :ocv:func:`DescriptorMatcher::knnMatch`
+
gpu::BruteForceMatcher_GPU::knnMatchDownload
------------------------------------------------
+Downloads matrices obtained via :ocv:func:`gpu::BruteForceMatcher_GPU::knnMatch` to vector with :ocv:class:`DMatch`.
+
.. ocv:function:: void gpu::BruteForceMatcher_GPU::knnMatchDownload(const GpuMat& trainIdx, const GpuMat& distance, std::vector< std::vector<DMatch> >&matches, bool compactResult = false)
- Downloads ``trainIdx`` and ``distance`` matrices obtained via :ocv:func:`gpu::BruteForceMatcher_GPU::knnMatch` to CPU vector with :ocv:class:`DMatch`. If ``compactResult`` is true, the ``matches`` vector does not contain matches for fully masked-out query descriptors.
+If ``compactResult`` is ``true`` , the ``matches`` vector does not contain matches for fully masked-out query descriptors.
+
+
+
+gpu::BruteForceMatcher_GPU::knnMatchConvert
+------------------------------------------------
+Converts matrices obtained via :ocv:func:`gpu::BruteForceMatcher_GPU::knnMatch` to CPU vector with :ocv:class:`DMatch`.
+
+.. ocv:function:: void gpu::BruteForceMatcher_GPU::knnMatchConvert(const Mat& trainIdx, const Mat& distance, std::vector< std::vector<DMatch> >&matches, bool compactResult = false)
+
+If ``compactResult`` is ``true`` , the ``matches`` vector does not contain matches for fully masked-out query descriptors.
gpu::BruteForceMatcher_GPU::radiusMatch
-------------------------------------------
+For each query descriptor, finds the best matches with a distance less than a given threshold.
+
.. ocv:function:: void gpu::BruteForceMatcher_GPU::radiusMatch(const GpuMat& queryDescs, const GpuMat& trainDescs, std::vector< std::vector<DMatch> >&matches, float maxDistance, const GpuMat& mask = GpuMat(), bool compactResult = false)
.. ocv:function:: void gpu::BruteForceMatcher_GPU::radiusMatch(const GpuMat& queryDescs, std::vector< std::vector<DMatch> >&matches, float maxDistance, const std::vector<GpuMat>&masks = std::vector<GpuMat>(), bool compactResult = false)
-.. ocv:function:: void gpu::BruteForceMatcher_GPU::radiusMatch(const GpuMat& queryDescs, const GpuMat& trainDescs, GpuMat& trainIdx, GpuMat& nMatches, GpuMat& distance, float maxDistance, const GpuMat& mask = GpuMat())
-
- For each query descriptor, finds the best matches with a distance less than a given threshold. The function returns detected matches in the increasing order by distance.
+.. ocv:function:: void gpu::BruteForceMatcher_GPU::radiusMatch(const GpuMat& queryDescs, const GpuMat& trainDescs, GpuMat& trainIdx, GpuMat& nMatches, GpuMat& distance, float maxDistance, const GpuMat& mask = GpuMat(), Stream& stream = Stream::Null())
:param queryDescs: Query set of descriptors.
-
+
:param trainDescs: Training set of descriptors. It is not added to train descriptors collection stored in the class object.
-
- :param trainIdx: ``trainIdx.at<int>(i, j)`` , the index of j-th training descriptor, which is close enough to i-th query descriptor. If ``trainIdx`` is empty, it is created with the size ``queryDescs.rows x trainDescs.rows``. When the matrix is pre-allocated, it can have less than ``trainDescs.rows`` columns. Then, the function returns as many matches for each query descriptor as fit into the matrix.
-
- :param nMatches: ``nMatches.at<unsigned int>(0, i)`` containing the number of matching descriptors for the i-th query descriptor. The value can be larger than ``trainIdx.cols`` , which means that the function could not store all the matches since it does not have enough memory.
-
- :param distance: Distance ``distance.at<int>(i, j)`` between the j-th match for the j-th query descriptor and this very query descriptor. The matrix has the ``CV_32FC1`` type and the same size as ``trainIdx``.
+
+ :param trainIdx: Output matrix that contains the best train index for each query.
+
+ :param nMatches: Output matrix that contains the number of matching descriptors for each query.
+
+ :param distance: Output matrix that contains the best distance for each query.
:param maxDistance: Distance threshold.
:param mask: Mask specifying permissible matches between the input query and train matrices of descriptors.
+ :param compactResult: If ``compactResult`` is ``true`` , the ``matches`` vector does not contain matches for fully masked-out query descriptors.
+
+ :param stream: Stream for the asynchronous version.
+
+The function returns detected matches in the increasing order by distance.
+
The methods work only on devices with the compute capability :math:`>=` 1.1.
+
The third variant of the method stores the results in GPU memory and does not store the points by the distance.
-.. seealso::
- :ocv:func:`DescriptorMatcher::radiusMatch`
+.. seealso:: :ocv:func:`DescriptorMatcher::radiusMatch`
+
gpu::BruteForceMatcher_GPU::radiusMatchDownload
---------------------------------------------------
+Downloads matrices obtained via :ocv:func:`gpu::BruteForceMatcher_GPU::radiusMatch` to vector with :ocv:class:`DMatch`.
+
.. ocv:function:: void gpu::BruteForceMatcher_GPU::radiusMatchDownload(const GpuMat& trainIdx, const GpuMat& nMatches, const GpuMat& distance, std::vector< std::vector<DMatch> >&matches, bool compactResult = false)
- Downloads ``trainIdx``, ``nMatches`` and ``distance`` matrices obtained via :ocv:func:`gpu::BruteForceMatcher_GPU::radiusMatch` to CPU vector with :ocv:class:`DMatch`. If ``compactResult`` is true, the ``matches`` vector does not contain matches for fully masked-out query descriptors.
+If ``compactResult`` is ``true`` , the ``matches`` vector does not contain matches for fully masked-out query descriptors.
+
+
+
+
+gpu::BruteForceMatcher_GPU::radiusMatchConvert
+---------------------------------------------------
+Converts matrices obtained via :ocv:func:`gpu::BruteForceMatcher_GPU::radiusMatch` to vector with :ocv:class:`DMatch`.
+
+.. ocv:function:: void gpu::BruteForceMatcher_GPU::radiusMatchConvert(const Mat& trainIdx, const Mat& nMatches, const Mat& distance, std::vector< std::vector<DMatch> >&matches, bool compactResult = false)
+
+If ``compactResult`` is ``true`` , the ``matches`` vector does not contain matches for fully masked-out query descriptors.
Functions and classes described in this section are used to perform various linear or non-linear filtering operations on 2D images.
-.. index:: gpu::BaseRowFilter_GPU
+
gpu::BaseRowFilter_GPU
----------------------
public:
BaseRowFilter_GPU(int ksize_, int anchor_);
virtual ~BaseRowFilter_GPU() {}
- virtual void operator()(const GpuMat& src, GpuMat& dst) = 0;
+ virtual void operator()(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null()) = 0;
int ksize, anchor;
};
.. note:: This class does not allocate memory for a destination image. Usually this class is used inside :ocv:class:`gpu::FilterEngine_GPU`.
-.. index:: gpu::BaseColumnFilter_GPU
+
gpu::BaseColumnFilter_GPU
-------------------------
public:
BaseColumnFilter_GPU(int ksize_, int anchor_);
virtual ~BaseColumnFilter_GPU() {}
- virtual void operator()(const GpuMat& src, GpuMat& dst) = 0;
+ virtual void operator()(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null()) = 0;
int ksize, anchor;
};
.. note:: This class does not allocate memory for a destination image. Usually this class is used inside :ocv:class:`gpu::FilterEngine_GPU`.
-.. index:: gpu::BaseFilter_GPU
+
gpu::BaseFilter_GPU
-------------------
public:
BaseFilter_GPU(const Size& ksize_, const Point& anchor_);
virtual ~BaseFilter_GPU() {}
- virtual void operator()(const GpuMat& src, GpuMat& dst) = 0;
+ virtual void operator()(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null()) = 0;
Size ksize;
Point anchor;
};
.. note:: This class does not allocate memory for a destination image. Usually this class is used inside :ocv:class:`gpu::FilterEngine_GPU`.
-.. index:: gpu::FilterEngine_GPU
+
gpu::FilterEngine_GPU
---------------------
virtual ~FilterEngine_GPU() {}
virtual void apply(const GpuMat& src, GpuMat& dst,
- Rect roi = Rect(0,0,-1,-1)) = 0;
+ Rect roi = Rect(0,0,-1,-1), Stream& stream = Stream::Null()) = 0;
};
-The class can be used to apply an arbitrary filtering operation to an image. It contains all the necessary intermediate buffers. Pointers to the initialized ``FilterEngine_GPU`` instances are returned by various ``create*Filter_GPU`` functions (see below), and they are used inside high-level functions such as
-:ocv:func:`gpu::filter2D`, :ocv:func:`gpu::erode`, :ocv:func:`gpu::Sobel` , and others.
+The class can be used to apply an arbitrary filtering operation to an image. It contains all the necessary intermediate buffers. Pointers to the initialized ``FilterEngine_GPU`` instances are returned by various ``create*Filter_GPU`` functions (see below), and they are used inside high-level functions such as :ocv:func:`gpu::filter2D`, :ocv:func:`gpu::erode`, :ocv:func:`gpu::Sobel` , and others.
-By using ``FilterEngine_GPU`` instead of functions you can avoid unnecessary memory allocation for intermediate buffers and get better performance:
-::
+By using ``FilterEngine_GPU`` instead of functions you can avoid unnecessary memory allocation for intermediate buffers and get better performance: ::
while (...)
{
// Release buffers only once
filter.release();
- ``FilterEngine_GPU`` can process a rectangular sub-region of an image. By default, if ``roi == Rect(0,0,-1,-1)``, ``FilterEngine_GPU`` processes the inner region of an image ( ``Rect(anchor.x, anchor.y, src_size.width - ksize.width, src_size.height - ksize.height)`` ) because some filters do not check whether indices are outside the image for better perfomance. See below to understand which filters support processing the whole image and which do not and identify image type limitations.
+
+``FilterEngine_GPU`` can process a rectangular sub-region of an image. By default, if ``roi == Rect(0,0,-1,-1)`` , ``FilterEngine_GPU`` processes the inner region of an image ( ``Rect(anchor.x, anchor.y, src_size.width - ksize.width, src_size.height - ksize.height)`` ) because some filters do not check whether indices are outside the image for better perfomance. See below to understand which filters support processing the whole image and which do not and identify image type limitations.
.. note:: The GPU filters do not support the in-place mode.
-.. seealso::
+.. seealso:: :ocv:class:`gpu::BaseRowFilter_GPU`, :ocv:class:`gpu::BaseColumnFilter_GPU`, :ocv:class:`gpu::BaseFilter_GPU`, :ocv:func:`gpu::createFilter2D_GPU`, :ocv:func:`gpu::createSeparableFilter_GPU`, :ocv:func:`gpu::createBoxFilter_GPU`, :ocv:func:`gpu::createMorphologyFilter_GPU`, :ocv:func:`gpu::createLinearFilter_GPU`, :ocv:func:`gpu::createSeparableLinearFilter_GPU`, :ocv:func:`gpu::createDerivFilter_GPU`, :ocv:func:`gpu::createGaussianFilter_GPU`
- :ocv:class:`gpu::BaseRowFilter_GPU`,
- :ocv:class:`gpu::BaseColumnFilter_GPU`,
- :ocv:class:`gpu::BaseFilter_GPU`,
- :ocv:func:`gpu::createFilter2D_GPU`,
- :ocv:func:`gpu::createSeparableFilter_GPU`,
- :ocv:func:`gpu::createBoxFilter_GPU`,
- :ocv:func:`gpu::createMorphologyFilter_GPU`,
- :ocv:func:`gpu::createLinearFilter_GPU`,
- :ocv:func:`gpu::createSeparableLinearFilter_GPU`,
- :ocv:func:`gpu::createDerivFilter_GPU`,
- :ocv:func:`gpu::createGaussianFilter_GPU`
-.. index:: gpu::createFilter2D_GPU
gpu::createFilter2D_GPU
---------------------------
-.. ocv:function:: Ptr<FilterEngine_GPU> gpu::createFilter2D_GPU( const Ptr<BaseFilter_GPU>& filter2D, int srcType, int dstType)
+Creates a non-separable filter engine with the specified filter.
- Creates a non-separable filter engine with the specified filter.
+.. ocv:function:: Ptr<FilterEngine_GPU> gpu::createFilter2D_GPU( const Ptr<BaseFilter_GPU>& filter2D, int srcType, int dstType)
:param filter2D: Non-separable 2D filter.
Usually this function is used inside such high-level functions as :ocv:func:`gpu::createLinearFilter_GPU`, :ocv:func:`gpu::createBoxFilter_GPU`.
-.. index:: gpu::createSeparableFilter_GPU
+
gpu::createSeparableFilter_GPU
----------------------------------
-.. ocv:function:: Ptr<FilterEngine_GPU> gpu::createSeparableFilter_GPU( const Ptr<BaseRowFilter_GPU>& rowFilter, const Ptr<BaseColumnFilter_GPU>& columnFilter, int srcType, int bufType, int dstType)
+Creates a separable filter engine with the specified filters.
- Creates a separable filter engine with the specified filters.
+.. ocv:function:: Ptr<FilterEngine_GPU> gpu::createSeparableFilter_GPU( const Ptr<BaseRowFilter_GPU>& rowFilter, const Ptr<BaseColumnFilter_GPU>& columnFilter, int srcType, int bufType, int dstType)
:param rowFilter: "Horizontal" 1D filter.
-
+
:param columnFilter: "Vertical" 1D filter.
- :param srcType: Input image type. It must be supported by ``rowFilter``.
+ :param srcType: Input image type. It must be supported by ``rowFilter`` .
- :param bufType: Buffer image type. It must be supported by ``rowFilter`` and ``columnFilter``.
+ :param bufType: Buffer image type. It must be supported by ``rowFilter`` and ``columnFilter`` .
- :param dstType: Output image type. It must be supported by ``columnFilter``.
+ :param dstType: Output image type. It must be supported by ``columnFilter`` .
Usually this function is used inside such high-level functions as :ocv:func:`gpu::createSeparableLinearFilter_GPU`.
-.. index:: gpu::getRowSumFilter_GPU
+
gpu::getRowSumFilter_GPU
----------------------------
-.. ocv:function:: Ptr<BaseRowFilter_GPU> gpu::getRowSumFilter_GPU(int srcType, int sumType, int ksize, int anchor = -1)
+Creates a horizontal 1D box filter.
- Creates a horizontal 1D box filter.
+.. ocv:function:: Ptr<BaseRowFilter_GPU> gpu::getRowSumFilter_GPU(int srcType, int sumType, int ksize, int anchor = -1)
:param srcType: Input image type. Only ``CV_8UC1`` type is supported for now.
.. note:: This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.
-.. index:: gpu::getColumnSumFilter_GPU
+
gpu::getColumnSumFilter_GPU
-------------------------------
-.. ocv:function:: Ptr<BaseColumnFilter_GPU> gpu::getColumnSumFilter_GPU(int sumType, int dstType, int ksize, int anchor = -1)
+Creates a vertical 1D box filter.
- Creates a vertical 1D box filter.
+.. ocv:function:: Ptr<BaseColumnFilter_GPU> gpu::getColumnSumFilter_GPU(int sumType, int dstType, int ksize, int anchor = -1)
:param sumType: Input image type. Only ``CV_8UC1`` type is supported for now.
.. note:: This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.
-.. index:: gpu::createBoxFilter_GPU
+
gpu::createBoxFilter_GPU
----------------------------
-.. ocv:function:: Ptr<FilterEngine_GPU> gpu::createBoxFilter_GPU(int srcType, int dstType, const Size& ksize, const Point& anchor = Point(-1,-1))
+Creates a normalized 2D box filter.
- Creates a normalized 2D box filter.
+.. ocv:function:: Ptr<FilterEngine_GPU> gpu::createBoxFilter_GPU(int srcType, int dstType, const Size& ksize, const Point& anchor = Point(-1,-1))
.. ocv:function:: Ptr<BaseFilter_GPU> getBoxFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1, -1))
- :param srcType: Input image type supporting ``CV_8UC1`` and ``CV_8UC4``.
+ :param srcType: Input image type supporting ``CV_8UC1`` and ``CV_8UC4`` .
:param dstType: Output image type. It supports only the same values as the source type.
.. seealso:: :ocv:func:`boxFilter`
-.. index:: gpu::boxFilter
+
gpu::boxFilter
------------------
-.. ocv:function:: void gpu::boxFilter(const GpuMat& src, GpuMat& dst, int ddepth, Size ksize, Point anchor = Point(-1,-1))
+Smooths the image using the normalized box filter.
- Smooths the image using the normalized box filter.
+.. ocv:function:: void gpu::boxFilter(const GpuMat& src, GpuMat& dst, int ddepth, Size ksize, Point anchor = Point(-1,-1), Stream& stream = Stream::Null())
:param src: Input image. ``CV_8UC1`` and ``CV_8UC4`` source types are supported.
- :param dst: Output image type. The size and type is the same as ``src``.
+ :param dst: Output image type. The size and type is the same as ``src`` .
:param ddepth: Output image depth. If -1, the output image has the same depth as the input one. The only values allowed here are ``CV_8U`` and -1.
:param anchor: Anchor point. The default value ``Point(-1, -1)`` means that the anchor is at the kernel center.
+ :param stream: Stream for the asynchronous version.
+
.. note:: This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.
.. seealso:: :ocv:func:`boxFilter`
-.. index:: gpu::blur
+
gpu::blur
-------------
-.. ocv:function:: void gpu::blur(const GpuMat& src, GpuMat& dst, Size ksize, Point anchor = Point(-1,-1))
+Acts as a synonym for the normalized box filter.
- Acts as a synonym for the normalized box filter.
+.. ocv:function:: void gpu::blur(const GpuMat& src, GpuMat& dst, Size ksize, Point anchor = Point(-1,-1), Stream& stream = Stream::Null())
:param src: Input image. ``CV_8UC1`` and ``CV_8UC4`` source types are supported.
:param anchor: Anchor point. The default value Point(-1, -1) means that the anchor is at the kernel center.
+ :param stream: Stream for the asynchronous version.
+
.. note:: This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.
.. seealso:: :ocv:func:`blur`, :ocv:func:`gpu::boxFilter`
-.. index:: gpu::createMorphologyFilter_GPU
+
gpu::createMorphologyFilter_GPU
-----------------------------------
-.. ocv:function:: Ptr<FilterEngine_GPU> gpu::createMorphologyFilter_GPU(int op, int type, const Mat& kernel, const Point& anchor = Point(-1,-1), int iterations = 1)
+Creates a 2D morphological filter.
- Creates a 2D morphological filter.
+.. ocv:function:: Ptr<FilterEngine_GPU> gpu::createMorphologyFilter_GPU(int op, int type, const Mat& kernel, const Point& anchor = Point(-1,-1), int iterations = 1)
.. ocv:function:: Ptr<BaseFilter_GPU> getMorphologyFilter_GPU(int op, int type, const Mat& kernel, const Size& ksize, Point anchor=Point(-1,-1))
- {Morphology operation id. Only ``MORPH_ERODE`` and ``MORPH_DILATE`` are supported.}
+ :param op: Morphology operation id. Only ``MORPH_ERODE`` and ``MORPH_DILATE`` are supported.
:param type: Input/output image type. Only ``CV_8UC1`` and ``CV_8UC4`` are supported.
.. seealso:: :ocv:func:`createMorphologyFilter`
-.. index:: gpu::erode
+
gpu::erode
--------------
-.. ocv:function:: void gpu::erode(const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor = Point(-1, -1), int iterations = 1)
+Erodes an image by using a specific structuring element.
- Erodes an image by using a specific structuring element.
+.. ocv:function:: void gpu::erode(const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor = Point(-1, -1), int iterations = 1, Stream& stream = Stream::Null())
:param src: Source image. Only ``CV_8UC1`` and ``CV_8UC4`` types are supported.
:param iterations: Number of times erosion to be applied.
-.. note::
-
- This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.
+ :param stream: Stream for the asynchronous version.
+
+.. note:: This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.
.. seealso:: :ocv:func:`erode`
-.. index:: gpu::dilate
+
gpu::dilate
---------------
-.. ocv:function:: void gpu::dilate(const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor = Point(-1, -1), int iterations = 1)
+Dilates an image by using a specific structuring element.
- Dilates an image by using a specific structuring element.
+.. ocv:function:: void gpu::dilate(const GpuMat& src, GpuMat& dst, const Mat& kernel, Point anchor = Point(-1, -1), int iterations = 1, Stream& stream = Stream::Null())
:param src: Source image. ``CV_8UC1`` and ``CV_8UC4`` source types are supported.
:param iterations: Number of times dilation to be applied.
+ :param stream: Stream for the asynchronous version.
+
.. note:: This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.
.. seealso:: :ocv:func:`dilate`
-.. index:: gpu::morphologyEx
+
gpu::morphologyEx
---------------------
-.. ocv:function:: void gpu::morphologyEx(const GpuMat& src, GpuMat& dst, int op, const Mat& kernel, Point anchor = Point(-1, -1), int iterations = 1)
+Applies an advanced morphological operation to an image.
- Applies an advanced morphological operation to an image.
+.. ocv:function:: void gpu::morphologyEx(const GpuMat& src, GpuMat& dst, int op, const Mat& kernel, Point anchor = Point(-1, -1), int iterations = 1, Stream& stream = Stream::Null())
:param src: Source image. ``CV_8UC1`` and ``CV_8UC4`` source types are supported.
- :param dst: Destination image with the same size and type as ``src``
-
+ :param dst: Destination image with the same size and type as ``src`` .
+
:param op: Type of morphological operation. The following types are possible:
-
+
* **MORPH_OPEN** opening
-
+
* **MORPH_CLOSE** closing
-
+
* **MORPH_GRADIENT** morphological gradient
-
+
* **MORPH_TOPHAT** "top hat"
-
+
* **MORPH_BLACKHAT** "black hat"
-
:param kernel: Structuring element.
:param iterations: Number of times erosion and dilation to be applied.
-.. note:: This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.
+ :param stream: Stream for the asynchronous version.
+
+.. note:: This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.
+
+.. seealso:: :ocv:func:`morphologyEx`
-.. seealso:: :ocv:func:`morphologyEx`
-.. index:: gpu::createLinearFilter_GPU
gpu::createLinearFilter_GPU
-------------------------------
-.. ocv:function:: Ptr<FilterEngine_GPU> gpu::createLinearFilter_GPU(int srcType, int dstType, const Mat& kernel, const Point& anchor = Point(-1,-1))
+Creates a non-separable linear filter.
- Creates a non-separable linear filter.
+.. ocv:function:: Ptr<FilterEngine_GPU> gpu::createLinearFilter_GPU(int srcType, int dstType, const Mat& kernel, const Point& anchor = Point(-1,-1))
.. ocv:function:: Ptr<BaseFilter_GPU> gpu::getLinearFilter_GPU(int srcType, int dstType, const Mat& kernel, const Size& ksize, Point anchor = Point(-1, -1))
.. seealso:: :ocv:func:`createLinearFilter`
-.. index:: gpu::filter2D
+
gpu::filter2D
-----------------
-.. ocv:function:: void gpu::filter2D(const GpuMat& src, GpuMat& dst, int ddepth, const Mat& kernel, Point anchor=Point(-1,-1))
+Applies the non-separable 2D linear filter to an image.
- Applies the non-separable 2D linear filter to an image.
+.. ocv:function:: void gpu::filter2D(const GpuMat& src, GpuMat& dst, int ddepth, const Mat& kernel, Point anchor=Point(-1,-1), Stream& stream = Stream::Null())
:param src: Source image. ``CV_8UC1`` and ``CV_8UC4`` source types are supported.
:param kernel: 2D array of filter coefficients. This filter works with integers kernels. If ``kernel`` has a ``float`` or ``double`` type, it uses fixed-point arithmetic.
- :param anchor: Anchor of the kernel that indicates the relative position of a filtered point within the kernel. The anchor resides within the kernel. The special default value (-1,-1) means that the anchor is at the kernel cente
-
- This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.
+ :param anchor: Anchor of the kernel that indicates the relative position of a filtered point within the kernel. The anchor resides within the kernel. The special default value (-1,-1) means that the anchor is at the kernel center.
+
+ :param stream: Stream for the asynchronous version.
+
+.. note:: This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.
.. seealso:: :ocv:func:`filter2D`
-.. index:: gpu::Laplacian
+
gpu::Laplacian
------------------
-.. ocv:function:: void gpu::Laplacian(const GpuMat& src, GpuMat& dst, int ddepth, int ksize = 1, double scale = 1)
+Applies the Laplacian operator to an image.
- Applies the Laplacian operator to an image.
+.. ocv:function:: void gpu::Laplacian(const GpuMat& src, GpuMat& dst, int ddepth, int ksize = 1, double scale = 1, Stream& stream = Stream::Null())
:param src: Source image. ``CV_8UC1`` and ``CV_8UC4`` source types are supported.
:param scale: Optional scale factor for the computed Laplacian values. By default, no scaling is applied (see :ocv:func:`getDerivKernels` ).
-.. note:: This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.
+ :param stream: Stream for the asynchronous version.
+
+.. note:: This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.
+
+.. seealso:: :ocv:func:`Laplacian`, :ocv:func:`gpu::filter2D`
-.. seealso:: :ocv:func:`Laplacian`,:ocv:func:`gpu::filter2D` .
-.. index:: gpu::getLinearRowFilter_GPU
gpu::getLinearRowFilter_GPU
-------------------------------
-.. ocv:function:: Ptr<BaseRowFilter_GPU> gpu::getLinearRowFilter_GPU(int srcType, int bufType, const Mat& rowKernel, int anchor = -1, int borderType = BORDER_CONSTANT)
+Creates a primitive row filter with the specified kernel.
- Creates a primitive row filter with the specified kernel.
+.. ocv:function:: Ptr<BaseRowFilter_GPU> gpu::getLinearRowFilter_GPU(int srcType, int bufType, const Mat& rowKernel, int anchor = -1, int borderType = BORDER_CONSTANT)
- :param srcType: Source array type. Only ``CV_8UC1``, ``CV_8UC4``, ``CV_16SC1``, ``CV_16SC2``, ``CV_32SC1``, ``CV_32FC1`` source types are supported.
+ :param srcType: Source array type. Only ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_16SC3`` , ``CV_32SC1`` , ``CV_32FC1`` source types are supported.
:param bufType: Intermediate buffer type with as many channels as ``srcType`` .
- :param rowKernel: Filter coefficients.
+ :param rowKernel: Filter coefficients. Support kernels with ``size <= 16`` .
:param anchor: Anchor position within the kernel. Negative values mean that the anchor is positioned at the aperture center.
:param borderType: Pixel extrapolation method. For details, see :ocv:func:`borderInterpolate`. For details on limitations, see below.
There are two versions of the algorithm: NPP and OpenCV.
-
- * NPP version is called when ``srcType == CV_8UC1`` or ``srcType == CV_8UC4`` and ``bufType == srcType`` . Otherwise, the OpenCV version is called. NPP supports only ``BORDER_CONSTANT`` border type and does not check indices outside the image.
-
- * OpenCV version supports only ``CV_32F`` buffer depth and ``BORDER_REFLECT101``,``BORDER_REPLICATE``, and ``BORDER_CONSTANT`` border types. It checks indices outside the image.
+
+ * NPP version is called when ``srcType == CV_8UC1`` or ``srcType == CV_8UC4`` and ``bufType == srcType`` . Otherwise, the OpenCV version is called. NPP supports only ``BORDER_CONSTANT`` border type and does not check indices outside the image.
+
+ * OpenCV version supports only ``CV_32F`` buffer depth and ``BORDER_REFLECT101`` , ``BORDER_REPLICATE`` , and ``BORDER_CONSTANT`` border types. It checks indices outside the image.
.. seealso:: :ocv:func:`createSeparableLinearFilter` .
-.. index:: gpu::getLinearColumnFilter_GPU
+
gpu::getLinearColumnFilter_GPU
----------------------------------
-.. ocv:function:: Ptr<BaseColumnFilter_GPU> gpu::getLinearColumnFilter_GPU(int bufType, int dstType, const Mat& columnKernel, int anchor = -1, int borderType = BORDER_CONSTANT)
+Creates a primitive column filter with the specified kernel.
- Creates a primitive column filter with the specified kernel.
+.. ocv:function:: Ptr<BaseColumnFilter_GPU> gpu::getLinearColumnFilter_GPU(int bufType, int dstType, const Mat& columnKernel, int anchor = -1, int borderType = BORDER_CONSTANT)
:param bufType: Inermediate buffer type with as many channels as ``dstType`` .
- :param dstType: Destination array type. ``CV_8UC1``, ``CV_8UC4``, ``CV_16SC1``, ``CV_16SC2``, ``CV_32SC1``, ``CV_32FC1`` destination types are supported.
+ :param dstType: Destination array type. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_16SC3`` , ``CV_32SC1`` , ``CV_32FC1`` destination types are supported.
- :param columnKernel: Filter coefficients.
+ :param columnKernel: Filter coefficients. Support kernels with ``size <= 16`` .
:param anchor: Anchor position within the kernel. Negative values mean that the anchor is positioned at the aperture center.
:param borderType: Pixel extrapolation method. For details, see :ocv:func:`borderInterpolate` . For details on limitations, see below.
- There are two versions of the algorithm: NPP and OpenCV.
- * NPP version is called when ``dstType == CV_8UC1`` or ``dstType == CV_8UC4`` and ``bufType == dstType`` . Otherwise, the OpenCV version is called. NPP supports only ``BORDER_CONSTANT`` border type and does not check indices outside the image.
- * OpenCV version supports only ``CV_32F`` buffer depth and ``BORDER_REFLECT101``, ``BORDER_REPLICATE``, and ``BORDER_CONSTANT`` border types. It checks indices outside image.
-
+There are two versions of the algorithm: NPP and OpenCV.
+
+ * NPP version is called when ``dstType == CV_8UC1`` or ``dstType == CV_8UC4`` and ``bufType == dstType`` . Otherwise, the OpenCV version is called. NPP supports only ``BORDER_CONSTANT`` border type and does not check indices outside the image.
+
+ * OpenCV version supports only ``CV_32F`` buffer depth and ``BORDER_REFLECT101`` , ``BORDER_REPLICATE`` , and ``BORDER_CONSTANT`` border types. It checks indices outside image.
+
.. seealso:: :ocv:func:`gpu::getLinearRowFilter_GPU`, :ocv:func:`createSeparableLinearFilter`
-.. index:: gpu::createSeparableLinearFilter_GPU
+
gpu::createSeparableLinearFilter_GPU
----------------------------------------
+Creates a separable linear filter engine.
+
.. ocv:function:: Ptr<FilterEngine_GPU> gpu::createSeparableLinearFilter_GPU(int srcType, int dstType, const Mat& rowKernel, const Mat& columnKernel, const Point& anchor = Point(-1,-1), int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
- Creates a separable linear filter engine.
+ :param srcType: Source array type. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_16SC3`` , ``CV_32SC1`` , ``CV_32FC1`` source types are supported.
- :param srcType: Source array type. ``CV_8UC1``, ``CV_8UC4``, ``CV_16SC1``, ``CV_16SC2``, ``CV_32SC1``, ``CV_32FC1`` source types are supported.
+ :param dstType: Destination array type. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_16SC3`` , ``CV_32SC1`` , ``CV_32FC1`` destination types are supported.
- :param dstType: Destination array type. ``CV_8UC1``, ``CV_8UC4``, ``CV_16SC1``, ``CV_16SC2``, ``CV_32SC1``, ``CV_32FC1`` destination types are supported.
+ :param rowKernel: Horizontal filter coefficients. Support kernels with ``size <= 16`` .
- :param rowKernel: Horizontal filter coefficients.
-
- :param columnKernel: Vertical filter coefficients.
+ :param columnKernel: Vertical filter coefficients. Support kernels with ``size <= 16`` .
:param anchor: Anchor position within the kernel. Negative values mean that anchor is positioned at the aperture center.
:param rowBorderType: Pixel extrapolation method in the vertical direction For details, see :ocv:func:`borderInterpolate`. For details on limitations, see :ocv:func:`gpu::getLinearRowFilter_GPU`, cpp:ocv:func:`gpu::getLinearColumnFilter_GPU`.
-
+
:param columnBorderType: Pixel extrapolation method in the horizontal direction.
.. seealso:: :ocv:func:`gpu::getLinearRowFilter_GPU`, :ocv:func:`gpu::getLinearColumnFilter_GPU`, :ocv:func:`createSeparableLinearFilter`
-.. index:: gpu::sepFilter2D
+
gpu::sepFilter2D
--------------------
-.. ocv:function:: void gpu::sepFilter2D(const GpuMat& src, GpuMat& dst, int ddepth, const Mat& kernelX, const Mat& kernelY, Point anchor = Point(-1,-1), int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
+Applies a separable 2D linear filter to an image.
- Applies a separable 2D linear filter to an image.
+.. ocv:function:: void gpu::sepFilter2D(const GpuMat& src, GpuMat& dst, int ddepth, const Mat& kernelX, const Mat& kernelY, Point anchor = Point(-1,-1), int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1, Stream& stream = Stream::Null())
- :param src: Source image. ``CV_8UC1``, ``CV_8UC4``, ``CV_16SC1``, ``CV_16SC2``, ``CV_32SC1``, ``CV_32FC1`` source types are supported.
+ :param src: Source image. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_32SC1`` , ``CV_32FC1`` source types are supported.
:param dst: Destination image with the same size and number of channels as ``src`` .
- :param ddepth: Destination image depth. ``CV_8U``, ``CV_16S``, ``CV_32S``, and ``CV_32F`` are supported.
+ :param ddepth: Destination image depth. ``CV_8U`` , ``CV_16S`` , ``CV_32S`` , and ``CV_32F`` are supported.
:param kernelX: Horizontal filter coefficients.
-
+
:param kernelY: Vertical filter coefficients.
:param anchor: Anchor position within the kernel. The default value ``(-1, 1)`` means that the anchor is at the kernel center.
:param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see :ocv:func:`borderInterpolate`.
-
+
:param columnBorderType: Pixel extrapolation method in the horizontal direction.
+ :param stream: Stream for the asynchronous version.
+
.. seealso:: :ocv:func:`gpu::createSeparableLinearFilter_GPU`, :ocv:func:`sepFilter2D`
-.. index:: gpu::createDerivFilter_GPU
+
gpu::createDerivFilter_GPU
------------------------------
-.. ocv:function:: Ptr<FilterEngine_GPU> gpu::createDerivFilter_GPU(int srcType, int dstType, int dx, int dy, int ksize, int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
+Creates a filter engine for the generalized Sobel operator.
- Creates a filter engine for the generalized Sobel operator.
+.. ocv:function:: Ptr<FilterEngine_GPU> gpu::createDerivFilter_GPU(int srcType, int dstType, int dx, int dy, int ksize, int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
- :param srcType: Source image type. ``CV_8UC1``, ``CV_8UC4``, ``CV_16SC1``, ``CV_16SC2``, ``CV_32SC1``, ``CV_32FC1`` source types are supported.
+ :param srcType: Source image type. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_16SC3`` , ``CV_32SC1`` , ``CV_32FC1`` source types are supported.
- :param dstType: Destination image type with as many channels as ``srcType`` . ``CV_8U``, ``CV_16S``, ``CV_32S``, and ``CV_32F`` depths are supported.
+ :param dstType: Destination image type with as many channels as ``srcType`` , ``CV_8U`` , ``CV_16S`` , ``CV_32S`` , and ``CV_32F`` depths are supported.
:param dx: Derivative order in respect of x.
:param ksize: Aperture size. See :ocv:func:`getDerivKernels` for details.
:param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see :ocv:func:`borderInterpolate`.
-
+
:param columnBorderType: Pixel extrapolation method in the horizontal direction.
-
.. seealso:: :ocv:func:`gpu::createSeparableLinearFilter_GPU`, :ocv:func:`createDerivFilter`
-.. index:: gpu::Sobel
+
gpu::Sobel
--------------
-.. ocv:function:: void gpu::Sobel(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, int ksize = 3, double scale = 1, int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
+Applies the generalized Sobel operator to an image.
- Applies the generalized Sobel operator to an image.
+.. ocv:function:: void gpu::Sobel(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, int ksize = 3, double scale = 1, int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1, Stream& stream = Stream::Null())
- :param src: Source image. ``CV_8UC1``, ``CV_8UC4``, ``CV_16SC1``, ``CV_16SC2``, ``CV_32SC1``, ``CV_32FC1`` source types are supported.
+ :param src: Source image. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_16SC3`` , ``CV_32SC1`` , ``CV_32FC1`` source types are supported.
:param dst: Destination image with the same size and number of channels as source image.
- :param ddepth: Destination image depth. ``CV_8U``, ``CV_16S``, ``CV_32S``, and ``CV_32F`` are supported.
+ :param ddepth: Destination image depth. ``CV_8U`` , ``CV_16S`` , ``CV_32S`` , and ``CV_32F`` are supported.
:param dx: Derivative order in respect of x.
:param scale: Optional scale factor for the computed derivative values. By default, no scaling is applied. For details, see :ocv:func:`getDerivKernels` .
:param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see :ocv:func:`borderInterpolate`.
-
+
:param columnBorderType: Pixel extrapolation method in the horizontal direction.
+ :param stream: Stream for the asynchronous version.
+
.. seealso:: :ocv:func:`gpu::createSeparableLinearFilter_GPU`, :ocv:func:`Sobel`
-.. index:: gpu::Scharr
+
gpu::Scharr
---------------
-.. ocv:function:: void gpu::Scharr(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, double scale = 1, int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
+Calculates the first x- or y- image derivative using the Scharr operator.
- Calculates the first x- or y- image derivative using the Scharr operator.
+.. ocv:function:: void gpu::Scharr(const GpuMat& src, GpuMat& dst, int ddepth, int dx, int dy, double scale = 1, int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1, Stream& stream = Stream::Null())
- :param src: Source image. ``CV_8UC1``, ``CV_8UC4``, ``CV_16SC1``, ``CV_16SC2``, ``CV_32SC1``, ``CV_32FC1`` source types are supported.
+ :param src: Source image. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_16SC3`` , ``CV_32SC1`` , ``CV_32FC1`` source types are supported.
:param dst: Destination image with the same size and number of channels as ``src`` has.
- :param ddepth: Destination image depth. ``CV_8U``, ``CV_16S``, ``CV_32S``, and ``CV_32F`` are supported.
+ :param ddepth: Destination image depth. ``CV_8U`` , ``CV_16S`` , ``CV_32S`` , and ``CV_32F`` are supported.
:param xorder: Order of the derivative x.
:param scale: Optional scale factor for the computed derivative values. By default, no scaling is applied. See :ocv:func:`getDerivKernels` for details.
:param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see :ocv:func:`borderInterpolate`.
-
+
:param columnBorderType: Pixel extrapolation method in the horizontal direction.
+ :param stream: Stream for the asynchronous version.
+
.. seealso:: :ocv:func:`gpu::createSeparableLinearFilter_GPU`, :ocv:func:`Scharr`
-.. index:: gpu::createGaussianFilter_GPU
+
gpu::createGaussianFilter_GPU
---------------------------------
-.. ocv:function:: Ptr<FilterEngine_GPU> gpu::createGaussianFilter_GPU(int type, Size ksize, double sigmaX, double sigmaY = 0, int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
+Creates a Gaussian filter engine.
- Creates a Gaussian filter engine.
+.. ocv:function:: Ptr<FilterEngine_GPU> gpu::createGaussianFilter_GPU(int type, Size ksize, double sigmaX, double sigmaY = 0, int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
- :param type: Source and destination image type. ``CV_8UC1``, ``CV_8UC4``, ``CV_16SC1``, ``CV_16SC2``, ``CV_32SC1``, ``CV_32FC1`` are supported.
+ :param type: Source and destination image type. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_16SC3`` , ``CV_32SC1`` , ``CV_32FC1`` are supported.
:param ksize: Aperture size. See :ocv:func:`getGaussianKernel` for details.
:param sigmaY: Gaussian sigma in the vertical direction. If 0, then :math:`\texttt{sigmaY}\leftarrow\texttt{sigmaX}` .
:param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see :ocv:func:`borderInterpolate`.
-
+
:param columnBorderType: Pixel extrapolation method in the horizontal direction.
.. seealso:: :ocv:func:`gpu::createSeparableLinearFilter_GPU`, :ocv:func:`createGaussianFilter`
-.. index:: gpu::GaussianBlur
+
gpu::GaussianBlur
---------------------
-.. ocv:function:: void gpu::GaussianBlur(const GpuMat& src, GpuMat& dst, Size ksize, double sigmaX, double sigmaY = 0, int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1)
+Smooths an image using the Gaussian filter.
- Smooths an image using the Gaussian filter.
+.. ocv:function:: void gpu::GaussianBlur(const GpuMat& src, GpuMat& dst, Size ksize, double sigmaX, double sigmaY = 0, int rowBorderType = BORDER_DEFAULT, int columnBorderType = -1, Stream& stream = Stream::Null())
- :param src: Source image. ``CV_8UC1``, ``CV_8UC4``, ``CV_16SC1``, ``CV_16SC2``, ``CV_32SC1``, ``CV_32FC1`` source types are supported.
+ :param src: Source image. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_16SC1`` , ``CV_16SC2`` , ``CV_16SC3`` , ``CV_32SC1`` , ``CV_32FC1`` source types are supported.
- :param dst: Destination image with the same size and type as ``src``.
+ :param dst: Destination image with the same size and type as ``src`` .
:param ksize: Gaussian kernel size. ``ksize.width`` and ``ksize.height`` can differ but they both must be positive and odd. If they are zeros, they are computed from ``sigmaX`` and ``sigmaY`` .
- :param sigmaX: Gaussian kernel standard deviation in X direction.
-
- :param sigmaY: Gaussian kernel standard deviation in Y direction. If ``sigmaY`` is zero, it is set to be equal to ``sigmaX`` . If they are both zeros, they are computed from ``ksize.width`` and ``ksize.height``, respectively. See :ocv:func:`getGaussianKernel` for details. To fully control the result regardless of possible future modification of all this semantics, you are recommended to specify all of ``ksize``, ``sigmaX``, and ``sigmaY`` .
+ :param sigmaX: Gaussian kernel standard deviation in X direction.
+
+ :param sigmaY: Gaussian kernel standard deviation in Y direction. If ``sigmaY`` is zero, it is set to be equal to ``sigmaX`` . If they are both zeros, they are computed from ``ksize.width`` and ``ksize.height``, respectively. See :ocv:func:`getGaussianKernel` for details. To fully control the result regardless of possible future modification of all this semantics, you are recommended to specify all of ``ksize`` , ``sigmaX`` , and ``sigmaY`` .
:param rowBorderType: Pixel extrapolation method in the vertical direction. For details, see :ocv:func:`borderInterpolate`.
-
+
:param columnBorderType: Pixel extrapolation method in the horizontal direction.
+ :param stream: Stream for the asynchronous version.
+
.. seealso:: :ocv:func:`gpu::createGaussianFilter_GPU`, :ocv:func:`GaussianBlur`
-.. index:: gpu::getMaxFilter_GPU
+
gpu::getMaxFilter_GPU
-------------------------
-.. ocv:function:: Ptr<BaseFilter_GPU> gpu::getMaxFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1,-1))
+Creates the maximum filter.
- Creates the maximum filter.
+.. ocv:function:: Ptr<BaseFilter_GPU> gpu::getMaxFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1,-1))
:param srcType: Input image type. Only ``CV_8UC1`` and ``CV_8UC4`` are supported.
.. note:: This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.
-.. index:: gpu::getMinFilter_GPU
+
gpu::getMinFilter_GPU
-------------------------
-.. ocv:function:: Ptr<BaseFilter_GPU> gpu::getMinFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1,-1))
+Creates the minimum filter.
- Creates the minimum filter.
+.. ocv:function:: Ptr<BaseFilter_GPU> gpu::getMinFilter_GPU(int srcType, int dstType, const Size& ksize, Point anchor = Point(-1,-1))
:param srcType: Input image type. Only ``CV_8UC1`` and ``CV_8UC4`` are supported.
:param anchor: Anchor point. The default value (-1) means that the anchor is at the kernel center.
- .. note:: This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.
+.. note:: This filter does not check out-of-border accesses, so only a proper sub-matrix of a bigger matrix has to be passed to it.
gpu::meanShiftFiltering
---------------------------
-.. ocv:function:: void gpu::meanShiftFiltering(const GpuMat& src, GpuMat& dst, int sp, int sr,TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 5, 1))
+Performs mean-shift filtering for each point of the source image.
- Performs mean-shift filtering for each point of the source image. It maps each point of the source image into another point. As a result, you have a new color and new position of each point.
+.. ocv:function:: void gpu::meanShiftFiltering(const GpuMat& src, GpuMat& dst, int sp, int sr,TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 5, 1))
:param src: Source image. Only ``CV_8UC4`` images are supported for now.
:param criteria: Termination criteria. See :ocv:class:`TermCriteria`.
+It maps each point of the source image into another point. As a result, you have a new color and new position of each point.
+
gpu::meanShiftProc
----------------------
-.. ocv:function:: void gpu::meanShiftProc(const GpuMat& src, GpuMat& dstr, GpuMat& dstsp, int sp, int sr, TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 5, 1))
+Performs a mean-shift procedure and stores information about processed points (their colors and positions) in two images.
- Performs a mean-shift procedure and stores information about processed points (their colors and positions) in two images.
+.. ocv:function:: void gpu::meanShiftProc(const GpuMat& src, GpuMat& dstr, GpuMat& dstsp, int sp, int sr, TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 5, 1))
:param src: Source image. Only ``CV_8UC4`` images are supported for now.
:param dstr: Destination image containing the color of mapped points. The size and type is the same as ``src`` .
- :param dstsp: Destination image containing the position of mapped points. The size is the same as ``src`` size. The type is ``CV_16SC2``.
+ :param dstsp: Destination image containing the position of mapped points. The size is the same as ``src`` size. The type is ``CV_16SC2`` .
:param sp: Spatial window radius.
:param criteria: Termination criteria. See :ocv:class:`TermCriteria`.
-.. seealso:: :ocv:func:`gpu::meanShiftFiltering`
+.. seealso:: :ocv:func:`gpu::meanShiftFiltering`
+
gpu::meanShiftSegmentation
------------------------------
-.. ocv:function:: void gpu::meanShiftSegmentation(const GpuMat& src, Mat& dst, int sp, int sr, int minsize, TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 5, 1))
+Performs a mean-shift segmentation of the source image and eliminates small segments.
- Performs a mean-shift segmentation of the source image and eliminates small segments.
+.. ocv:function:: void gpu::meanShiftSegmentation(const GpuMat& src, Mat& dst, int sp, int sr, int minsize, TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER + TermCriteria::EPS, 5, 1))
:param src: Source image. Only ``CV_8UC4`` images are supported for now.
gpu::integral
-----------------
-.. ocv:function:: void gpu::integral(const GpuMat& src, GpuMat& sum)
+Computes an integral image and a squared integral image.
-.. ocv:function:: void gpu::integral(const GpuMat& src, GpuMat& sum, GpuMat& sqsum)
+.. ocv:function:: void gpu::integral(const GpuMat& src, GpuMat& sum, Stream& stream = Stream::Null())
- Computes an integral image and a squared integral image.
+.. ocv:function:: void gpu::integral(const GpuMat& src, GpuMat& sum, GpuMat& sqsum, Stream& stream = Stream::Null())
:param src: Source image. Only ``CV_8UC1`` images are supported for now.
:param sqsum: Squared integral image of the ``CV_32FC1`` type.
-.. seealso:: :ocv:func:`integral`
+ :param stream: Stream for the asynchronous version.
+
+.. seealso:: :ocv:func:`integral`
gpu::sqrIntegral
--------------------
-.. ocv:function:: void gpu::sqrIntegral(const GpuMat& src, GpuMat& sqsum)
+Computes a squared integral image.
- Computes a squared integral image.
+.. ocv:function:: void gpu::sqrIntegral(const GpuMat& src, GpuMat& sqsum, Stream& stream = Stream::Null())
:param src: Source image. Only ``CV_8UC1`` images are supported for now.
:param sqsum: Squared integral image containing 64-bit unsigned integer values packed into ``CV_64FC1`` .
+ :param stream: Stream for the asynchronous version.
+
gpu::columnSum
------------------
-.. ocv:function:: void gpu::columnSum(const GpuMat& src, GpuMat& sum)
+Computes a vertical (column) sum.
- Computes a vertical (column) sum.
+.. ocv:function:: void gpu::columnSum(const GpuMat& src, GpuMat& sum)
:param src: Source image. Only ``CV_32FC1`` images are supported for now.
gpu::cornerHarris
---------------------
-.. ocv:function:: void gpu::cornerHarris(const GpuMat& src, GpuMat& dst, int blockSize, int ksize, double k, int borderType=BORDER_REFLECT101)
+Computes the Harris cornerness criteria at each image pixel.
- Computes the Harris cornerness criteria at each image pixel.
+.. ocv:function:: void gpu::cornerHarris(const GpuMat& src, GpuMat& dst, int blockSize, int ksize, double k, int borderType=BORDER_REFLECT101)
:param src: Source image. Only ``CV_8UC1`` and ``CV_32FC1`` images are supported for now.
:param borderType: Pixel extrapolation method. Only ``BORDER_REFLECT101`` and ``BORDER_REPLICATE`` are supported for now.
-.. seealso:: :ocv:func:`cornerHarris`
+.. seealso:: :ocv:func:`cornerHarris`
+
gpu::cornerMinEigenVal
--------------------------
-.. ocv:function:: void gpu::cornerMinEigenVal(const GpuMat& src, GpuMat& dst, int blockSize, int ksize, int borderType=BORDER_REFLECT101)
+Computes the minimum eigen value of a 2x2 derivative covariation matrix at each pixel (the cornerness criteria).
- Computes the minimum eigen value of a 2x2 derivative covariation matrix at each pixel (the cornerness criteria).
+.. ocv:function:: void gpu::cornerMinEigenVal(const GpuMat& src, GpuMat& dst, int blockSize, int ksize, int borderType=BORDER_REFLECT101)
:param src: Source image. Only ``CV_8UC1`` and ``CV_32FC1`` images are supported for now.
- :param dst: Destination image containing cornerness values. The size is the same. The type is ``CV_32FC1``.
+ :param dst: Destination image containing cornerness values. The size is the same. The type is ``CV_32FC1`` .
:param blockSize: Neighborhood size.
gpu::mulSpectrums
---------------------
-.. ocv:function:: void gpu::mulSpectrums(const GpuMat& a, const GpuMat& b, GpuMat& c, int flags, bool conjB=false)
+Performs a per-element multiplication of two Fourier spectrums.
- Performs a per-element multiplication of two Fourier spectrums.
+.. ocv:function:: void gpu::mulSpectrums(const GpuMat& a, const GpuMat& b, GpuMat& c, int flags, bool conjB=false)
:param a: First spectrum.
Only full (not packed) ``CV_32FC2`` complex spectrums in the interleaved format are supported for now.
-.. seealso:: :ocv:func:`mulSpectrums`
+.. seealso:: :ocv:func:`mulSpectrums`
+
gpu::mulAndScaleSpectrums
-----------------------------
-.. ocv:function:: void gpu::mulAndScaleSpectrums(const GpuMat& a, const GpuMat& b, GpuMat& c, int flags, float scale, bool conjB=false)
+Performs a per-element multiplication of two Fourier spectrums and scales the result.
- Performs a per-element multiplication of two Fourier spectrums and scales the result.
+.. ocv:function:: void gpu::mulAndScaleSpectrums(const GpuMat& a, const GpuMat& b, GpuMat& c, int flags, float scale, bool conjB=false)
:param a: First spectrum.
Only full (not packed) ``CV_32FC2`` complex spectrums in the interleaved format are supported for now.
-.. seealso:: :ocv:func:`mulSpectrums`
+.. seealso:: :ocv:func:`mulSpectrums`
gpu::dft
------------
-.. ocv:function:: void gpu::dft(const GpuMat& src, GpuMat& dst, Size dft_size, int flags=0)
+Performs a forward or inverse discrete Fourier transform (1D or 2D) of the floating point matrix.
- Performs a forward or inverse discrete Fourier transform (1D or 2D) of the floating point matrix. Use to handle real matrices (``CV32FC1``) and complex matrices in the interleaved format (``CV32FC2``).
+.. ocv:function:: void gpu::dft(const GpuMat& src, GpuMat& dst, Size dft_size, int flags=0)
:param src: Source matrix (real or complex).
:param flags: Optional flags:
- * **DFT_ROWS** transforms each individual row of the source matrix.
+ * **DFT_ROWS** transforms each individual row of the source matrix.
+
+ * **DFT_SCALE** scales the result: divide it by the number of elements in the transform (obtained from ``dft_size`` ).
- * **DFT_SCALE** scales the result: divide it by the number of elements in the transform (obtained from ``dft_size`` ).
+ * **DFT_INVERSE** inverts DFT. Use for complex-complex cases (real-complex and complex-real cases are always forward and inverse, respectively).
- * **DFT_INVERSE** inverts DFT. Use for complex-complex cases (real-complex and complex-real cases are always forward and inverse, respectively).
+ * **DFT_REAL_OUTPUT** specifies the output as real. The source matrix is the result of real-complex transform, so the destination matrix must be real.
- * **DFT_REAL_OUTPUT** specifies the output as real. The source matrix is the result of real-complex transform, so the destination matrix must be real.
-
+Use to handle real matrices ( ``CV32FC1`` ) and complex matrices in the interleaved format ( ``CV32FC2`` ).
- The source matrix should be continuous, otherwise reallocation and data copying is performed. The function chooses an operation mode depending on the flags, size, and channel count of the source matrix:
+The source matrix should be continuous, otherwise reallocation and data copying is performed. The function chooses an operation mode depending on the flags, size, and channel count of the source matrix:
- *
- If the source matrix is complex and the output is not specified as real, the destination matrix is complex and has the ``dft_size`` size and ``CV_32FC2`` type. The destination matrix contains a full result of the DFT (forward or inverse).
+ * If the source matrix is complex and the output is not specified as real, the destination matrix is complex and has the ``dft_size`` size and ``CV_32FC2`` type. The destination matrix contains a full result of the DFT (forward or inverse).
- *
- If the source matrix is complex and the output is specified as real, the function assumes that its input is the result of the forward transform (see the next item). The destionation matrix has the ``dft_size`` size and ``CV_32FC1`` type. It contains the result of the inverse DFT.
+ * If the source matrix is complex and the output is specified as real, the function assumes that its input is the result of the forward transform (see the next item). The destionation matrix has the ``dft_size`` size and ``CV_32FC1`` type. It contains the result of the inverse DFT.
- *
- If the source matrix is real (its type is ``CV_32FC1`` ), forward DFT is performed. The result of the DFT is packed into complex ( ``CV_32FC2`` ) matrix. So, the width of the destination matrix is ``dft_size.width / 2 + 1`` . But if the source is a single column, the height is reduced instead of the width.
+ * If the source matrix is real (its type is ``CV_32FC1`` ), forward DFT is performed. The result of the DFT is packed into complex ( ``CV_32FC2`` ) matrix. So, the width of the destination matrix is ``dft_size.width / 2 + 1`` . But if the source is a single column, the height is reduced instead of the width.
-.. seealso:: :ocv:func:`dft`
+.. seealso:: :ocv:func:`dft`
gpu::convolve
-----------------
+Computes a convolution (or cross-correlation) of two images.
+
.. ocv:function:: void gpu::convolve(const GpuMat& image, const GpuMat& templ, GpuMat& result, bool ccorr=false)
.. ocv:function:: void gpu::convolve(const GpuMat& image, const GpuMat& templ, GpuMat& result, bool ccorr, ConvolveBuf& buf)
- Computes a convolution (or cross-correlation) of two images.
-
:param image: Source image. Only ``CV_32FC1`` images are supported for now.
:param templ: Template image. The size is not greater than the ``image`` size. The type is the same as ``image`` .
----------------
.. ocv:class:: gpu::ConvolveBuf
-Class providing a memory buffer for the :ocv:func:`gpu::convolve` function.
-::
+Class providing a memory buffer for the :ocv:func:`gpu::convolve` function. ::
struct CV_EXPORTS ConvolveBuf
{
-
gpu::ConvolveBuf::ConvolveBuf
---------------------------------
+The constructors.
+
.. ocv:function:: ConvolveBuf::ConvolveBuf()
- Constructs an empty buffer that is properly resized after the first call of the
- :ocv:func:`gpu::convolve` function.
+Constructs an empty buffer that is properly resized after the first call of the :ocv:func:`gpu::convolve` function.
.. ocv:function:: ConvolveBuf::ConvolveBuf(Size image_size, Size templ_size)
- Constructs a buffer for the
- :ocv:func:`gpu::convolve` function with respective arguments.
+Constructs a buffer for the :ocv:func:`gpu::convolve` function with respective arguments.
gpu::matchTemplate
----------------------
-.. ocv:function:: void gpu::matchTemplate(const GpuMat& image, const GpuMat& templ, GpuMat& result, int method)
+Computes a proximity map for a raster template and an image where the template is searched for.
- Computes a proximity map for a raster template and an image where the template is searched for.
+.. ocv:function:: void gpu::matchTemplate(const GpuMat& image, const GpuMat& templ, GpuMat& result, int method)
:param image: Source image. ``CV_32F`` and ``CV_8U`` depth images (1..4 channels) are supported for now.
* ``CV_TM_SQDIFF``
* ``CV_TM_CCORR``
-.. seealso:: :ocv:func:`matchTemplate`
+.. seealso:: :ocv:func:`matchTemplate`
+
gpu::remap
--------------
-.. ocv:function:: void gpu::remap(const GpuMat& src, GpuMat& dst, const GpuMat& xmap, const GpuMat& ymap)
+Applies a generic geometrical transformation to an image.
- Applies a generic geometrical transformation to an image.
+.. ocv:function:: void gpu::remap(const GpuMat& src, GpuMat& dst, const GpuMat& xmap, const GpuMat& ymap)
:param src: Source image. Only ``CV_8UC1`` and ``CV_8UC3`` source types are supported.
Values of pixels with non-integer coordinates are computed using the bilinear interpolation.
-.. seealso:: :ocv:func:`remap`
+.. seealso:: :ocv:func:`remap`
+
gpu::cvtColor
-----------------
-.. ocv:function:: void gpu::cvtColor(const GpuMat& src, GpuMat& dst, int code, int dcn = 0)
-
-.. ocv:function:: void gpu::cvtColor(const GpuMat& src, GpuMat& dst, int code, int dcn, const Stream& stream)
+Converts an image from one color space to another.
- Converts an image from one color space to another.
+.. ocv:function:: void gpu::cvtColor(const GpuMat& src, GpuMat& dst, int code, int dcn = 0, Stream& stream = Stream::Null())
- :param src: Source image with ``CV_8U``, ``CV_16U``, or ``CV_32F`` depth and 1, 3, or 4 channels.
+ :param src: Source image with ``CV_8U`` , ``CV_16U`` , or ``CV_32F`` depth and 1, 3, or 4 channels.
:param dst: Destination image with the same size and depth as ``src`` .
3-channel color spaces (like ``HSV``, ``XYZ``, and so on) can be stored in a 4-channel image for better perfomance.
-.. seealso:: :ocv:func:`cvtColor`
+.. seealso:: :ocv:func:`cvtColor`
gpu::threshold
------------------
-.. ocv:function:: double gpu::threshold(const GpuMat& src, GpuMat& dst, double thresh, double maxval, int type)
-
-.. ocv:function:: double gpu::threshold(const GpuMat& src, GpuMat& dst, double thresh, double maxval, int type, const Stream& stream)
+Applies a fixed-level threshold to each array element.
- Applies a fixed-level threshold to each array element.
+.. ocv:function:: double gpu::threshold(const GpuMat& src, GpuMat& dst, double thresh, double maxval, int type, Stream& stream = Stream::Null())
- :param src: Source array (single-channel). ``CV_64F`` depth is not supported.
+ :param src: Source array (single-channel).
:param dst: Destination array with the same size and type as ``src`` .
:param stream: Stream for the asynchronous version.
-.. seealso:: :ocv:func:`threshold`
+.. seealso:: :ocv:func:`threshold`
gpu::resize
---------------
-.. ocv:function:: void gpu::resize(const GpuMat& src, GpuMat& dst, Size dsize, double fx=0, double fy=0, int interpolation = INTER_LINEAR)
+Resizes an image.
- Resizes an image.
+.. ocv:function:: void gpu::resize(const GpuMat& src, GpuMat& dst, Size dsize, double fx=0, double fy=0, int interpolation = INTER_LINEAR, Stream& stream = Stream::Null())
:param src: Source image. ``CV_8UC1`` and ``CV_8UC4`` types are supported.
- :param dst: Destination image with the same type as ``src`` . The size is ``dsize`` (when it is non-zero) or the size is computed from ``src.size()``, ``fx``, and ``fy`` .
+ :param dst: Destination image with the same type as ``src`` . The size is ``dsize`` (when it is non-zero) or the size is computed from ``src.size()`` , ``fx`` , and ``fy`` .
- :param dsize: Destination image size. If it is zero, it is computed as:
+ :param dsize: Destination image size. If it is zero, it is computed as:
.. math::
- \texttt{dsize = Size(round(fx*src.cols), round(fy*src.rows))}
+ \texttt{dsize = Size(round(fx*src.cols), round(fy*src.rows))}
Either ``dsize`` or both ``fx`` and ``fy`` must be non-zero.
- :param fx: Scale factor along the horizontal axis. If it is zero, it is computed as:
+ :param fx: Scale factor along the horizontal axis. If it is zero, it is computed as:
.. math::
- \texttt{(double)dsize.width/src.cols}
+ \texttt{(double)dsize.width/src.cols}
- :param fy: Scale factor along the vertical axis. If it is zero, it is computed as:
+ :param fy: Scale factor along the vertical axis. If it is zero, it is computed as:
.. math::
- \texttt{(double)dsize.height/src.rows}
+ \texttt{(double)dsize.height/src.rows}
:param interpolation: Interpolation method. Only ``INTER_NEAREST`` and ``INTER_LINEAR`` are supported.
-.. seealso:: :ocv:func:`resize`
+ :param stream: Stream for the asynchronous version.
+
+.. seealso:: :ocv:func:`resize`
gpu::warpAffine
-------------------
-.. ocv:function:: void gpu::warpAffine(const GpuMat& src, GpuMat& dst, const Mat& M, Size dsize, int flags = INTER_LINEAR)
+Applies an affine transformation to an image.
- Applies an affine transformation to an image.
+.. ocv:function:: void gpu::warpAffine(const GpuMat& src, GpuMat& dst, const Mat& M, Size dsize, int flags = INTER_LINEAR, Stream& stream = Stream::Null())
- :param src: Source image. ``CV_8U``, ``CV_16U``, ``CV_32S``, or ``CV_32F`` depth and 1, 3, or 4 channels are supported.
+ :param src: Source image. ``CV_8U`` , ``CV_16U`` , ``CV_32S`` , or ``CV_32F`` depth and 1, 3, or 4 channels are supported.
- :param dst: Destination image with the same type as ``src`` . The size is ``dsize`` .
+ :param dst: Destination image with the same type as ``src`` . The size is ``dsize`` .
:param M: *2x3* transformation matrix.
:param dsize: Size of the destination image.
- :param flags: Combination of interpolation methods (see :ocv:func:`resize`) and the optional flag ``WARP_INVERSE_MAP`` specifying that ``M`` is an inverse transformation (``dst=>src``). Only ``INTER_NEAREST``, ``INTER_LINEAR``, and ``INTER_CUBIC`` interpolation methods are supported.
+ :param flags: Combination of interpolation methods (see :ocv:func:`resize`) and the optional flag ``WARP_INVERSE_MAP`` specifying that ``M`` is an inverse transformation ( ``dst=>src`` ). Only ``INTER_NEAREST`` , ``INTER_LINEAR`` , and ``INTER_CUBIC`` interpolation methods are supported.
+
+ :param stream: Stream for the asynchronous version.
-.. seealso:: :ocv:func:`warpAffine`
+.. seealso:: :ocv:func:`warpAffine`
gpu::warpPerspective
------------------------
-.. ocv:function:: void gpu::warpPerspective(const GpuMat& src, GpuMat& dst, const Mat& M, Size dsize, int flags = INTER_LINEAR)
+Applies a perspective transformation to an image.
- Applies a perspective transformation to an image.
+.. ocv:function:: void gpu::warpPerspective(const GpuMat& src, GpuMat& dst, const Mat& M, Size dsize, int flags = INTER_LINEAR, Stream& stream = Stream::Null())
- :param src: Source image. ``CV_8U``, ``CV_16U``, ``CV_32S``, or ``CV_32F`` depth and 1, 3, or 4 channels are supported.
+ :param src: Source image. ``CV_8U`` , ``CV_16U`` , ``CV_32S`` , or ``CV_32F`` depth and 1, 3, or 4 channels are supported.
- :param dst: Destination image with the same type as ``src`` . The size is ``dsize`` .
+ :param dst: Destination image with the same type as ``src`` . The size is ``dsize`` .
:param M: *3x3* transformation matrix.
:param dsize: Size of the destination image.
- :param flags: Combination of interpolation methods (see :ocv:func:`resize` ) and the optional flag ``WARP_INVERSE_MAP`` specifying that ``M`` is the inverse transformation (``dst => src``). Only ``INTER_NEAREST``, ``INTER_LINEAR``, and ``INTER_CUBIC`` interpolation methods are supported.
+ :param flags: Combination of interpolation methods (see :ocv:func:`resize` ) and the optional flag ``WARP_INVERSE_MAP`` specifying that ``M`` is the inverse transformation ( ``dst => src`` ). Only ``INTER_NEAREST`` , ``INTER_LINEAR`` , and ``INTER_CUBIC`` interpolation methods are supported.
+
+ :param stream: Stream for the asynchronous version.
-.. seealso:: :ocv:func:`warpPerspective`
+.. seealso:: :ocv:func:`warpPerspective`
gpu::rotate
---------------
-.. ocv:function:: void gpu::rotate(const GpuMat& src, GpuMat& dst, Size dsize, double angle, double xShift = 0, double yShift = 0, int interpolation = INTER_LINEAR)
+Rotates an image around the origin (0,0) and then shifts it.
- Rotates an image around the origin (0,0) and then shifts it.
+.. ocv:function:: void gpu::rotate(const GpuMat& src, GpuMat& dst, Size dsize, double angle, double xShift = 0, double yShift = 0, int interpolation = INTER_LINEAR, Stream& stream = Stream::Null())
:param src: Source image. ``CV_8UC1`` and ``CV_8UC4`` types are supported.
- :param dst: Destination image with the same type as ``src`` . The size is ``dsize`` .
+ :param dst: Destination image with the same type as ``src`` . The size is ``dsize`` .
:param dsize: Size of the destination image.
:param yShift: Shift along the vertical axis.
- :param interpolation: Interpolation method. Only ``INTER_NEAREST``, ``INTER_LINEAR``, and ``INTER_CUBIC`` are supported.
+ :param interpolation: Interpolation method. Only ``INTER_NEAREST`` , ``INTER_LINEAR`` , and ``INTER_CUBIC`` are supported.
-.. seealso:: :ocv:func:`gpu::warpAffine`
+ :param stream: Stream for the asynchronous version.
+
+.. seealso:: :ocv:func:`gpu::warpAffine`
gpu::copyMakeBorder
-----------------------
-.. ocv:function:: void gpu::copyMakeBorder(const GpuMat& src, GpuMat& dst, int top, int bottom, int left, int right, const Scalar& value = Scalar())
+Copies a 2D array to a larger destination array and pads borders with the given constant.
- Copies a 2D array to a larger destination array and pads borders with the given constant.
+.. ocv:function:: void gpu::copyMakeBorder(const GpuMat& src, GpuMat& dst, int top, int bottom, int left, int right, const Scalar& value = Scalar(), Stream& stream = Stream::Null())
- :param src: Source image. ``CV_8UC1``, ``CV_8UC4``, ``CV_32SC1``, and ``CV_32FC1`` types are supported.
+ :param src: Source image. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_32SC1`` , and ``CV_32FC1`` types are supported.
:param dst: Destination image with the same type as ``src``. The size is ``Size(src.cols+left+right, src.rows+top+bottom)`` .
:param top:
-
+
:param bottom:
-
+
:param left:
-
+
:param right: Number of pixels in each direction from the source image rectangle to extrapolate. For example: ``top=1, bottom=1, left=1, right=1`` mean that 1 pixel-wide border needs to be built.
:param value: Border value.
+ :param stream: Stream for the asynchronous version.
+
.. seealso:: :ocv:func:`copyMakeBorder`
+
gpu::rectStdDev
-------------------
-.. ocv:function:: void gpu::rectStdDev(const GpuMat& src, const GpuMat& sqr, GpuMat& dst, const Rect& rect)
+Computes a standard deviation of integral images.
- Computes a standard deviation of integral images.
+.. ocv:function:: void gpu::rectStdDev(const GpuMat& src, const GpuMat& sqr, GpuMat& dst, const Rect& rect, Stream& stream = Stream::Null())
:param src: Source image. Only the ``CV_32SC1`` type is supported.
:param rect: Rectangular window.
+ :param stream: Stream for the asynchronous version.
+
gpu::evenLevels
-------------------
-.. ocv:function:: void gpu::evenLevels(GpuMat& levels, int nLevels, int lowerLevel, int upperLevel)
+Computes levels with even distribution.
- Computes levels with even distribution.
+.. ocv:function:: void gpu::evenLevels(GpuMat& levels, int nLevels, int lowerLevel, int upperLevel)
:param levels: Destination array. ``levels`` has 1 row, ``nLevels`` columns, and the ``CV_32SC1`` type.
:param upperLevel: Upper boundary value of the greatest level.
+
+
gpu::histEven
-----------------
-.. ocv:function:: void gpu::histEven(const GpuMat& src, GpuMat& hist, int histSize, int lowerLevel, int upperLevel)
+Calculates a histogram with evenly distributed bins.
+
+.. ocv:function:: void gpu::histEven(const GpuMat& src, GpuMat& hist, int histSize, int lowerLevel, int upperLevel, Stream& stream = Stream::Null())
-.. ocv:function:: void gpu::histEven(const GpuMat& src, GpuMat* hist, int* histSize, int* lowerLevel, int* upperLevel)
+.. ocv:function:: void gpu::histEven(const GpuMat& src, GpuMat& hist, GpuMat& buf, int histSize, int lowerLevel, int upperLevel, Stream& stream = Stream::Null())
- Calculates a histogram with evenly distributed bins.
+.. ocv:function:: void gpu::histEven(const GpuMat& src, GpuMat* hist, int* histSize, int* lowerLevel, int* upperLevel, Stream& stream = Stream::Null())
+
+.. ocv:function:: void gpu::histEven(const GpuMat& src, GpuMat* hist, GpuMat& buf, int* histSize, int* lowerLevel, int* upperLevel, 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.
:param upperLevel: Upper boundary of highest-level bin.
+ :param buf: Optional buffer to avoid extra memory allocations (for many calls with the same sizes).
+
+ :param stream: Stream for the asynchronous version.
+
+
+
gpu::histRange
------------------
-.. ocv:function:: void gpu::histRange(const GpuMat& src, GpuMat& hist, const GpuMat& levels)
+Calculates a histogram with bins determined by the ``levels`` array.
+
+.. ocv:function:: void gpu::histRange(const GpuMat& src, GpuMat& hist, const GpuMat& levels, Stream& stream = Stream::Null())
+
+.. ocv:function:: void gpu::histRange(const GpuMat& src, GpuMat& hist, const GpuMat& levels, GpuMat& buf, Stream& stream = Stream::Null())
-.. ocv:function:: void gpu::histRange(const GpuMat& src, GpuMat* hist, const GpuMat* levels)
+.. ocv:function:: void gpu::histRange(const GpuMat& src, GpuMat* hist, const GpuMat* levels, Stream& stream = Stream::Null())
- Calculates a histogram with bins determined by the ``levels`` array.
+.. ocv:function:: void gpu::histRange(const GpuMat& src, GpuMat* hist, const GpuMat* levels, GpuMat& buf, 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.
+ :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.
:param hist: Destination histogram with one row, ``(levels.cols-1)`` columns, and the ``CV_32SC1`` type.
:param levels: Number of levels in the histogram.
+ :param buf: Optional buffer to avoid extra memory allocations (for many calls with the same sizes).
+
+ :param stream: Stream for the asynchronous version.
+
+
+
+gpu::calcHist
+------------------
+Calculates histogram for one channel 8-bit image.
+
+.. ocv:function:: void gpu::calcHist(const GpuMat& src, GpuMat& hist, Stream& stream = Stream::Null())
+
+.. ocv:function:: void gpu::calcHist(const GpuMat& src, GpuMat& hist, GpuMat& buf, Stream& stream = Stream::Null())
+
+ :param src: Source image.
+
+ :param hist: Destination histogram with one row, 256 columns, and the ``CV_32SC1`` type.
+
+ :param buf: Optional buffer to avoid extra memory allocations (for many calls with the same sizes).
+
+ :param stream: Stream for the asynchronous version.
+
+
+
+gpu::equalizeHist
+------------------
+Equalizes the histogram of a grayscale image.
+
+.. ocv:function:: void gpu::equalizeHist(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null())
+
+.. ocv:function:: void gpu::equalizeHist(const GpuMat& src, GpuMat& dst, GpuMat& hist, Stream& stream = Stream::Null())
+
+.. ocv:function:: void gpu::equalizeHist(const GpuMat& src, GpuMat& dst, GpuMat& hist, GpuMat& buf, Stream& stream = Stream::Null())
+
+ :param src: Source image.
+
+ :param dst: Destination image.
+
+ :param hist: Destination histogram with one row, 256 columns, and the ``CV_32SC1`` type.
+
+ :param buf: Optional buffer to avoid extra memory allocations (for many calls with the same sizes).
+
+ :param stream: Stream for the asynchronous version.
+
+.. seealso:: :ocv:func:`equalizeHist`
+
+
+
+gpu::buildWarpPlaneMaps
+-------------------
+Builds plane warping maps.
+
+.. ocv:function:: void gpu::buildWarpPlaneMaps(Size src_size, Rect dst_roi, const Mat& R, double f, double s, double dist, GpuMat& map_x, GpuMat& map_y, Stream& stream = Stream::Null())
+
+ :param stream: Stream for the asynchronous version.
+
+
+
+gpu::buildWarpCylindricalMaps
+-------------------
+Builds cylindrical warping maps.
+
+.. ocv:function:: void gpu::buildWarpCylindricalMaps(Size src_size, Rect dst_roi, const Mat& R, double f, double s, GpuMat& map_x, GpuMat& map_y, Stream& stream = Stream::Null())
+
+ :param stream: Stream for the asynchronous version.
+
+
+
+gpu::buildWarpSphericalMaps
+-------------------
+Builds spherical warping maps.
+
+.. ocv:function:: void gpu::buildWarpSphericalMaps(Size src_size, Rect dst_roi, const Mat& R, double f, double s, GpuMat& map_x, GpuMat& map_y, Stream& stream = Stream::Null())
+
+ :param stream: Stream for the asynchronous version.
+
+
+
+gpu::downsample
+-------------------
+Downsamples image by rejecting even rows and columns.
+
+.. ocv:function:: void gpu::downsample(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null())
+
+ :param src: Source image.
+
+ :param dst: Destination image. Will have ``Size((src.cols+1)/2, (src.rows+1)/2)`` size and the same type as ``src`` .
+
+ :param stream: Stream for the asynchronous version.
+
+
+
+gpu::upsample
+-------------------
+Upsamples the source image by injecting even zero rows and columns.
+
+.. ocv:function:: void gpu::upsample(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null())
+
+ :param src: Source image.
+
+ :param dst: Destination image. Will have ``Size(src.cols*2, src.rows*2)`` size and the same type as ``src`` .
+
+ :param stream: Stream for the asynchronous version.
+
+
+
+gpu::pyrDown
+-------------------
+Smoothes an image and downsamples it.
+
+.. ocv:function:: void gpu::pyrDown(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null())
+
+ :param src: Source image.
+
+ :param dst: Destination image. Will have ``Size((src.cols+1)/2, (src.rows+1)/2)`` size and the same type as ``src`` .
+
+ :param stream: Stream for the asynchronous version.
+
+.. seealso:: :ocv:func:`pyrDown`
+
+
+
+gpu::pyrUp
+-------------------
+Upsamples an image and then smoothes it.
+
+.. ocv:function:: void gpu::pyrUp(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null())
+
+ :param src: Source image.
+
+ :param dst: Destination image. Will have ``Size(src.cols*2, src.rows*2)`` size and the same type as ``src`` .
+
+ :param stream: Stream for the asynchronous version.
+
+.. seealso:: :ocv:func:`pyrUp`
+
+
+
+gpu::blendLinear
+-------------------
+Performs linear blending of two images.
+
+.. ocv:function:: void gpu::blendLinear(const GpuMat& img1, const GpuMat& img2, const GpuMat& weights1, const GpuMat& weights2, GpuMat& result, Stream& stream = Stream::Null())
+
+ :param img1: First image. Supports only ``CV_8U`` and ``CV_32F`` depth.
+
+ :param img1: Second image. Must have the same size and the same type as ``img1`` .
+
+ :param weights1: Weights for first image. Must have tha same size as ``img1`` . Supports only ``CV_32F`` type.
+
+ :param weights2: Weights for second image. Must have tha same size as ``img2`` . Supports only ``CV_32F`` type.
+
+ :param result: Destination image.
+
+ :param stream: Stream for the asynchronous version.
+
+
+
+gpu::Canny
+-------------------
+Finds edges in an image using the [Canny86]_ algorithm.
+
+.. ocv:function:: void gpu::Canny(const GpuMat& image, GpuMat& edges, double low_thresh, double high_thresh, int apperture_size = 3, bool L2gradient = false)
+
+.. ocv:function:: void gpu::Canny(const GpuMat& image, CannyBuf& buf, GpuMat& edges, double low_thresh, double high_thresh, int apperture_size = 3, bool L2gradient = false)
+
+.. ocv:function:: void gpu::Canny(const GpuMat& dx, const GpuMat& dy, GpuMat& edges, double low_thresh, double high_thresh, bool L2gradient = false)
+
+.. ocv:function:: void gpu::Canny(const GpuMat& dx, const GpuMat& dy, CannyBuf& buf, GpuMat& edges, double low_thresh, double high_thresh, bool L2gradient = false)
+
+ :param image: Single-channel 8-bit input image.
+
+ :param dx: First derivative of image in the vertical direction. Support only ``CV_32S`` type.
+
+ :param dy: First derivative of image in the horizontal direction. Support only ``CV_32S`` type.
+
+ :param edges: Output edge map. It has the same size and type as ``image`` .
+
+ :param threshold1: First threshold for the hysteresis procedure.
+
+ :param threshold2: Second threshold for the hysteresis procedure.
+
+ :param apertureSize: Aperture size for the :ocv:func:`Sobel` operator.
+
+ :param L2gradient: Flag indicating whether a more accurate :math:`L_2` norm :math:`=\sqrt{(dI/dx)^2 + (dI/dy)^2}` should be used to compute the image gradient magnitude ( ``L2gradient=true`` ), or a faster default :math:`L_1` norm :math:`=|dI/dx|+|dI/dy|` is enough ( ``L2gradient=false`` ).
+
+ :param buf: Optional buffer to avoid extra memory allocations (for many calls with the same sizes).
+
+.. seealso:: :ocv:func:`Canny`
+
Initalization and Information
=============================
+
.. highlight:: cpp
-.. index:: gpu::getCudaEnabledDeviceCount
+
gpu::getCudaEnabledDeviceCount
----------------------------------
+Returns the number of installed CUDA-enabled devices.
.. ocv:function:: int gpu::getCudaEnabledDeviceCount()
- Returns the number of installed CUDA-enabled devices. Use this function before any other GPU functions calls. If OpenCV is compiled without GPU support, this function returns 0.
+Use this function before any other GPU functions calls. If OpenCV is compiled without GPU support, this function returns 0.
+
-.. index:: gpu::setDevice
gpu::setDevice
------------------
-.. ocv:function:: void gpu::setDevice(int device)
+Sets a device and initializes it for the current thread.
- Sets a device and initializes it for the current thread. If the call of this function is omitted, a default device is initialized at the fist GPU usage.
+.. ocv:function:: void gpu::setDevice(int device)
:param device: System index of a GPU device starting with 0.
-.. index:: gpu::getDevice
+If the call of this function is omitted, a default device is initialized at the fist GPU usage.
+
+
gpu::getDevice
------------------
+Returns the current device index set by :ocv:func:`gpu::setDevice` or initialized by default.
+
.. ocv:function:: int gpu::getDevice()
- Returns the current device index set by ``{gpu::getDevice}`` or initialized by default.
-.. index:: gpu::GpuFeature
-gpu::GpuFeature
+gpu::resetDevice
+------------------
+Explicitly destroys and cleans up all resources associated with the current device in the current process.
+
+.. ocv:function:: void gpu::resetDevice()
+
+Any subsequent API call to this device will reinitialize the device.
+
+
+
+gpu::FeatureSet
---------------
-.. ocv:class:: gpu::GpuFeature
-
-Class providing GPU computing features.
-::
+.. ocv:class:: gpu::FeatureSet
+
+Class providing GPU computing features. ::
- enum GpuFeature
+ enum FeatureSet
{
- COMPUTE_10, COMPUTE_11,
- COMPUTE_12, COMPUTE_13,
- COMPUTE_20, COMPUTE_21,
- ATOMICS, NATIVE_DOUBLE
+ FEATURE_SET_COMPUTE_10,
+ FEATURE_SET_COMPUTE_11,
+ FEATURE_SET_COMPUTE_12,
+ FEATURE_SET_COMPUTE_13,
+ FEATURE_SET_COMPUTE_20,
+ FEATURE_SET_COMPUTE_21,
+ GLOBAL_ATOMICS,
+ NATIVE_DOUBLE
};
-.. index:: gpu::DeviceInfo
+
+gpu::TargetArchs
+----------------
+.. ocv:class:: gpu::TargetArchs
+
+Class providing a set of static methods to check what NVIDIA* card architecture the GPU module was built for.
+
+The following method checks whether the module was built with the support of the given feature:
+
+ .. ocv:function:: static bool gpu::TargetArchs::builtWith(FeatureSet feature)
+
+ :param feature: Feature to be checked. See :ocv:class:`gpu::FeatureSet`.
+
+There is a set of methods to check whether the module contains intermediate (PTX) or binary GPU code for the given architecture(s):
+
+ .. ocv:function:: static bool gpu::TargetArchs::has(int major, int minor)
+
+ .. ocv:function:: static bool gpu::TargetArchs::hasPtx(int major, int minor)
+
+ .. ocv:function:: static bool gpu::TargetArchs::hasBin(int major, int minor)
+
+ .. ocv:function:: static bool gpu::TargetArchs::hasEqualOrLessPtx(int major, int minor)
+
+ .. ocv:function:: static bool gpu::TargetArchs::hasEqualOrGreater(int major, int minor)
+
+ .. ocv:function:: static bool gpu::TargetArchs::hasEqualOrGreaterPtx(int major, int minor)
+
+ .. ocv:function:: static bool gpu::TargetArchs::hasEqualOrGreaterBin(int major, int minor)
+
+ :param major: Major compute capability version.
+
+ :param minor: Minor compute capability version.
+
+According to the CUDA C Programming Guide Version 3.2: "PTX code produced for some specific compute capability can always be compiled to binary code of greater or equal compute capability".
+
+
gpu::DeviceInfo
---------------
.. ocv:class:: gpu::DeviceInfo
-Class providing functionality for querying the specified GPU properties.
-::
+Class providing functionality for querying the specified GPU properties. ::
class CV_EXPORTS DeviceInfo
{
size_t freeMemory() const;
size_t totalMemory() const;
- bool supports(GpuFeature feature) const;
+ bool supports(FeatureSet feature) const;
bool isCompatible() const;
+
+ int deviceID() const;
};
-.. index:: gpu::DeviceInfo::DeviceInfo
-.. Comment: two lines below look like a bug
gpu::DeviceInfo::DeviceInfo
--------------------------------
+-------------------------------
+The constructors.
+
.. ocv:function:: gpu::DeviceInfo::DeviceInfo()
.. ocv:function:: gpu::DeviceInfo::DeviceInfo(int device_id)
- Constructs the ``DeviceInfo`` object for the specified device. If ``device_id`` parameter is missed, it constructs an object for the current device.
-
:param device_id: System index of the GPU device starting with 0.
-.. index:: gpu::DeviceInfo::name
+Constructs the ``DeviceInfo`` object for the specified device. If ``device_id`` parameter is missed, it constructs an object for the current device.
+
+
gpu::DeviceInfo::name
-------------------------
+Returns the device name.
+
.. ocv:function:: string gpu::DeviceInfo::name()
- Returns the device name.
-.. index:: gpu::DeviceInfo::majorVersion
gpu::DeviceInfo::majorVersion
---------------------------------
+Returns the major compute capability version.
+
.. ocv:function:: int gpu::DeviceInfo::majorVersion()
- Returns the major compute capability version.
-.. index:: gpu::DeviceInfo::minorVersion
gpu::DeviceInfo::minorVersion
---------------------------------
+Returns the minor compute capability version.
+
.. ocv:function:: int gpu::DeviceInfo::minorVersion()
- Returns the minor compute capability version.
-.. index:: gpu::DeviceInfo::multiProcessorCount
gpu::DeviceInfo::multiProcessorCount
----------------------------------------
+Returns the number of streaming multiprocessors.
+
.. ocv:function:: int gpu::DeviceInfo::multiProcessorCount()
- Returns the number of streaming multiprocessors.
-.. index:: gpu::DeviceInfo::freeMemory
gpu::DeviceInfo::freeMemory
-------------------------------
+Returns the amount of free memory in bytes.
+
.. ocv:function:: size_t gpu::DeviceInfo::freeMemory()
- Returns the amount of free memory in bytes.
-.. index:: gpu::DeviceInfo::totalMemory
gpu::DeviceInfo::totalMemory
--------------------------------
+Returns the amount of total memory in bytes.
+
.. ocv:function:: size_t gpu::DeviceInfo::totalMemory()
- Returns the amount of total memory in bytes.
-.. index:: gpu::DeviceInfo::supports
gpu::DeviceInfo::supports
-----------------------------
-.. ocv:function:: bool gpu::DeviceInfo::supports(GpuFeature feature)
-
- Provides information on GPU feature support. This function returns true if the device has the specified GPU feature. Otherwise, it returns false.
-
- :param feature: Feature to be checked. See :ocv:class:`gpu::GpuFeature`.
+Provides information on GPU feature support.
-.. index:: gpu::DeviceInfo::isCompatible
-
-gpu::DeviceInfo::isCompatible
----------------------------------
-.. ocv:function:: bool gpu::DeviceInfo::isCompatible()
+.. ocv:function:: bool gpu::DeviceInfo::supports(FeatureSet feature)
- Checks the GPU module and device compatibility. This function returns ``true`` if the GPU module can be run on the specified device. Otherwise, it returns false.
+ :param feature: Feature to be checked. See :ocv:class:`gpu::FeatureSet`.
-.. index:: gpu::TargetArchs
+This function returns ``true`` if the device has the specified GPU feature. Otherwise, it returns ``false`` .
-gpu::TargetArchs
-----------------
-.. ocv:class:: gpu::TargetArchs
-Class providing a set of static methods to check what NVIDIA* card architecture the GPU module was built for.
-The following method checks whether the module was built with the support of the given feature:
-
- .. ocv:function:: static bool gpu::TargetArchs::builtWith(GpuFeature feature)
-
- :param feature: Feature to be checked. See :ocv:class:`gpu::GpuFeature`.
-
-There is a set of methods to check whether the module contains intermediate (PTX) or binary GPU code for the given architecture(s):
-
- .. ocv:function:: static bool gpu::TargetArchs::has(int major, int minor)
-
- .. ocv:function:: static bool gpu::TargetArchs::hasPtx(int major, int minor)
-
- .. ocv:function:: static bool gpu::TargetArchs::hasBin(int major, int minor)
-
- .. ocv:function:: static bool gpu::TargetArchs::hasEqualOrLessPtx(int major, int minor)
+gpu::DeviceInfo::isCompatible
+---------------------------------
+Checks the GPU module and device compatibility.
- .. ocv:function:: static bool gpu::TargetArchs::hasEqualOrGreater(int major, int minor)
+.. ocv:function:: bool gpu::DeviceInfo::isCompatible()
- .. ocv:function:: static bool gpu::TargetArchs::hasEqualOrGreaterPtx(int major, int minor)
+This function returns ``true`` if the GPU module can be run on the specified device. Otherwise, it returns ``false`` .
- .. ocv:function:: static bool gpu::TargetArchs::hasEqualOrGreaterBin(int major, int minor)
- :param major: Major compute capability version.
-
- :param minor: Minor compute capability version.
-According to the CUDA C Programming Guide Version 3.2: "PTX code produced for some specific compute capability can always be compiled to binary code of greater or equal compute capability".
+gpu::DeviceInfo::deviceID
+---------------------------------
+Returns system index of the GPU device starting with 0.
+.. ocv:function:: int gpu::DeviceInfo::deviceID()
.. highlight:: cpp
-.. index:: gpu::meanStdDev
+
gpu::meanStdDev
-------------------
-.. ocv:function:: void gpu::meanStdDev(const GpuMat\& mtx, Scalar\& mean, Scalar\& stddev)
+Computes a mean value and a standard deviation of matrix elements.
- Computes a mean value and a standard deviation of matrix elements.
+.. ocv:function:: void gpu::meanStdDev(const GpuMat& mtx, Scalar& mean, Scalar& stddev)
:param mtx: Source matrix. ``CV_8UC1`` matrices are supported for now.
:param stddev: Standard deviation value.
-.. seealso::
- :ocv:func:`meanStdDev`
+.. seealso:: :ocv:func:`meanStdDev`
+
-.. index:: gpu::norm
gpu::norm
-------------
-.. ocv:function:: double gpu::norm(const GpuMat\& src1, int normType=NORM_L2)
-.. ocv:function:: double gpu::norm(const GpuMat\& src1, int normType, GpuMat\& buf)
-.. ocv:function:: double norm(const GpuMat\& src1, const GpuMat\& src2, int normType=NORM_L2)
+Returns the norm of a matrix (or difference of two matrices).
+
+.. ocv:function:: double gpu::norm(const GpuMat& src1, int normType=NORM_L2)
+
+.. ocv:function:: double gpu::norm(const GpuMat& src1, int normType, GpuMat& buf)
- Returns the norm of a matrix (or difference of two matrices).
+.. ocv:function:: double gpu::norm(const GpuMat& src1, const GpuMat& src2, int normType=NORM_L2)
:param src1: Source matrix. Any matrices except 64F are supported.
:param buf: Optional buffer to avoid extra memory allocations. It is resized automatically.
-.. seealso::
- :ocv:func:`norm`
+.. seealso:: :ocv:func:`norm`
+
-.. index:: gpu::sum
gpu::sum
------------
-.. ocv:function:: Scalar gpu::sum(const GpuMat\& src)
+Returns the sum of matrix elements.
-.. ocv:function:: Scalar gpu::sum(const GpuMat\& src, GpuMat\& buf)
+.. ocv:function:: Scalar gpu::sum(const GpuMat& src)
- Returns the sum of matrix elements.
+.. ocv:function:: Scalar gpu::sum(const GpuMat& src, GpuMat& buf)
:param src: Source image of any depth except for ``CV_64F`` .
:param buf: Optional buffer to avoid extra memory allocations. It is resized automatically.
-.. seealso::
- :ocv:func:`sum`
+.. seealso:: :ocv:func:`sum`
+
-.. index:: gpu::absSum
gpu::absSum
---------------
-.. ocv:function:: Scalar gpu::absSum(const GpuMat\& src)
+Returns the sum of absolute values for matrix elements.
-.. ocv:function:: Scalar gpu::absSum(const GpuMat\& src, GpuMat\& buf)
+.. ocv:function:: Scalar gpu::absSum(const GpuMat& src)
- Returns the sum of absolute values for matrix elements.
+.. ocv:function:: Scalar gpu::absSum(const GpuMat& src, GpuMat& buf)
:param src: Source image of any depth except for ``CV_64F`` .
:param buf: Optional buffer to avoid extra memory allocations. It is resized automatically.
-.. index:: gpu::sqrSum
+
gpu::sqrSum
---------------
-.. ocv:function:: Scalar gpu::sqrSum(const GpuMat\& src)
+Returns the squared sum of matrix elements.
-.. ocv:function:: Scalar gpu::sqrSum(const GpuMat\& src, GpuMat\& buf)
+.. ocv:function:: Scalar gpu::sqrSum(const GpuMat& src)
- Returns the squared sum of matrix elements.
+.. ocv:function:: Scalar gpu::sqrSum(const GpuMat& src, GpuMat& buf)
:param src: Source image of any depth except for ``CV_64F`` .
:param buf: Optional buffer to avoid extra memory allocations. It is resized automatically.
-.. index:: gpu::minMax
+
gpu::minMax
---------------
-.. ocv:function:: void gpu::minMax(const GpuMat\& src, double* minVal, double* maxVal=0, const GpuMat\& mask=GpuMat())
+Finds global minimum and maximum matrix elements and returns their values.
-.. ocv:function:: void gpu::minMax(const GpuMat\& src, double* minVal, double* maxVal, const GpuMat\& mask, GpuMat\& buf)
+.. ocv:function:: void gpu::minMax(const GpuMat& src, double* minVal, double* maxVal=0, const GpuMat& mask=GpuMat())
- Finds global minimum and maximum matrix elements and returns their values.
+.. ocv:function:: void gpu::minMax(const GpuMat& src, double* minVal, double* maxVal, const GpuMat& mask, GpuMat& buf)
:param src: Single-channel source image.
:param buf: Optional buffer to avoid extra memory allocations. It is resized automatically.
The function does not work with ``CV_64F`` images on GPUs with the compute capability < 1.3.
-
-.. seealso::
- :ocv:func:`minMaxLoc`
-.. index:: gpu::minMaxLoc
+.. seealso:: :ocv:func:`minMaxLoc`
+
+
gpu::minMaxLoc
------------------
+Finds global minimum and maximum matrix elements and returns their values with locations.
+
.. ocv:function:: void gpu::minMaxLoc(const GpuMat& src, double* minVal, double* maxVal=0, Point* minLoc=0, Point* maxLoc=0, const GpuMat& mask=GpuMat())
.. ocv:function:: void gpu::minMaxLoc(const GpuMat& src, double* minVal, double* maxVal, Point* minLoc, Point* maxLoc, const GpuMat& mask, GpuMat& valbuf, GpuMat& locbuf)
- Finds global minimum and maximum matrix elements and returns their values with locations.
-
:param src: Single-channel source image.
:param minVal: Pointer to the returned minimum value. Use ``NULL`` if not required.
The function does not work with ``CV_64F`` images on GPU with the compute capability < 1.3.
-.. seealso::
- :ocv:func:`minMaxLoc`
+.. seealso:: :ocv:func:`minMaxLoc`
+
-.. index:: gpu::countNonZero
gpu::countNonZero
---------------------
-.. ocv:function:: int gpu::countNonZero(const GpuMat\& src)
+Counts non-zero matrix elements.
-.. ocv:function:: int gpu::countNonZero(const GpuMat\& src, GpuMat\& buf)
+.. ocv:function:: int gpu::countNonZero(const GpuMat& src)
- Counts non-zero matrix elements.
+.. ocv:function:: int gpu::countNonZero(const GpuMat& src, GpuMat& buf)
:param src: Single-channel source image.
:param buf: Optional buffer to avoid extra memory allocations. It is resized automatically.
The function does not work with ``CV_64F`` images on GPUs with the compute capability < 1.3.
-
-.. seealso::
- :ocv:func:`countNonZero`
+
+.. seealso:: :ocv:func:`countNonZero`
.. highlight:: cpp
-.. index:: gpu::HOGDescriptor
+
gpu::HOGDescriptor
------------------
.. ocv:class:: gpu::HOGDescriptor
-The class implements Histogram of Oriented Gradients ([Dalal2005]_) object detector.
-::
+The class implements Histogram of Oriented Gradients ([Dalal2005]_) object detector. ::
struct CV_EXPORTS HOGDescriptor
{
Interfaces of all methods are kept similar to the ``CPU HOG`` descriptor and detector analogues as much as possible.
-.. index:: gpu::HOGDescriptor::HOGDescriptor
+
gpu::HOGDescriptor::HOGDescriptor
-------------------------------------
-.. ocv:function:: gpu::HOGDescriptor::HOGDescriptor(Size win_size=Size(64, 128), Size block_size=Size(16, 16), Size block_stride=Size(8, 8), Size cell_size=Size(8, 8), int nbins=9, double win_sigma=DEFAULT_WIN_SIGMA, double threshold_L2hys=0.2, bool gamma_correction=true, int nlevels=DEFAULT_NLEVELS)
+Creates the ``HOG`` descriptor and detector.
- Creates the ``HOG`` descriptor and detector.
+.. ocv:function:: gpu::HOGDescriptor::HOGDescriptor(Size win_size=Size(64, 128), Size block_size=Size(16, 16), Size block_stride=Size(8, 8), Size cell_size=Size(8, 8), int nbins=9, double win_sigma=DEFAULT_WIN_SIGMA, double threshold_L2hys=0.2, bool gamma_correction=true, int nlevels=DEFAULT_NLEVELS)
:param win_size: Detection window size. Align to block size and block stride.
:param nlevels: Maximum number of detection window increases.
-.. index:: gpu::HOGDescriptor::getDescriptorSize
+
gpu::HOGDescriptor::getDescriptorSize
-----------------------------------------
+Returns the number of coefficients required for the classification.
+
.. ocv:function:: size_t gpu::HOGDescriptor::getDescriptorSize() const
- Returns the number of coefficients required for the classification.
-.. index:: gpu::HOGDescriptor::getBlockHistogramSize
gpu::HOGDescriptor::getBlockHistogramSize
---------------------------------------------
+Returns the block histogram size.
+
.. ocv:function:: size_t gpu::HOGDescriptor::getBlockHistogramSize() const
- Returns the block histogram size.
-.. index:: gpu::HOGDescriptor::setSVMDetector
gpu::HOGDescriptor::setSVMDetector
--------------------------------------
+Sets coefficients for the linear SVM classifier.
+
.. ocv:function:: void gpu::HOGDescriptor::setSVMDetector(const vector<float>& detector)
- Sets coefficients for the linear SVM classifier.
-.. index:: gpu::HOGDescriptor::getDefaultPeopleDetector
gpu::HOGDescriptor::getDefaultPeopleDetector
------------------------------------------------
+Returns coefficients of the classifier trained for people detection (for default window size).
+
.. ocv:function:: static vector<float> gpu::HOGDescriptor::getDefaultPeopleDetector()
- Returns coefficients of the classifier trained for people detection (for default window size).
-.. index:: gpu::HOGDescriptor::getPeopleDetector48x96
gpu::HOGDescriptor::getPeopleDetector48x96
----------------------------------------------
+Returns coefficients of the classifier trained for people detection (for 48x96 windows).
+
.. ocv:function:: static vector<float> gpu::HOGDescriptor::getPeopleDetector48x96()
- Returns coefficients of the classifier trained for people detection (for 48x96 windows).
-.. index:: gpu::HOGDescriptor::getPeopleDetector64x128
gpu::HOGDescriptor::getPeopleDetector64x128
-----------------------------------------------
+Returns coefficients of the classifier trained for people detection (for 64x128 windows).
+
.. ocv:function:: static vector<float> gpu::HOGDescriptor::getPeopleDetector64x128()
- Returns coefficients of the classifier trained for people detection (for 64x128 windows).
-.. index:: gpu::HOGDescriptor::detect
gpu::HOGDescriptor::detect
------------------------------
-.. ocv:function:: void gpu::HOGDescriptor::detect(const GpuMat& img, vector<Point>& found_locations, double hit_threshold=0, Size win_stride=Size(), Size padding=Size())
+Performs object detection without a multi-scale window.
- Performs object detection without a multi-scale window.
+.. ocv:function:: void gpu::HOGDescriptor::detect(const GpuMat& img, vector<Point>& found_locations, double hit_threshold=0, Size win_stride=Size(), Size padding=Size())
:param img: Source image. ``CV_8UC1`` and ``CV_8UC4`` types are supported for now.
:param padding: Mock parameter to keep the CPU interface compatibility. It must be (0,0).
-.. index:: gpu::HOGDescriptor::detectMultiScale
+
gpu::HOGDescriptor::detectMultiScale
----------------------------------------
-.. ocv:function:: void gpu::HOGDescriptor::detectMultiScale(const GpuMat& img, vector<Rect>& found_locations, double hit_threshold=0, Size win_stride=Size(), Size padding=Size(), double scale0=1.05, int group_threshold=2)
+Performs object detection with a multi-scale window.
- Performs object detection with a multi-scale window.
+.. ocv:function:: void gpu::HOGDescriptor::detectMultiScale(const GpuMat& img, vector<Rect>& found_locations, double hit_threshold=0, Size win_stride=Size(), Size padding=Size(), double scale0=1.05, int group_threshold=2)
:param img: Source image. See :ocv:func:`gpu::HOGDescriptor::detect` for type limitations.
:param group_threshold: Coefficient to regulate the similarity threshold. When detected, some objects can be covered by many rectangles. 0 means not to perform grouping. See :ocv:func:`groupRectangles` .
-.. index:: gpu::HOGDescriptor::getDescriptors
+
gpu::HOGDescriptor::getDescriptors
--------------------------------------
-.. ocv:function:: void gpu::HOGDescriptor::getDescriptors(const GpuMat& img, Size win_stride, GpuMat& descriptors, int descr_format=DESCR_FORMAT_COL_BY_COL)
+Returns block descriptors computed for the whole image.
- Returns block descriptors computed for the whole image. The function is mainly used to learn the classifier.
+.. ocv:function:: void gpu::HOGDescriptor::getDescriptors(const GpuMat& img, Size win_stride, GpuMat& descriptors, int descr_format=DESCR_FORMAT_COL_BY_COL)
:param img: Source image. See :ocv:func:`gpu::HOGDescriptor::detect` for type limitations.
:param descriptors: 2D array of descriptors.
- :param descr_format: Descriptor storage format:
+ :param descr_format: Descriptor storage format:
* **DESCR_FORMAT_ROW_BY_ROW** - Row-major order.
* **DESCR_FORMAT_COL_BY_COL** - Column-major order.
-
-.. index:: gpu::CascadeClassifier_GPU
+The function is mainly used to learn the classifier.
+
+
gpu::CascadeClassifier_GPU
--------------------------
.. ocv:class:: gpu::CascadeClassifier_GPU
-Cascade classifier class used for object detection.
-::
+Cascade classifier class used for object detection. ::
class CV_EXPORTS CascadeClassifier_GPU
{
};
-.. index:: gpu::CascadeClassifier_GPU::CascadeClassifier_GPU
gpu::CascadeClassifier_GPU::CascadeClassifier_GPU
-----------------------------------------------------
-.. ocv:function:: gpu::CascadeClassifier_GPU(const string& filename)
+Loads the classifier from a file.
- Loads the classifier from a file.
+.. ocv:function:: gpu::CascadeClassifier_GPU(const string& filename)
: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.
-.. index:: gpu::CascadeClassifier_GPU::empty
-.. _gpu::CascadeClassifier_GPU::empty:
gpu::CascadeClassifier_GPU::empty
-------------------------------------
-.. ocv:function:: bool gpu::CascadeClassifier_GPU::empty() const
+Checks whether the classifier is loaded or not.
- Checks whether the classifier is loaded or not.
+.. ocv:function:: bool gpu::CascadeClassifier_GPU::empty() const
-.. index:: gpu::CascadeClassifier_GPU::load
-.. _gpu::CascadeClassifier_GPU::load:
gpu::CascadeClassifier_GPU::load
------------------------------------
-.. ocv:function:: bool gpu::CascadeClassifier_GPU::load(const string& filename)
+Loads the classifier from a file. The previous content is destroyed.
- Loads the classifier from a file. The previous content is destroyed.
+.. ocv:function:: bool gpu::CascadeClassifier_GPU::load(const string& filename)
: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.
-.. index:: gpu::CascadeClassifier_GPU::release
+
gpu::CascadeClassifier_GPU::release
---------------------------------------
+Destroys the loaded classifier.
+
.. ocv:function:: void gpu::CascadeClassifier_GPU::release()
- Destroys the loaded classifier.
-.. index:: gpu::CascadeClassifier_GPU::detectMultiScale
gpu::CascadeClassifier_GPU::detectMultiScale
------------------------------------------------
-.. ocv:function:: int gpu::CascadeClassifier_GPU::detectMultiScale(const GpuMat& image, GpuMat& objectsBuf, double scaleFactor=1.2, int minNeighbors=4, Size minSize=Size())
+Detects objects of different sizes in the input image.
- Detects objects of different sizes in the input image. The detected objects are returned as a list of rectangles.
+.. ocv:function:: int gpu::CascadeClassifier_GPU::detectMultiScale(const GpuMat& image, GpuMat& objectsBuf, double scaleFactor=1.2, int minNeighbors=4, Size minSize=Size())
:param image: Matrix of type ``CV_8U`` containing an image where objects should be detected.
:param minSize: Minimum possible object size. Objects smaller than that are ignored.
- The function returns the number of detected objects, so you can retrieve them as in the following example:
+The detected objects are returned as a list of rectangles.
-::
+The function returns the number of detected objects, so you can retrieve them as in the following example: ::
gpu::CascadeClassifier_GPU cascade_gpu(...);
imshow("Faces", image_cpu);
-.. seealso:: :ocv:func:`CascadeClassifier::detectMultiScale`
+.. seealso:: :ocv:func:`CascadeClassifier::detectMultiScale`
+
+
.. [Dalal2005] Navneet Dalal and Bill Triggs. *Histogram of oriented gradients for human detection*. 2005.
.. highlight:: cpp
-.. index:: gpu::transpose
+
gpu::transpose
------------------
-.. ocv:function:: void gpu::transpose(const GpuMat& src, GpuMat& dst)
+Transposes a matrix.
- Transposes a matrix.
+.. ocv:function:: void gpu::transpose(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null())
- :param src: Source matrix. 1-, 4-, 8-byte element sizes are supported for now.
+ :param src: Source matrix. 1-, 4-, 8-byte element sizes are supported for now (CV_8UC1, CV_8UC4, CV_16UC2, CV_32FC1, etc).
:param dst: Destination matrix.
-.. seealso::
- :ocv:func:`transpose`
+ :param stream: Stream for the asynchronous version.
+
+.. seealso:: :ocv:func:`transpose`
+
-.. index:: gpu::flip
gpu::flip
-------------
-.. ocv:function:: void gpu::flip(const GpuMat& src, GpuMat& dst, int flipCode)
+Flips a 2D matrix around vertical, horizontal, or both axes.
- Flips a 2D matrix around vertical, horizontal, or both axes.
+.. ocv:function:: void gpu::flip(const GpuMat& src, GpuMat& dst, int flipCode, Stream& stream = Stream::Null())
:param src: Source matrix. Only ``CV_8UC1`` and ``CV_8UC4`` matrices are supported for now.
:param dst: Destination matrix.
:param flipCode: Flip mode for the source:
-
- * ``0`` Flips around x-axis.
-
- * ``>0`` Flips around y-axis.
-
- * ``<0`` Flips around both axes.
-
-.. seealso::
- :ocv:func:`flip`
+ * ``0`` Flips around x-axis.
+
+ * ``>0`` Flips around y-axis.
+
+ * ``<0`` Flips around both axes.
+
+ :param stream: Stream for the asynchronous version.
+
+.. seealso:: :ocv:func:`flip`
+
-.. index:: gpu::LUT
gpu::LUT
------------
-.. ocv:function:: void gpu::LUT(const GpuMat& src, const Mat& lut, GpuMat& dst)
+Transforms the source matrix into the destination matrix using the given look-up table: ``dst(I) = lut(src(I))``
- Transforms the source matrix into the destination matrix using the given look-up table: ``dst(I) = lut(src(I))``
+.. ocv:function:: void gpu::LUT(const GpuMat& src, const Mat& lut, GpuMat& dst, Stream& stream = Stream::Null())
:param src: Source matrix. ``CV_8UC1`` and ``CV_8UC3`` matrices are supported for now.
:param lut: Look-up table of 256 elements. It is a continuous ``CV_8U`` matrix.
- :param dst: Destination matrix with the same depth as ``lut`` and the same number of channels as ``src``.
-
+ :param dst: Destination matrix with the same depth as ``lut`` and the same number of channels as ``src`` .
-.. seealso::
- :ocv:func:`LUT`
+ :param stream: Stream for the asynchronous version.
-.. index:: gpu::merge
+.. seealso:: :ocv:func:`LUT`
-gpu::merge
---------------
-.. ocv:function:: void gpu::merge(const GpuMat* src, size_t n, GpuMat& dst)
-.. ocv:function:: void gpu::merge(const GpuMat* src, size_t n, GpuMat& dst, const Stream& stream)
-.. ocv:function:: void gpu::merge(const vector<GpuMat>& src, GpuMat& dst)
+gpu::merge
+--------------
+Makes a multi-channel matrix out of several single-channel matrices.
-.. ocv:function:: void gpu::merge(const vector<GpuMat>& src, GpuMat& dst, const Stream& stream)
+.. ocv:function:: void gpu::merge(const GpuMat* src, size_t n, GpuMat& dst, Stream& stream = Stream::Null())
- Makes a multi-channel matrix out of several single-channel matrices.
+.. ocv:function:: void gpu::merge(const vector<GpuMat>& src, GpuMat& dst, Stream& stream = Stream::Null())
:param src: Array/vector of source matrices.
:param stream: Stream for the asynchronous version.
-.. seealso::
- :ocv:func:`merge`
+.. seealso:: :ocv:func:`merge`
+
-.. index:: gpu::split
gpu::split
--------------
-.. ocv:function:: void gpu::split(const GpuMat& src, GpuMat* dst)
-
-.. ocv:function:: void gpu::split(const GpuMat& src, GpuMat* dst, const Stream& stream)
-
-.. ocv:function:: void gpu::split(const GpuMat& src, vector<GpuMat>& dst)
+Copies each plane of a multi-channel matrix into an array.
-.. ocv:function:: void gpu::split(const GpuMat& src, vector<GpuMat>& dst, const Stream& stream)
+.. ocv:function:: void gpu::split(const GpuMat& src, GpuMat* dst, Stream& stream = Stream::Null())
- Copies each plane of a multi-channel matrix into an array.
+.. ocv:function:: void gpu::split(const GpuMat& src, vector<GpuMat>& dst, Stream& stream = Stream::Null())
:param src: Source matrix.
:param stream: Stream for the asynchronous version.
-.. seealso::
- :ocv:func:`split`
+.. seealso:: :ocv:func:`split`
+
-.. index:: gpu::magnitude
gpu::magnitude
------------------
-.. ocv:function:: void gpu::magnitude(const GpuMat& xy, GpuMat& magnitude)
+Computes magnitudes of complex matrix elements.
-.. ocv:function:: void gpu::magnitude(const GpuMat& x, const GpuMat& y, GpuMat& magnitude)
+.. ocv:function:: void gpu::magnitude(const GpuMat& xy, GpuMat& magnitude, Stream& stream = Stream::Null())
-.. ocv:function:: void gpu::magnitude(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, const Stream& stream)
+.. ocv:function:: void gpu::magnitude(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, Stream& stream = Stream::Null())
- Computes magnitudes of complex matrix elements.
+ :param xy: Source complex matrix in the interleaved format ( ``CV_32FC2`` ).
- :param xy: Source complex matrix in the interleaved format (``CV_32FC2``).
-
- :param x: Source matrix containing real components (``CV_32FC1``).
+ :param x: Source matrix containing real components ( ``CV_32FC1`` ).
- :param y: Source matrix containing imaginary components (``CV_32FC1``).
+ :param y: Source matrix containing imaginary components ( ``CV_32FC1`` ).
- :param magnitude: Destination matrix of float magnitudes (``CV_32FC1``).
+ :param magnitude: Destination matrix of float magnitudes ( ``CV_32FC1`` ).
:param stream: Stream for the asynchronous version.
-.. seealso::
- :ocv:func:`magnitude`
+.. seealso:: :ocv:func:`magnitude`
+
-.. index:: gpu::magnitudeSqr
gpu::magnitudeSqr
---------------------
-.. ocv:function:: void gpu::magnitudeSqr(const GpuMat& xy, GpuMat& magnitude)
-
-.. ocv:function:: void gpu::magnitudeSqr(const GpuMat& x, const GpuMat& y, GpuMat& magnitude)
+Computes squared magnitudes of complex matrix elements.
-.. ocv:function:: void gpu::magnitudeSqr(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, const Stream& stream)
+.. ocv:function:: void gpu::magnitudeSqr(const GpuMat& xy, GpuMat& magnitude, Stream& stream = Stream::Null())
- Computes squared magnitudes of complex matrix elements.
+.. ocv:function:: void gpu::magnitudeSqr(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, Stream& stream = Stream::Null())
- :param xy: Source complex matrix in the interleaved format (``CV_32FC2``).
+ :param xy: Source complex matrix in the interleaved format ( ``CV_32FC2`` ).
- :param x: Source matrix containing real components (``CV_32FC1``).
+ :param x: Source matrix containing real components ( ``CV_32FC1`` ).
- :param y: Source matrix containing imaginary components (``CV_32FC1``).
+ :param y: Source matrix containing imaginary components ( ``CV_32FC1`` ).
- :param magnitude: Destination matrix of float magnitude squares (``CV_32FC1``).
+ :param magnitude: Destination matrix of float magnitude squares ( ``CV_32FC1`` ).
:param stream: Stream for the asynchronous version.
-.. index:: gpu::phase
+
gpu::phase
--------------
-.. ocv:function:: void gpu::phase(const GpuMat& x, const GpuMat& y, GpuMat& angle, bool angleInDegrees=false)
-
-.. ocv:function:: void gpu::phase(const GpuMat& x, const GpuMat& y, GpuMat& angle, bool angleInDegrees, const Stream& stream)
+Computes polar angles of complex matrix elements.
- Computes polar angles of complex matrix elements.
+.. ocv:function:: void gpu::phase(const GpuMat& x, const GpuMat& y, GpuMat& angle, bool angleInDegrees=false, Stream& stream = Stream::Null())
- :param x: Source matrix containing real components (``CV_32FC1``).
+ :param x: Source matrix containing real components ( ``CV_32FC1`` ).
- :param y: Source matrix containing imaginary components (``CV_32FC1``).
+ :param y: Source matrix containing imaginary components ( ``CV_32FC1`` ).
- :param angle: Destionation matrix of angles (``CV_32FC1``).
+ :param angle: Destionation matrix of angles ( ``CV_32FC1`` ).
:param angleInDegress: Flag for angles that must be evaluated in degress.
:param stream: Stream for the asynchronous version.
-.. seealso::
- :ocv:func:`phase`
+.. seealso:: :ocv:func:`phase`
+
-.. index:: gpu::cartToPolar
gpu::cartToPolar
--------------------
-.. ocv:function:: void gpu::cartToPolar(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, GpuMat& angle, bool angleInDegrees=false)
+Converts Cartesian coordinates into polar.
-.. ocv:function:: void gpu::cartToPolar(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, GpuMat& angle, bool angleInDegrees, const Stream& stream)
+.. ocv:function:: void gpu::cartToPolar(const GpuMat& x, const GpuMat& y, GpuMat& magnitude, GpuMat& angle, bool angleInDegrees=false, Stream& stream = Stream::Null())
- Converts Cartesian coordinates into polar.
+ :param x: Source matrix containing real components ( ``CV_32FC1`` ).
- :param x: Source matrix containing real components (``CV_32FC1``).
+ :param y: Source matrix containing imaginary components ( ``CV_32FC1`` ).
- :param y: Source matrix containing imaginary components (``CV_32FC1``).
+ :param magnitude: Destination matrix of float magnitudes ( ``CV_32FC1`` ).
- :param magnitude: Destination matrix of float magnitudes (``CV_32FC1``).
-
- :param angle: Destionation matrix of angles (``CV_32FC1``).
+ :param angle: Destionation matrix of angles ( ``CV_32FC1`` ).
:param angleInDegress: Flag for angles that must be evaluated in degress.
:param stream: Stream for the asynchronous version.
-.. seealso::
- :ocv:func:`cartToPolar`
+.. seealso:: :ocv:func:`cartToPolar`
+
-.. index:: gpu::polarToCart
gpu::polarToCart
--------------------
-.. ocv:function:: void gpu::polarToCart(const GpuMat& magnitude, const GpuMat& angle, GpuMat& x, GpuMat& y, bool angleInDegrees=false)
-
-.. ocv:function:: void gpu::polarToCart(const GpuMat& magnitude, const GpuMat& angle, GpuMat& x, GpuMat& y, bool angleInDegrees, const Stream& stream)
+Converts polar coordinates into Cartesian.
- Converts polar coordinates into Cartesian.
+.. ocv:function:: void gpu::polarToCart(const GpuMat& magnitude, const GpuMat& angle, GpuMat& x, GpuMat& y, bool angleInDegrees=false, Stream& stream = Stream::Null())
- :param magnitude: Source matrix containing magnitudes (``CV_32FC1``).
+ :param magnitude: Source matrix containing magnitudes ( ``CV_32FC1`` ).
- :param angle: Source matrix containing angles (``CV_32FC1``).
+ :param angle: Source matrix containing angles ( ``CV_32FC1`` ).
- :param x: Destination matrix of real components (``CV_32FC1``).
+ :param x: Destination matrix of real components ( ``CV_32FC1`` ).
- :param y: Destination matrix of imaginary components (``CV_32FC1``).
+ :param y: Destination matrix of imaginary components ( ``CV_32FC1`` ).
:param angleInDegress: Flag that indicates angles in degress.
:param stream: Stream for the asynchronous version.
-.. seealso::
- :ocv:func:`polarToCart`
+.. seealso:: :ocv:func:`polarToCart`
-.. index:: gpu::add
-
gpu::add
------------
-.. ocv:function:: void gpu::add(const GpuMat& src1, const GpuMat& src2, GpuMat& dst)
+Computes a matrix-matrix or matrix-scalar sum.
+
+.. ocv:function:: void gpu::add(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, Stream& stream = Stream::Null())
+
+.. ocv:function:: void gpu::add(const GpuMat& src1, const Scalar& src2, GpuMat& dst, Stream& stream = Stream::Null())
-.. ocv:function:: void gpu::add(const GpuMat& src1, const Scalar& src2, GpuMat& dst)
+ :param src1: First source matrix. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_32SC1`` , and ``CV_32FC1`` matrices are supported for now. Version with scalar supports only ``CV_32FC1`` and ``CV_32FC2`` matrices.
- Computes a matrix-matrix or matrix-scalar sum.
+ :param src2: Second source matrix or a scalar to be added to ``src1`` .
- :param src1: First source matrix. ``CV_8UC1``, ``CV_8UC4``, ``CV_32SC1``, and ``CV_32FC1`` matrices are supported for now.
+ :param dst: Destination matrix with the same size and type as ``src1`` .
- :param src2: Second source matrix or a scalar to be added to ``src1``.
+ :param stream: Stream for the asynchronous version.
- :param dst: Destination matrix with the same size and type as ``src1``.
+.. seealso:: :ocv:func:`add`
-.. seealso::
- :ocv:func:`add`
-.. index:: gpu::subtract
gpu::subtract
-----------------
-.. ocv:function:: void gpu::subtract(const GpuMat& src1, const GpuMat& src2, GpuMat& dst)
+Computes a matrix-matrix or matrix-scalar difference.
-.. ocv:function:: void gpu::subtract(const GpuMat& src1, const Scalar& src2, GpuMat& dst)
+.. ocv:function:: void gpu::subtract(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, Stream& stream = Stream::Null())
- Computes a matrix-matrix or matrix-scalar difference.
+.. ocv:function:: void gpu::subtract(const GpuMat& src1, const Scalar& src2, GpuMat& dst, Stream& stream = Stream::Null())
- :param src1: First source matrix. ``CV_8UC1``, ``CV_8UC4``, ``CV_32SC1``, and ``CV_32FC1`` matrices are supported for now.
+ :param src1: First source matrix. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_32SC1`` , and ``CV_32FC1`` matrices are supported for now. Version with scalar supports only ``CV_32FC1`` and ``CV_32FC2`` matrices.
- :param src2: Second source matrix or a scalar to be subtracted from ``src1``.
+ :param src2: Second source matrix or a scalar to be subtracted from ``src1`` .
- :param dst: Destination matrix with the same size and type as ``src1``.
+ :param dst: Destination matrix with the same size and type as ``src1`` .
-.. seealso::
- :ocv:func:`subtract`
+ :param stream: Stream for the asynchronous version.
+.. seealso:: :ocv:func:`subtract`
-.. index:: gpu::multiply
gpu::multiply
-----------------
-.. ocv:function:: void gpu::multiply(const GpuMat& src1, const GpuMat& src2, GpuMat& dst)
+Computes a matrix-matrix or matrix-scalar per-element product.
-.. ocv:function:: void gpu::multiply(const GpuMat& src1, const Scalar& src2, GpuMat& dst)
+.. ocv:function:: void gpu::multiply(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, Stream& stream = Stream::Null())
- Computes a matrix-matrix or matrix-scalar per-element product.
+.. ocv:function:: void gpu::multiply(const GpuMat& src1, const Scalar& src2, GpuMat& dst, Stream& stream = Stream::Null())
- :param src1: First source matrix. ``CV_8UC1``, ``CV_8UC4``, ``CV_32SC1``, and ``CV_32FC1`` matrices are supported for now.
+ :param src1: First source matrix. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_32SC1`` , and ``CV_32FC1`` matrices are supported for now. Version with scalar supports only ``CV_32FC1`` matrices.
:param src2: Second source matrix or a scalar to be multiplied by ``src1`` elements.
- :param dst: Destination matrix with the same size and type as ``src1``.
+ :param dst: Destination matrix with the same size and type as ``src1`` .
+
+ :param stream: Stream for the asynchronous version.
-.. seealso::
- :ocv:func:`multiply`
+.. seealso:: :ocv:func:`multiply`
-.. index:: gpu::divide
gpu::divide
---------------
-.. ocv:function:: void gpu::divide(const GpuMat& src1, const GpuMat& src2, GpuMat& dst)
+Computes a matrix-matrix or matrix-scalar sum.
-.. ocv:function:: void gpu::divide(const GpuMat& src1, const Scalar& src2, GpuMat& dst)
+.. ocv:function:: void gpu::divide(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, Stream& stream = Stream::Null())
- Computes a matrix-matrix or matrix-scalar sum.
+.. ocv:function:: void gpu::divide(const GpuMat& src1, const Scalar& src2, GpuMat& dst, Stream& stream = Stream::Null())
- :param src1: First source matrix. ``CV_8UC1``, ``CV_8UC4``, ``CV_32SC1``, and ``CV_32FC1`` matrices are supported for now.
+ :param src1: First source matrix. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_32SC1`` , and ``CV_32FC1`` matrices are supported for now. Version with scalar supports only ``CV_32FC1`` matrices.
:param src2: Second source matrix or a scalar. The ``src1`` elements are divided by it.
- :param dst: Destination matrix with the same size and type as ``src1``.
+ :param dst: Destination matrix with the same size and type as ``src1`` .
-This function, in contrast to :ocv:func:`divide`, uses a round-down rounding mode.
+ :param stream: Stream for the asynchronous version.
-.. seealso::
- :ocv:func:`divide`
+This function, in contrast to :ocv:func:`divide`, uses a round-down rounding mode.
+.. seealso:: :ocv:func:`divide`
-.. index:: gpu::exp
gpu::exp
------------
-.. ocv:function:: void gpu::exp(const GpuMat& src, GpuMat& dst)
+Computes an exponent of each matrix element.
- Computes an exponent of each matrix element.
+.. ocv:function:: void gpu::exp(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null())
:param src: Source matrix. ``CV_32FC1`` matrixes are supported for now.
- :param dst: Destination matrix with the same size and type as ``src``.
+ :param dst: Destination matrix with the same size and type as ``src`` .
+
+ :param stream: Stream for the asynchronous version.
+
+.. seealso:: :ocv:func:`exp`
+
+
+
+gpu::pow
+------------
+Raises every matrix element to a power.
+
+.. ocv:function:: void gpu::pow(const GpuMat& src, double power, GpuMat& dst, Stream& stream = Stream::Null())
+
+ :param src: Source matrix. Supports all type, except ``CV_64F`` depth.
+
+ :param power: Exponent of power.
+
+ :param dst: Destination matrix with the same size and type as ``src`` .
+
+ :param stream: Stream for the asynchronous version.
+
+The function ``pow`` raises every element of the input matrix to ``p`` :
-.. seealso::
- :ocv:func:`exp`
+.. math::
+ \texttt{dst} (I) = \fork{\texttt{src}(I)^p}{if \texttt{p} is integer}{|\texttt{src}(I)|^p}{otherwise}
+
+.. seealso:: :ocv:func:`pow`
-.. index:: gpu::log
gpu::log
------------
-.. ocv:function:: void gpu::log(const GpuMat& src, GpuMat& dst)
+Computes a natural logarithm of absolute value of each matrix element.
- Computes a natural logarithm of absolute value of each matrix element.
+.. ocv:function:: void gpu::log(const GpuMat& src, GpuMat& dst, Stream& stream = Stream::Null())
:param src: Source matrix. ``CV_32FC1`` matrixes are supported for now.
- :param dst: Destination matrix with the same size and type as ``src``.
+ :param dst: Destination matrix with the same size and type as ``src`` .
-.. seealso:: :ocv:func:`log`
+ :param stream: Stream for the asynchronous version.
+.. seealso:: :ocv:func:`log`
-.. index:: gpu::absdiff
gpu::absdiff
----------------
-.. ocv:function:: void gpu::absdiff(const GpuMat& src1, const GpuMat& src2, GpuMat& dst)
+Computes per-element absolute difference of two matrices (or of a matrix and scalar).
+
+.. ocv:function:: void gpu::absdiff(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, Stream& stream = Stream::Null())
+
+.. ocv:function:: void gpu::absdiff(const GpuMat& src1, const Scalar& src2, GpuMat& dst, Stream& stream = Stream::Null())
-.. ocv:function:: void gpu::absdiff(const GpuMat& src1, const Scalar& src2, GpuMat& dst)
+ :param src1: First source matrix. ``CV_8UC1`` , ``CV_8UC4`` , ``CV_32SC1`` and ``CV_32FC1`` matrices are supported for now. Version with scalar supports only ``CV_32FC1`` matrices.
- Computes per-element absolute difference of two matrices (or of a matrix and scalar).
+ :param src2: Second source matrix or a scalar to be added to ``src1`` .
- :param src1: First source matrix. ``CV_8UC1``, ``CV_8UC4``, ``CV_32SC1`` and ``CV_32FC1`` matrices are supported for now.
+ :param dst: Destination matrix with the same size and type as ``src1`` .
- :param src2: Second source matrix or a scalar to be added to ``src1``.
+ :param stream: Stream for the asynchronous version.
- :param dst: Destination matrix with the same size and type as ``src1``.
+.. seealso:: :ocv:func:`absdiff`
-.. seealso::
- :ocv:func:`absdiff`
-.. index:: gpu::compare
gpu::compare
----------------
-.. ocv:function:: void gpu::compare(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, int cmpop)
+Compares elements of two matrices.
- Compares elements of two matrices.
+.. ocv:function:: void gpu::compare(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, int cmpop, Stream& stream = Stream::Null())
:param src1: First source matrix. ``CV_8UC4`` and ``CV_32FC1`` matrices are supported for now.
- :param src2: Second source matrix with the same size and type as ``a``.
+ :param src2: Second source matrix with the same size and type as ``a`` .
:param dst: Destination matrix with the same size as ``a`` and the ``CV_8UC1`` type.
:param cmpop: Flag specifying the relation between the elements to be checked:
-
+
* **CMP_EQ:** ``src1(.) == src2(.)``
* **CMP_GT:** ``src1(.) < src2(.)``
* **CMP_GE:** ``src1(.) <= src2(.)``
* **CMP_LE:** ``src1(.) <= src2(.)``
* **CMP_NE:** ``src1(.) != src2(.)``
-.. seealso::
- :ocv:func:`compare`
+ :param stream: Stream for the asynchronous version.
+
+.. seealso:: :ocv:func:`compare`
-.. index:: gpu::bitwise_not
gpu::bitwise_not
--------------------
-.. ocv:function:: void gpu::bitwise_not(const GpuMat& src, GpuMat& dst, const GpuMat& mask=GpuMat())
-
-.. ocv:function:: void gpu::bitwise_not(const GpuMat& src, GpuMat& dst, const GpuMat& mask, const Stream& stream)
+Performs a per-element bitwise inversion.
- Performs a per-element bitwise inversion.
+.. ocv:function:: void gpu::bitwise_not(const GpuMat& src, GpuMat& dst, const GpuMat& mask=GpuMat(), Stream& stream = Stream::Null())
:param src: Source matrix.
- :param dst: Destination matrix with the same size and type as ``src``.
+ :param dst: Destination matrix with the same size and type as ``src`` .
:param mask: Optional operation mask. 8-bit single channel image.
-.. index:: gpu::bitwise_or
-
gpu::bitwise_or
-------------------
-.. ocv:function:: void gpu::bitwise_or(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat())
+Performs a per-element bitwise disjunction of two matrices.
-.. ocv:function:: void gpu::bitwise_or(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask, const Stream& stream)
-
- Performs a per-element bitwise disjunction of two matrices.
+.. ocv:function:: void gpu::bitwise_or(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat(), Stream& stream = Stream::Null())
:param src1: First source matrix.
- :param src2: Second source matrix with the same size and type as ``src1``.
+ :param src2: Second source matrix with the same size and type as ``src1`` .
- :param dst: Destination matrix with the same size and type as ``src1``.
+ :param dst: Destination matrix with the same size and type as ``src1`` .
:param mask: Optional operation mask. 8-bit single channel image.
-.. index:: gpu::bitwise_and
-
gpu::bitwise_and
--------------------
-.. ocv:function:: void gpu::bitwise_and(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat())
-
-.. ocv:function:: void gpu::bitwise_and(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask, const Stream& stream)
+Performs a per-element bitwise conjunction of two matrices.
- Performs a per-element bitwise conjunction of two matrices.
+.. ocv:function:: void gpu::bitwise_and(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat(), Stream& stream = Stream::Null())
:param src1: First source matrix.
- :param src2: Second source matrix with the same size and type as ``src1``.
+ :param src2: Second source matrix with the same size and type as ``src1`` .
- :param dst: Destination matrix with the same size and type as ``src1``.
+ :param dst: Destination matrix with the same size and type as ``src1`` .
:param mask: Optional operation mask. 8-bit single channel image.
-.. index:: gpu::bitwise_xor
-
gpu::bitwise_xor
--------------------
-.. ocv:function:: void gpu::bitwise_xor(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat())
-
-.. ocv:function:: void gpu::bitwise_xor(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask, const Stream& stream)
+Performs a per-element bitwise ``exclusive or`` operation of two matrices.
- Performs a per-element bitwise ``exclusive or`` operation of two matrices.
+.. ocv:function:: void gpu::bitwise_xor(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const GpuMat& mask=GpuMat(), Stream& stream = Stream::Null())
:param src1: First source matrix.
- :param src2: Second source matrix with the same size and type as ``src1``.
+ :param src2: Second source matrix with the same size and type as ``src1`` .
- :param dst: Destination matrix with the same size and type as ``src1``.
+ :param dst: Destination matrix with the same size and type as ``src1`` .
:param mask: Optional operation mask. 8-bit single channel image.
-.. index:: gpu::min
-
gpu::min
------------
-.. ocv:function:: void gpu::min(const GpuMat& src1, const GpuMat& src2, GpuMat& dst)
+Computes the per-element minimum of two matrices (or a matrix and a scalar).
-.. ocv:function:: void gpu::min(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const Stream& stream)
+.. ocv:function:: void gpu::min(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, Stream& stream = Stream::Null())
-.. ocv:function:: void gpu::min(const GpuMat& src1, double src2, GpuMat& dst)
-
-.. ocv:function:: void gpu::min(const GpuMat& src1, double src2, GpuMat& dst, const Stream& stream)
-
- Computes the per-element minimum of two matrices (or a matrix and a scalar).
+.. ocv:function:: void gpu::min(const GpuMat& src1, double src2, GpuMat& dst, Stream& stream = Stream::Null())
:param src1: First source matrix.
:param src2: Second source matrix or a scalar to compare ``src1`` elements with.
- :param dst: Destination matrix with the same size and type as ``src1``.
+ :param dst: Destination matrix with the same size and type as ``src1`` .
:param stream: Stream for the asynchronous version.
-.. seealso::
- :ocv:func:`min`
-
+.. seealso:: :ocv:func:`min`
-.. index:: gpu::max
gpu::max
------------
-.. ocv:function:: void gpu::max(const GpuMat& src1, const GpuMat& src2, GpuMat& dst)
-
-.. ocv:function:: void gpu::max(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, const Stream& stream)
-
-.. ocv:function:: void gpu::max(const GpuMat& src1, double src2, GpuMat& dst)
+Computes the per-element maximum of two matrices (or a matrix and a scalar).
-.. ocv:function:: void gpu::max(const GpuMat& src1, double src2, GpuMat& dst, const Stream& stream)
+.. ocv:function:: void gpu::max(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, Stream& stream = Stream::Null())
- Computes the per-element maximum of two matrices (or a matrix and a scalar).
+.. ocv:function:: void gpu::max(const GpuMat& src1, double src2, GpuMat& dst, Stream& stream = Stream::Null())
:param src1: First source matrix.
:param src2: Second source matrix or a scalar to compare ``src1`` elements with.
- :param dst: Destination matrix with the same size and type as ``src1``.
+ :param dst: Destination matrix with the same size and type as ``src1`` .
:param stream: Stream for the asynchronous version.
-.. seealso::
- :ocv:func:`max`
+.. seealso:: :ocv:func:`max`