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