2011-02-22 21:43:26 +01:00
Image Processing
================
.. highlight :: cpp
.. index :: gpu::meanShiftFiltering
cv::gpu::meanShiftFiltering
---------------------------
.. cfunction :: void meanShiftFiltering(const GpuMat\& src, GpuMat\& dst,
int sp, int sr,
TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER
+ TermCriteria::EPS, 5, 1))
2011-02-26 12:05:10 +01:00
Performs mean-shift filtering for each point of the source image. It maps each point of the source image into another point, and as the result we have new color and new position of each point.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param src: Source image. Only ``CV_8UC4`` images are supported for now.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param dst: Destination image, containing color of mapped points. Will have the same size and type as ``src`` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param sp: Spatial window radius.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param sr: Color window radius.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param criteria: Termination criteria. See .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
.. index :: gpu::meanShiftProc
2011-02-22 21:43:26 +01:00
cv::gpu::meanShiftProc
----------------------
2011-02-26 12:05:10 +01:00
.. cfunction :: void meanShiftProc(const GpuMat\& src, GpuMat\& dstr, GpuMat\& dstsp,
int sp, int sr,
TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER
+ TermCriteria::EPS, 5, 1))
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
Performs mean-shift procedure and stores information about processed points (i.e. their colors and positions) into two images.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param src: Source image. Only ``CV_8UC4`` images are supported for now.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param dstr: Destination image, containing color of mapped points. Will have the same size and type as ``src`` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param dstsp: Destination image, containing position of mapped points. Will have the same size as ``src`` and ``CV_16SC2`` type.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param sp: Spatial window radius.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param sr: Color window radius.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param criteria: Termination criteria. See .
See also:
:func: `gpu::meanShiftFiltering` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
.. index :: gpu::meanShiftSegmentation
2011-02-22 21:43:26 +01:00
cv::gpu::meanShiftSegmentation
------------------------------
2011-02-26 12:05:10 +01:00
.. cfunction :: void meanShiftSegmentation(const GpuMat\& src, Mat\& dst,
int sp, int sr, int minsize,
TermCriteria criteria = TermCriteria(TermCriteria::MAX_ITER
+ TermCriteria::EPS, 5, 1))
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
Performs mean-shift segmentation of the source image and eleminates small segments.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param src: Source image. Only ``CV_8UC4`` images are supported for now.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param dst: Segmented image. Will have the same size and type as ``src`` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param sp: Spatial window radius.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param sr: Color window radius.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param minsize: Minimum segment size. Smaller segements will be merged.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param criteria: Termination criteria. See .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
.. index :: gpu::integral
2011-02-22 21:43:26 +01:00
cv::gpu::integral
-----------------
.. cfunction :: void integral(const GpuMat\& src, GpuMat\& sum)
.. cfunction :: void integral(const GpuMat\& src, GpuMat\& sum, GpuMat\& sqsum)
2011-02-26 12:05:10 +01:00
Computes integral image and squared integral image.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param src: Source image. Only ``CV_8UC1`` images are supported for now.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param sum: Integral image. Will contain 32-bit unsigned integer values packed into ``CV_32SC1`` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param sqsum: Squared integral image. Will have ``CV_32FC1`` type.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
See also:
:func: `integral` .
2011-02-22 21:43:26 +01:00
.. index :: gpu::sqrIntegral
cv::gpu::sqrIntegral
--------------------
.. cfunction :: void sqrIntegral(const GpuMat\& src, GpuMat\& sqsum)
2011-02-26 12:05:10 +01:00
Computes squared integral image.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param src: Source image. Only ``CV_8UC1`` images are supported for now.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param sqsum: Squared integral image. Will contain 64-bit unsigned integer values packed into ``CV_64FC1`` .
2011-02-22 21:43:26 +01:00
.. index :: gpu::columnSum
cv::gpu::columnSum
------------------
.. cfunction :: void columnSum(const GpuMat\& src, GpuMat\& sum)
2011-02-26 12:05:10 +01:00
Computes vertical (column) sum.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param src: Source image. Only ``CV_32FC1`` images are supported for now.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param sum: Destination image. Will have ``CV_32FC1`` type.
2011-02-22 21:43:26 +01:00
.. index :: gpu::cornerHarris
cv::gpu::cornerHarris
---------------------
2011-02-26 12:05:10 +01:00
.. cfunction :: void cornerHarris(const GpuMat\& src, GpuMat\& dst,
int blockSize, int ksize, double k,
int borderType=BORDER_REFLECT101)
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
Computes Harris cornerness criteria at each image pixel.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param src: Source image. Only ``CV_8UC1`` and ``CV_32FC1`` images are supported for now.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param dst: Destination image. Will have the same size and ``CV_32FC1`` type and contain cornerness values.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param blockSize: Neighborhood size.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param ksize: Aperture parameter for the Sobel operator.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param k: Harris detector free parameter.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param borderType: Pixel extrapolation method. Only ``BORDER_REFLECT101`` and ``BORDER_REPLICATE`` are supported for now.
See also:
:func: `cornerHarris` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
.. index :: gpu::cornerMinEigenVal
2011-02-22 21:43:26 +01:00
cv::gpu::cornerMinEigenVal
--------------------------
2011-02-26 12:05:10 +01:00
.. cfunction :: void cornerMinEigenVal(const GpuMat\& src, GpuMat\& dst,
int blockSize, int ksize,
int borderType=BORDER_REFLECT101)
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
Computes minimum eigen value of 2x2 derivative covariation matrix at each pixel - the cornerness criteria.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param src: Source image. Only ``CV_8UC1`` and ``CV_32FC1`` images are supported for now.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param dst: Destination image. Will have the same size and ``CV_32FC1`` type and contain cornerness values.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param blockSize: Neighborhood size.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param ksize: Aperture parameter for the Sobel operator.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param k: Harris detector free parameter.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param borderType: Pixel extrapolation method. Only ``BORDER_REFLECT101`` and ``BORDER_REPLICATE`` are supported for now.
See also:
:func: `cornerMinEigenValue` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
.. index :: gpu::mulSpectrums
2011-02-22 21:43:26 +01:00
cv::gpu::mulSpectrums
---------------------
2011-02-26 12:05:10 +01:00
.. cfunction :: void mulSpectrums(const GpuMat\& a, const GpuMat\& b,
GpuMat\& c, int flags, bool conjB=false)
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
Performs per-element multiplication of two Fourier spectrums.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param a: First spectrum.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param b: Second spectrum. Must have the same size and type as ``a`` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param c: Destination spectrum.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param flags: Mock paramter is kept for CPU/GPU interfaces similarity.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param conjB: Optional flag which indicates the second spectrum must be conjugated before the multiplication.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
Only full (i.e. not packed) `` CV_32FC2 `` complex spectrums in the interleaved format are supported for now.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
See also:
:func: `mulSpectrums` .
.. index :: gpu::mulAndScaleSpectrums
2011-02-22 21:43:26 +01:00
cv::gpu::mulAndScaleSpectrums
-----------------------------
2011-02-26 12:05:10 +01:00
.. cfunction :: void mulAndScaleSpectrums(const GpuMat\& a, const GpuMat\& b,
GpuMat\& c, int flags, float scale, bool conjB=false)
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
Performs per-element multiplication of two Fourier spectrums and scales the result.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param a: First spectrum.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param b: Second spectrum. Must have the same size and type as ``a`` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param c: Destination spectrum.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param flags: Mock paramter is kept for CPU/GPU interfaces similarity.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param scale: Scale constant.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param conjB: Optional flag which indicates the second spectrum must be conjugated before the multiplication.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
Only full (i.e. not packed) `` CV_32FC2 `` complex spectrums in the interleaved format are supported for now.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
See also:
:func: `mulSpectrums` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
.. index :: gpu::dft
cv::gpu::dft
------------ `` _ `` `` _ ``
.. cfunction :: void dft(const GpuMat\& src, GpuMat\& dst, Size dft_size, int flags=0)
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
Performs a forward or inverse discrete Fourier transform (1D or 2D) of floating point matrix. Can handle real matrices (CV32FC1) and complex matrices in the interleaved format (CV32FC2).
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param src: Source matrix (real or complex).
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param dst: Destination matrix (real or complex).
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param dft_size: Size of discrete Fourier transform.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param flags: Optional flags:
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
* **DFT_ROWS** Transform each individual row of the source matrix.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
* **DFT_SCALE** Scale the result: divide it by the number of elements in the transform (it's obtained from `` dft_size `` ).
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
* **DFT_INVERSE** Inverse DFT must be perfromed for complex-complex case (real-complex and complex-real cases are respectively forward and inverse always).
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
* **DFT_REAL_OUTPUT** The source matrix is the result of real-complex transform, so the destination matrix must be real.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
The source matrix should be continuous, otherwise reallocation and data copying will be performed. Function chooses the operation mode depending on the flags, size and channel count of the source matrix:
2011-02-22 21:43:26 +01:00
*
2011-02-26 12:05:10 +01:00
If the source matrix is complex and the output isn't specified as real then the destination matrix will be complex, will have `` dft_size `` size and `` CV_32FC2 `` type. It will contain full result of the DFT (forward or inverse).
2011-02-22 21:43:26 +01:00
*
2011-02-26 12:05:10 +01:00
If the source matrix is complex and the output is specified as real then function assumes that its input is the result of the forward transform (see next item). The destionation matrix will have `` dft_size `` size and `` CV_32FC1 `` type. It will contain result of the inverse DFT.
2011-02-22 21:43:26 +01:00
*
2011-02-26 12:05:10 +01:00
If the source matrix is real (i.e. its type is `` CV_32FC1 `` ) then forward DFT will be performed. The result of the DFT will be packed into complex ( `` CV_32FC2 `` ) matrix so its width will be `` dft_size.width / 2 + 1 `` , but if the source is a single column then height will be reduced instead of width.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
See also:
:func: `dft` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
.. index :: gpu::convolve
2011-02-22 21:43:26 +01:00
cv::gpu::convolve
-----------------
.. cfunction :: void convolve(const GpuMat\& image, const GpuMat\& templ, GpuMat\& result,
bool ccorr=false)
.. cfunction :: void convolve(const GpuMat\& image, const GpuMat\& templ, GpuMat\& result,
bool ccorr, ConvolveBuf\& buf)
2011-02-26 12:05:10 +01:00
Computes convolution (or cross-correlation) of two images.
:param image: Source image. Only ``CV_32FC1`` images are supported for now.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param templ: Template image. Must have size not greater then ``image`` size and be the same type as ``image`` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param result: Result image. Will have the same size and type as ``image`` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param ccorr: Flags which indicates cross-correlation must be evaluated instead of convolution.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param buf: Optional buffer to avoid extra memory allocations (for many calls with the same sizes).
2011-02-22 21:43:26 +01:00
.. index :: gpu::ConvolveBuf
.. _gpu :: ConvolveBuf:
gpu::ConvolveBuf
----------------
.. ctype :: gpu::ConvolveBuf
2011-02-26 12:05:10 +01:00
Memory buffer for the
:func: `gpu::convolve` function. ::
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
struct CV_EXPORTS ConvolveBuf
{
ConvolveBuf() {}
ConvolveBuf(Size image_size, Size templ_size)
{ create(image_size, templ_size); }
void create(Size image_size, Size templ_size);
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
private:
// Hidden
};
2011-02-22 21:43:26 +01:00
..
.. index :: gpu::ConvolveBuf::ConvolveBuf
cv::gpu::ConvolveBuf::ConvolveBuf
---------------------------------
.. cfunction :: ConvolveBuf::ConvolveBuf()
2011-02-26 12:05:10 +01:00
Constructs an empty buffer which will be properly resized after first call of the convolve function.
2011-02-22 21:43:26 +01:00
.. cfunction :: ConvolveBuf::ConvolveBuf(Size image_size, Size templ_size)
2011-02-26 12:05:10 +01:00
Constructs a buffer for the convolve function with respectively arguments.
2011-02-22 21:43:26 +01:00
.. index :: gpu::matchTemplate
cv::gpu::matchTemplate
----------------------
.. cfunction :: void matchTemplate(const GpuMat\& image, const GpuMat\& templ,
GpuMat\& result, int method)
2011-02-26 12:05:10 +01:00
Computes a proximity map for a raster template and an image where the template is searched for.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param image: Source image. ``CV_32F`` and ``CV_8U`` depth images (1..4 channels) are supported for now.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param templ: Template image. Must have the same size and type as ``image`` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param result: Map containing comparison results ( ``CV_32FC1`` ). If ``image`` is :math:`W \times H` and
`` templ `` is :math: `w \times h` then `` result `` must be :math: `(W-w+1) \times (H-h+1)` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param method: Specifies the way which the template must be compared with the image.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
Following methods are supported for the `` CV_8U `` depth images for now:
2011-02-22 21:43:26 +01:00
*
2011-02-26 12:05:10 +01:00
CV_ TM_ SQDIFF
2011-02-22 21:43:26 +01:00
*
2011-02-26 12:05:10 +01:00
CV_ TM_ SQDIFF_ NORMED
2011-02-22 21:43:26 +01:00
*
2011-02-26 12:05:10 +01:00
CV_ TM_ CCORR
2011-02-22 21:43:26 +01:00
*
2011-02-26 12:05:10 +01:00
CV_ TM_ CCORR_ NORMED
2011-02-22 21:43:26 +01:00
*
2011-02-26 12:05:10 +01:00
CV_ TM_ CCOEFF
2011-02-22 21:43:26 +01:00
*
2011-02-26 12:05:10 +01:00
CV_ TM_ CCOEFF_ NORMED
Following methods are supported for the `` CV_32F `` images for now:
2011-02-22 21:43:26 +01:00
*
2011-02-26 12:05:10 +01:00
CV_ TM_ SQDIFF
2011-02-22 21:43:26 +01:00
*
2011-02-26 12:05:10 +01:00
CV_ TM_ CCORR
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
See also:
:func: `matchTemplate` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
.. index :: gpu::remap
2011-02-22 21:43:26 +01:00
cv::gpu::remap
--------------
.. cfunction :: void remap(const GpuMat\& src, GpuMat\& dst, const GpuMat\& xmap, const GpuMat\& ymap)
2011-02-26 12:05:10 +01:00
Applies a generic geometrical transformation to an image.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param src: Source image. Only ``CV_8UC1`` and ``CV_8UC3`` source types are supported.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param dst: Destination image. It will have the same size as ``xmap`` and the same type as ``src`` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param xmap: X values. Only ``CV_32FC1`` type is supported.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param ymap: Y values. Only ``CV_32FC1`` type is supported.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
The function transforms the source image using the specified map:
2011-02-22 21:43:26 +01:00
.. math ::
2011-02-26 12:05:10 +01:00
\texttt{dst} (x,y) = \texttt{src} (xmap(x,y), ymap(x,y))
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
Values of pixels with non-integer coordinates are computed using bilinear interpolation.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
See also:
:func: `remap` .
2011-02-22 21:43:26 +01:00
.. index :: gpu::cvtColor
cv::gpu::cvtColor
-----------------
2011-02-26 12:05:10 +01:00
.. cfunction :: void cvtColor(const GpuMat\& src, GpuMat\& dst, int code, int dcn = 0)
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
.. cfunction :: void cvtColor(const GpuMat\& src, GpuMat\& dst, int code, int dcn, const Stream\& stream)
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
Converts image from one color space to another.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param src: Source image with ``CV_8U`` , ``CV_16U`` or ``CV_32F`` depth and 1, 3 or 4 channels.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param dst: Destination image; will have the same size and the same depth as ``src`` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param code: Color space conversion code. For details see :func:`cvtColor` . Conversion to/from Luv and Bayer color spaces doesn't supported.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param dcn: Number of channels in the destination image; if the parameter is 0, the number of the channels will be derived automatically from ``src`` and the ``code`` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param stream: Stream for the asynchronous version.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
3-channel color spaces (like `` HSV `` ,`` XYZ `` , etc) can be stored to 4-channel image for better perfomance.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
See also:
:func: `cvtColor` .
2011-02-22 21:43:26 +01:00
.. index :: gpu::threshold
cv::gpu::threshold
------------------
2011-02-26 12:05:10 +01:00
.. cfunction :: double threshold(const GpuMat\& src, GpuMat\& dst, double thresh, double maxval, int type)
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
.. cfunction :: double threshold(const GpuMat\& src, GpuMat\& dst, double thresh, double maxval, int type, const Stream\& stream)
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
Applies a fixed-level threshold to each array element.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param src: Source array (single-channel, ``CV_64F`` depth isn't supported).
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param dst: Destination array; will have the same size and the same type as ``src`` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param thresh: Threshold value.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param maxVal: Maximum value to use with ``THRESH_BINARY`` and ``THRESH_BINARY_INV`` thresholding types.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param thresholdType: Thresholding type. For details see :func:`threshold` . ``THRESH_OTSU`` thresholding type doesn't supported.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param stream: Stream for the asynchronous version.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
See also:
:func: `threshold` .
2011-02-22 21:43:26 +01:00
.. index :: gpu::resize
cv::gpu::resize
---------------
2011-02-26 12:05:10 +01:00
.. cfunction :: void resize(const GpuMat\& src, GpuMat\& dst, Size dsize, double fx=0, double fy=0, int interpolation = INTER_LINEAR)
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
Resizes an image.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param src: Source image. Supports ``CV_8UC1`` and ``CV_8UC4`` types.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param dst: Destination image. It will have size ``dsize`` (when it is non-zero) or the size computed from ``src.size()`` and ``fx`` and ``fy`` . The type of ``dst`` will be the same as of ``src`` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param dsize: Destination image size. If it is zero, then it is computed as:
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
.. math ::
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
\texttt{dsize = Size(round(fx*src.cols), round(fy* src.rows))}
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
Either `` dsize `` or both `` fx `` or `` fy `` must be non-zero.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param fx: Scale factor along the horizontal axis. When 0, it is computed as
2011-02-22 21:43:26 +01:00
.. math ::
2011-02-26 12:05:10 +01:00
\texttt{(double)dsize.width/src.cols}
:param fy: Scale factor along the vertical axis. When 0, it is computed as
2011-02-22 21:43:26 +01:00
.. math ::
2011-02-26 12:05:10 +01:00
\texttt{(double)dsize.height/src.rows}
:param interpolation: Interpolation method. Supports only ``INTER_NEAREST`` and ``INTER_LINEAR`` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
See also:
:func: `resize` .
.. index :: gpu::warpAffine
2011-02-22 21:43:26 +01:00
cv::gpu::warpAffine
-------------------
2011-02-26 12:05:10 +01:00
.. cfunction :: void warpAffine(const GpuMat\& src, GpuMat\& dst, const Mat\& M, Size dsize, int flags = INTER_LINEAR)
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
Applies an affine transformation to an image.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param src: Source image. Supports ``CV_8U`` , ``CV_16U`` , ``CV_32S`` or ``CV_32F`` depth and 1, 3 or 4 channels.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param dst: Destination image; will have size ``dsize`` and the same type as ``src`` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param M: :math:`2\times 3` transformation matrix.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param dsize: Size of the destination image.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param flags: Combination of interpolation methods, see :func:`resize` , and the optional flag ``WARP_INVERSE_MAP`` that means that ``M`` is the inverse transformation ( :math:`\texttt{dst}\rightarrow\texttt{src}` ). Supports only ``INTER_NEAREST`` , ``INTER_LINEAR`` and ``INTER_CUBIC`` interpolation methods.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
See also:
:func: `warpAffine` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
.. index :: gpu::warpPerspective
2011-02-22 21:43:26 +01:00
cv::gpu::warpPerspective
------------------------
2011-02-26 12:05:10 +01:00
.. cfunction :: void warpPerspective(const GpuMat\& src, GpuMat\& dst, const Mat\& M, Size dsize, int flags = INTER_LINEAR)
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
Applies a perspective transformation to an image.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param src: Source image. Supports ``CV_8U`` , ``CV_16U`` , ``CV_32S`` or ``CV_32F`` depth and 1, 3 or 4 channels.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param dst: Destination image; will have size ``dsize`` and the same type as ``src`` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param M: :math:`2
3` transformation matrix.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param dsize: Size of the destination image.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param flags: Combination of interpolation methods, see :func:`resize` , and the optional flag ``WARP_INVERSE_MAP`` that means that ``M`` is the inverse transformation ( :math:`\texttt{dst}\rightarrow\texttt{src}` ). Supports only ``INTER_NEAREST`` , ``INTER_LINEAR`` and ``INTER_CUBIC`` interpolation methods.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
See also:
:func: `warpPerspective` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
.. index :: gpu::rotate
2011-02-22 21:43:26 +01:00
cv::gpu::rotate
---------------
2011-02-26 12:05:10 +01:00
.. cfunction :: void rotate(const GpuMat\& src, GpuMat\& dst, Size dsize, double angle, double xShift = 0, double yShift = 0, int interpolation = INTER_LINEAR)
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
Rotates an image around the origin (0,0) and then shifts it.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param src: Source image. Supports ``CV_8UC1`` and ``CV_8UC4`` types.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param dst: Destination image; will have size ``dsize`` and the same type as ``src`` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param dsize: Size of the destination image.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param angle: Angle of rotation in degrees.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param xShift: Shift along horizontal axis.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param yShift: Shift along vertical axis.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param interpolation: Interpolation method. Supports only ``INTER_NEAREST`` , ``INTER_LINEAR`` and ``INTER_CUBIC`` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
See also:
:func: `gpu::warpAffine` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
.. index :: gpu::copyMakeBorder
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
cv::gpu::copyMakeBorder
-----------------------
2011-02-22 21:43:26 +01:00
.. cfunction :: void copyMakeBorder(const GpuMat\& src, GpuMat\& dst, int top, int bottom, int left, int right, const Scalar\& value = Scalar())
2011-02-26 12:05:10 +01:00
Copies 2D array to a larger destination array and pads borders with the given constant.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param src: Source image. Supports ``CV_8UC1`` , ``CV_8UC4`` , ``CV_32SC1`` and ``CV_32FC1`` types.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param dst: The destination image; will have the same type as ``src`` and the size ``Size(src.cols+left+right, src.rows+top+bottom)`` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param top, bottom, left, right: Specify how much pixels in each direction from the source image rectangle one needs to extrapolate, e.g. ``top=1, bottom=1, left=1, right=1`` mean that 1 pixel-wide border needs to be built.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param value: Border value.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
See also:
:func: `copyMakeBorder`
2011-02-22 21:43:26 +01:00
.. index :: gpu::rectStdDev
cv::gpu::rectStdDev
-------------------
.. cfunction :: void rectStdDev(const GpuMat\& src, const GpuMat\& sqr, GpuMat\& dst, const Rect\& rect)
2011-02-26 12:05:10 +01:00
Computes standard deviation of integral images.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param src: Source image. Supports only ``CV_32SC1`` type.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param sqr: Squared source image. Supports only ``CV_32FC1`` type.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param dst: Destination image; will have the same type and the same size as ``src`` .
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param rect: Rectangular window.
2011-02-22 21:43:26 +01:00
.. index :: gpu::evenLevels
cv::gpu::evenLevels
-------------------
.. cfunction :: void evenLevels(GpuMat\& levels, int nLevels, int lowerLevel, int upperLevel)
2011-02-26 12:05:10 +01:00
Computes levels with even distribution.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param levels: Destination array. ``levels`` will have 1 row and ``nLevels`` cols and ``CV_32SC1`` type.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param nLevels: Number of levels being computed. ``nLevels`` must be at least 2.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param lowerLevel: Lower boundary value of the lowest level.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param upperLevel: Upper boundary value of the greatest level.
2011-02-22 21:43:26 +01:00
.. index :: gpu::histEven
cv::gpu::histEven
-----------------
.. cfunction :: void histEven(const GpuMat\& src, GpuMat\& hist, int histSize, int lowerLevel, int upperLevel)
.. cfunction :: void histEven(const GpuMat\& src, GpuMat hist[4], int histSize[4], int lowerLevel[4], int upperLevel[4])
2011-02-26 12:05:10 +01:00
Calculates histogram with evenly distributed bins.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param src: Source image. Supports ``CV_8U`` , ``CV_16U`` or ``CV_16S`` depth and 1 or 4 channels. For four-channel image all channels are processed separately.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param hist: Destination histogram. Will have one row, ``histSize`` cols and ``CV_32S`` type.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param histSize: Size of histogram.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param lowerLevel: Lower boundary of lowest level bin.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param upperLevel: Upper boundary of highest level bin.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
.. index :: gpu::histRange
2011-02-22 21:43:26 +01:00
cv::gpu::histRange
------------------
.. cfunction :: void histRange(const GpuMat\& src, GpuMat\& hist, const GpuMat\& levels)
.. cfunction :: void histRange(const GpuMat\& src, GpuMat hist[4], const GpuMat levels[4])
2011-02-26 12:05:10 +01:00
Calculates histogram with bins determined by levels array.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param src: Source image. Supports ``CV_8U`` , ``CV_16U`` or ``CV_16S`` depth and 1 or 4 channels. For four-channel image all channels are processed separately.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param hist: Destination histogram. Will have one row, ``(levels.cols-1)`` cols and ``CV_32SC1`` type.
2011-02-22 21:43:26 +01:00
2011-02-26 12:05:10 +01:00
:param levels: Number of levels in histogram.
2011-02-22 21:43:26 +01:00