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())
..ocv:function:: void gpu::cvtColor(InputArray src, OutputArray 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 dst:Destination image with the same size and depth as ``src`` .
:param dst:Destination image.
:param code:Color space conversion code. For details, see :ocv:func:`cvtColor` . Conversion to/from Luv and Bayer color spaces is not supported.
:param code:Color space conversion code. For details, see :ocv:func:`cvtColor` .
:param dcn:Number of channels in the destination image. If the parameter is 0, the number of the channels is derived automatically from ``src`` and the ``code`` .
@ -27,11 +27,45 @@ Converts an image from one color space to another.
gpu::demosaicing
----------------
Converts an image from Bayer pattern to RGB or grayscale.
..ocv:function:: void gpu::demosaicing(InputArray src, OutputArray dst, int code, int dcn = -1, Stream& stream = Stream::Null())
:param src:Source image (8-bit or 16-bit single channel).
:param dst:Destination image.
:param code:Color space conversion code (see the description below).
:param dcn:Number of channels in the destination image. If the parameter is 0, the number of the channels is derived automatically from ``src`` and the ``code`` .
:param stream:Stream for the asynchronous version.
The function can do the following transformations:
:param image:Input 8-bit or floating-point 32-bit, single-channel image.
:param corners:Output vector of detected corners (1-row matrix with CV_32FC2 type with corners positions).
:param mask:Optional region of interest. If the image is not empty (it needs to have the type ``CV_8UC1`` and the same size as ``image`` ), it specifies the region in which the corners are detected.
gpu::createGoodFeaturesToTrackDetector
--------------------------------------
Creates implementation for :ocv:class:`gpu::CornersDetector` .
:param srcType:Input source type. Only ``CV_8UC1`` and ``CV_32FC1`` are supported for now.
:param maxCorners:Maximum number of corners to return. If there are more corners than are found, the strongest of them is returned.
:param qualityLevel:Parameter characterizing the minimal accepted quality of image corners. The parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue (see :ocv:func:`cornerMinEigenVal` ) or the Harris function response (see :ocv:func:`cornerHarris` ). The corners with the quality measure less than the product are rejected. For example, if the best corner has the quality measure = 1500, and the ``qualityLevel=0.01`` , then all the corners with the quality measure less than 15 are rejected.
:param minDistance:Minimum possible Euclidean distance between the returned corners.
:param blockSize:Size of an average block for computing a derivative covariation matrix over each pixel neighborhood. See :ocv:func:`cornerEigenValsAndVecs` .
:param useHarrisDetector:Parameter indicating whether to use a Harris detector (see :ocv:func:`cornerHarris`) or :ocv:func:`cornerMinEigenVal`.
The class finds the most prominent corners in the image.
:param harrisK:Free parameter of the Harris detector.
:param tileGridSize:Size of grid for histogram equalization. Input image will be divided into equally sized rectangular tiles. ``tileGridSize`` defines the number of tiles in row and column.
gpu::evenLevels
-------------------
---------------
Computes levels with even distribution.
..ocv:function:: void gpu::evenLevels(GpuMat& levels, int nLevels, int lowerLevel, int upperLevel)
..ocv:function:: void gpu::evenLevels(OutputArray levels, int nLevels, int lowerLevel, int upperLevel)
:param levels:Destination array. ``levels`` has 1 row, ``nLevels`` columns, and the ``CV_32SC1`` type.
@ -22,16 +100,16 @@ Computes levels with even distribution.
gpu::histEven
-----------------
-------------
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(InputArray src, OutputArray 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())
..ocv:function:: void gpu::histEven(InputArray src, OutputArray hist, InputOutputArray buf, int histSize, int lowerLevel, int upperLevel, Stream& stream = Stream::Null())
..ocv:function:: void gpu::histEven( const GpuMat& src, GpuMat hist[4], int histSize[4], int lowerLevel[4], int upperLevel[4], Stream& stream=Stream::Null())
..ocv:function:: void gpu::histEven(InputArray src, GpuMat hist[4], int histSize[4], int lowerLevel[4], int upperLevel[4], Stream& stream=Stream::Null())
..ocv:function:: void gpu::histEven( const GpuMat& src, GpuMat hist[4], GpuMat& buf, int histSize[4], int lowerLevel[4], int upperLevel[4], Stream& stream=Stream::Null())
..ocv:function:: void gpu::histEven(InputArray src, GpuMat hist[4], InputOutputArray buf, int histSize[4], int lowerLevel[4], int upperLevel[4], Stream& stream=Stream::Null())
: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.
@ -50,12 +128,16 @@ Calculates a histogram with evenly distributed bins.
gpu::histRange
------------------
--------------
Calculates a histogram with bins determined by the ``levels`` array.
:param src:Source image. ``CV_8U`` , ``CV_16U`` , or ``CV_16S`` depth and 1 or 4 channels are supported. For a four-channel image, all channels are processed separately.
@ -66,39 +148,3 @@ Calculates a histogram with bins determined by the ``levels`` array.
:param buf:Optional buffer to avoid extra memory allocations (for many calls with the same sizes).
:param stream:Stream for the asynchronous version.
:param lines:Output vector of lines. Each line is represented by a two-element vector :math:`(\rho, \theta)` . :math:`\rho` is the distance from the coordinate origin :math:`(0,0)` (top-left corner of the image). :math:`\theta` is the line rotation angle in radians ( :math:`0 \sim \textrm{vertical line}, \pi/2 \sim \textrm{horizontal line}` ).
..seealso:::ocv:func:`HoughLines`
gpu::HoughLinesDetector::downloadResults
----------------------------------------
Downloads results from :ocv:func:`gpu::HoughLinesDetector::detect` to host memory.
:param lines:Output vector of lines. Each line is represented by a 4-element vector :math:`(x_1, y_1, x_2, y_2)` , where :math:`(x_1,y_1)` and :math:`(x_2, y_2)` are the ending points of each detected line segment.
..seealso:::ocv:func:`HoughLinesP`
gpu::createHoughSegmentDetector
-------------------------------
Creates implementation for :ocv:class:`gpu::HoughSegmentDetector` .
..ocv:function:: Ptr<HoughSegmentDetector> gpu::createHoughSegmentDetector(float rho, float theta, int minLineLength, int maxLineGap, int maxLines = 4096)
:param rho:Distance resolution of the accumulator in pixels.
:param theta:Angle resolution of the accumulator in radians.
:param minLineLength:Minimum line length. Line segments shorter than that are rejected.
:param maxLineGap:Maximum allowed gap between points on the same line to link them.
:param maxLines:Maximum number of output lines.
gpu::HoughCirclesDetector
-------------------------
..ocv:class:: gpu::HoughCirclesDetector : public Algorithm
Base class for circles detector algorithm. ::
class CV_EXPORTS HoughCirclesDetector : public Algorithm
..ocv:function:: void gpu::HoughCircles(const GpuMat& src, GpuMat& circles, int method, float dp, float minDist, int cannyThreshold, int votesThreshold, int minRadius, int maxRadius, int maxCircles = 4096)
virtual void setMinDist(float minDist) = 0;
virtual float getMinDist() const = 0;
..ocv:function:: void gpu::HoughCircles(const GpuMat& src, GpuMat& circles, HoughCirclesBuf& buf, int method, float dp, float minDist, int cannyThreshold, int votesThreshold, int minRadius, int maxRadius, int maxCircles = 4096)
:param circles:Output vector of found circles. Each vector is encoded as a 3-element floating-point vector :math:`(x, y, radius)` .
:param method:Detection method to use. Currently, the only implemented method is ``CV_HOUGH_GRADIENT`` , which is basically *21HT* , described in [Yuen90]_.
..seealso:::ocv:func:`HoughCircles`
gpu::createHoughCirclesDetector
-------------------------------
Creates implementation for :ocv:class:`gpu::HoughCirclesDetector` .
..ocv:function:: Ptr<HoughCirclesDetector> gpu::createHoughCirclesDetector(float dp, float minDist, int cannyThreshold, int votesThreshold, int minRadius, int maxRadius, int maxCircles = 4096)
:param dp:Inverse ratio of the accumulator resolution to the image resolution. For example, if ``dp=1`` , the accumulator has the same resolution as the input image. If ``dp=2`` , the accumulator has half as big width and height.
:param minDist:Minimum distance between the centers of the detected circles. If the parameter is too small, multiple neighbor circles may be falsely detected in addition to a true one. If it is too large, some circles may be missed.
:param cannyThreshold:The higher threshold of the two passed to the :ocv:func:`gpu::Canny` edge detector (the lower one is twice smaller).
:param cannyThreshold:The higher threshold of the two passed to Canny edge detector (the lower one is twice smaller).
:param votesThreshold:The accumulator threshold for the circle centers at the detection stage. The smaller it is, the more false circles may be detected.
@ -77,20 +211,102 @@ Finds circles in a grayscale image using the Hough transform.
:param maxCircles:Maximum number of output circles.
:param buf:Optional buffer to avoid extra memory allocations (for many calls with the same sizes).
..seealso:::ocv:func:`HoughCircles`
gpu::GeneralizedHough
---------------------
..ocv:class:: gpu::GeneralizedHough : public Algorithm
Base class for generalized hough transform. ::
gpu::HoughCirclesDownload
-------------------------
Downloads results from :ocv:func:`gpu::HoughCircles` to host memory.
class CV_EXPORTS GeneralizedHough : public Algorithm
{
public:
static Ptr<GeneralizedHough> create(int method);
virtual void setTemplate(InputArray templ, int cannyThreshold = 100, Point templCenter = Point(-1, -1)) = 0;
:param h_votes:Optional output array for votes. Each vector is encoded as a 3-element integer-point vector :math:`(position_votes, scale_votes, angle_votes)` .
:param d_circles:Result of :ocv:func:`gpu::HoughCircles` .
:param h_circles:Output host array.
..seealso:::ocv:func:`gpu::HoughCircles`
..[Ballard1981] Ballard, D.H. (1981). Generalizing the Hough transform to detect arbitrary shapes. Pattern Recognition 13 (2): 111-122.
..[Guil1999] Guil, N., González-Linares, J.M. and Zapata, E.L. (1999). Bidimensional shape detection using an invariant approach. Pattern Recognition 32 (6): 1025-1038.
:param low_thresh:First threshold for the hysteresis procedure.
:param high_thresh:Second threshold for the hysteresis procedure.
:param apperture_size: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`` ).
gpu::meanShiftFiltering
---------------------------
-----------------------
Performs mean-shift filtering for each point of the source image.
You can use field `user_block_size` to set specific block size for :ocv:func:`gpu::matchTemplate` function. If you leave its default value `Size(0,0)` then automatic estimation of block size will be used (which is optimized for speed). By varying `user_block_size` you can reduce memory requirements at the cost of speed.
gpu::matchTemplate
----------------------
gpu::TemplateMatching::match
----------------------------
Computes a proximity map for a raster template and an image where the template is searched for.
:param image:Source image. ``CV_32F`` and ``CV_8U`` depth images (1..4 channels) are supported for now.
:param image:Source image.
:param templ:Template image with the size and type the same as ``image`` .
:param result:Map containing comparison results ( ``CV_32FC1`` ). If ``image`` is *W x H* and ``templ`` is *w x h*, then ``result`` must be *W-w+1 x H-h+1*.
:param method:Specifies the way to compare the template with the image.
:param stream:Stream for the asynchronous version.
:param buf:Optional buffer to avoid extra memory allocations and to adjust some specific parameters. See :ocv:struct:`gpu::MatchTemplateBuf`.
:param stream:Stream for the asynchronous version.
The following methods are supported for the ``CV_8U`` depth images for now:
gpu::createTemplateMatching
---------------------------
Creates implementation for :ocv:class:`gpu::TemplateMatching` .
..ocv:function:: Ptr<TemplateMatching> gpu::createTemplateMatching(int srcType, int method, Size user_block_size = Size())
:param srcType:Input source type. ``CV_32F`` and ``CV_8U`` depth images (1..4 channels) are supported for now.
:param method:Specifies the way to compare the template with the image.
:param user_block_size:You can use field `user_block_size` to set specific block size. If you leave its default value `Size(0,0)` then automatic estimation of block size will be used (which is optimized for speed). By varying `user_block_size` you can reduce memory requirements at the cost of speed.
The following methods are supported for the ``CV_8U`` depth images for now:
* ``CV_TM_SQDIFF``
* ``CV_TM_SQDIFF_NORMED``
@ -115,7 +179,7 @@ Computes a proximity map for a raster template and an image where the template i
* ``CV_TM_CCOEFF``
* ``CV_TM_CCOEFF_NORMED``
The following methods are supported for the ``CV_32F`` images for now:
The following methods are supported for the ``CV_32F`` images for now:
* ``CV_TM_SQDIFF``
* ``CV_TM_CCORR``
@ -124,45 +188,11 @@ Computes a proximity map for a raster template and an image where the template i
gpu::Canny
-------------------
Finds edges in an image using the [Canny86]_ algorithm.
: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 low_thresh:First threshold for the hysteresis procedure.
:param high_thresh:Second threshold for the hysteresis procedure.
:param apperture_size: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`
gpu::bilateralFilter
--------------------
Performs bilateral filtering of passed image
..ocv:function:: void gpu::bilateralFilter( const GpuMat& src, GpuMat& dst, int kernel_size, float sigma_color, float sigma_spatial, int borderMode=BORDER_DEFAULT, Stream& stream=Stream::Null())
..ocv:function:: void gpu::bilateralFilter(InputArray src, OutputArray dst, int kernel_size, float sigma_color, float sigma_spatial, int borderMode=BORDER_DEFAULT, Stream& stream=Stream::Null())