| OpenCV 5.0.0alpha Open Source Computer Vision

Loading...
Searching...
No Matches
Functions
Image Warping
CUDA-accelerated Computer Vision

## Detailed Description

## Functions
void | cv::cuda::buildWarpAffineMaps (InputArray M, bool inverse, Size dsize, OutputArray xmap, OutputArray ymap, Stream &stream=Stream::Null())
| Builds transformation maps for affine transformation.
void | cv::cuda::buildWarpAffineMaps (Mat M, bool inverse, Size dsize, GpuMat &xmap, GpuMat &ymap, Stream &stream=Stream::Null())
void | cv::cuda::buildWarpAffineMaps (UMat M, bool inverse, Size dsize, GpuMat &xmap, GpuMat &ymap, Stream &stream=Stream::Null())
void | cv::cuda::buildWarpPerspectiveMaps (InputArray M, bool inverse, Size dsize, OutputArray xmap, OutputArray ymap, Stream &stream=Stream::Null())
| Builds transformation maps for perspective transformation.
void | cv::cuda::buildWarpPerspectiveMaps (Mat M, bool inverse, Size dsize, GpuMat &xmap, GpuMat &ymap, Stream &stream=Stream::Null())
void | cv::cuda::buildWarpPerspectiveMaps (UMat M, bool inverse, Size dsize, GpuMat &xmap, GpuMat &ymap, Stream &stream=Stream::Null())
void | cv::cuda::pyrDown (InputArray src, OutputArray dst, Stream &stream=Stream::Null())
| Smoothes an image and downsamples it.
void | cv::cuda::pyrUp (InputArray src, OutputArray dst, Stream &stream=Stream::Null())
| Upsamples an image and then smoothes it.
void | cv::cuda::remap (InputArray src, OutputArray dst, InputArray xmap, InputArray ymap, int interpolation, int borderMode=BORDER_CONSTANT, Scalar borderValue=Scalar(), Stream &stream=Stream::Null())
| Applies a generic geometrical transformation to an image.
void | cv::cuda::resize (InputArray src, OutputArray dst, Size dsize, double fx=0, double fy=0, int interpolation=INTER_LINEAR, Stream &stream=Stream::Null())
| Resizes an image.
void | cv::cuda::rotate (InputArray src, OutputArray dst, Size dsize, double angle, double xShift=0, double yShift=0, int interpolation=INTER_LINEAR, Stream &stream=Stream::Null())
| Rotates an image around the origin (0,0) and then shifts it.
void | cv::cuda::warpAffine (InputArray src, OutputArray dst, InputArray M, Size dsize, int flags=INTER_LINEAR, int borderMode=BORDER_CONSTANT, Scalar borderValue=Scalar(), Stream &stream=Stream::Null())
| Applies an affine transformation to an image.
void | cv::cuda::warpAffine (InputArray src, OutputArray dst, Mat M, Size dsize, int flags=INTER_LINEAR, int borderMode=BORDER_CONSTANT, Scalar borderValue=Scalar(), Stream &stream=Stream::Null())
void | cv::cuda::warpAffine (InputArray src, OutputArray dst, UMat M, Size dsize, int flags=INTER_LINEAR, int borderMode=BORDER_CONSTANT, Scalar borderValue=Scalar(), Stream &stream=Stream::Null())
void | cv::cuda::warpPerspective (InputArray src, OutputArray dst, InputArray M, Size dsize, int flags=INTER_LINEAR, int borderMode=BORDER_CONSTANT, Scalar borderValue=Scalar(), Stream &stream=Stream::Null())
| Applies a perspective transformation to an image.
void | cv::cuda::warpPerspective (InputArray src, OutputArray dst, Mat M, Size dsize, int flags=INTER_LINEAR, int borderMode=BORDER_CONSTANT, Scalar borderValue=Scalar(), Stream &stream=Stream::Null())
void | cv::cuda::warpPerspective (InputArray src, OutputArray dst, UMat M, Size dsize, int flags=INTER_LINEAR, int borderMode=BORDER_CONSTANT, Scalar borderValue=Scalar(), Stream &stream=Stream::Null())

## Function Documentation

## ◆ buildWarpAffineMaps() [1/3]

void cv::cuda::buildWarpAffineMaps | ( | InputArray | M,
|  | bool | inverse,
|  | Size | dsize,
|  | OutputArray | xmap,
|  | OutputArray | ymap,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudawarping.hpp>`

Builds transformation maps for affine transformation.

Parameters

  M | 2x3 Mat or UMat transformation matrix.
  inverse | Flag specifying that M is an inverse transformation ( dst=>src ).
  dsize | Size of the destination image.
  xmap | X values with CV_32FC1 type.
  ymap | Y values with CV_32FC1 type.
  stream | Stream for the asynchronous version.

See also
  cuda::warpAffine , cuda::remap

## ◆ buildWarpAffineMaps() [2/3]

void cv::cuda::buildWarpAffineMaps | ( | Mat | M,
|  | bool | inverse,
|  | Size | dsize,
|  | GpuMat & | xmap,
|  | GpuMat & | ymap,
|  | Stream & | stream = Stream::Null() )
| inline

`#include <opencv2/cudawarping.hpp>`

Here is the call graph for this function:

## ◆ buildWarpAffineMaps() [3/3]

void cv::cuda::buildWarpAffineMaps | ( | UMat | M,
|  | bool | inverse,
|  | Size | dsize,
|  | GpuMat & | xmap,
|  | GpuMat & | ymap,
|  | Stream & | stream = Stream::Null() )
| inline

`#include <opencv2/cudawarping.hpp>`

Here is the call graph for this function:

## ◆ buildWarpPerspectiveMaps() [1/3]

void cv::cuda::buildWarpPerspectiveMaps | ( | InputArray | M,
|  | bool | inverse,
|  | Size | dsize,
|  | OutputArray | xmap,
|  | OutputArray | ymap,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudawarping.hpp>`

Builds transformation maps for perspective transformation.

Parameters

  M | 3x3 Mat or UMat transformation matrix.
  inverse | Flag specifying that M is an inverse transformation ( dst=>src ).
  dsize | Size of the destination image.
  xmap | X values with CV_32FC1 type.
  ymap | Y values with CV_32FC1 type.
  stream | Stream for the asynchronous version.

See also
  cuda::warpPerspective , cuda::remap

## ◆ buildWarpPerspectiveMaps() [2/3]

void cv::cuda::buildWarpPerspectiveMaps | ( | Mat | M,
|  | bool | inverse,
|  | Size | dsize,
|  | GpuMat & | xmap,
|  | GpuMat & | ymap,
|  | Stream & | stream = Stream::Null() )
| inline

`#include <opencv2/cudawarping.hpp>`

Here is the call graph for this function:

## ◆ buildWarpPerspectiveMaps() [3/3]

void cv::cuda::buildWarpPerspectiveMaps | ( | UMat | M,
|  | bool | inverse,
|  | Size | dsize,
|  | GpuMat & | xmap,
|  | GpuMat & | ymap,
|  | Stream & | stream = Stream::Null() )
| inline

`#include <opencv2/cudawarping.hpp>`

Here is the call graph for this function:

## ◆ pyrDown()

void cv::cuda::pyrDown | ( | InputArray | src,
|  | OutputArray | dst,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudawarping.hpp>`

Smoothes an image and downsamples it.

Parameters

  src | Source image.
  dst | Destination image. Will have Size((src.cols+1)/2, (src.rows+1)/2) size and the same type as src .
  stream | Stream for the asynchronous version.

See also
  pyrDown

## ◆ pyrUp()

void cv::cuda::pyrUp | ( | InputArray | src,
|  | OutputArray | dst,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudawarping.hpp>`

Upsamples an image and then smoothes it.

Parameters

  src | Source image.
  dst | Destination image. Will have Size(src.cols*2, src.rows*2) size and the same type as src .
  stream | Stream for the asynchronous version.

## ◆ remap()

void cv::cuda::remap | ( | InputArray | src,
|  | OutputArray | dst,
|  | InputArray | xmap,
|  | InputArray | ymap,
|  | int | interpolation,
|  | int | borderMode = BORDER_CONSTANT,
|  | Scalar | borderValue = Scalar(),
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudawarping.hpp>`

Applies a generic geometrical transformation to an image.

Parameters

  src | Source image.
  dst | Destination image with the size the same as xmap and the type the same as src .
  xmap | X values. Only CV_32FC1 type is supported.
  ymap | Y values. Only CV_32FC1 type is supported.
  interpolation | Interpolation method (see resize ). INTER_NEAREST , INTER_LINEAR and INTER_CUBIC are supported for now. The extra flag WARP_RELATIVE_MAP can be ORed to the interpolation method (e.g. INTER_LINEAR | WARP_RELATIVE_MAP)
  borderMode | Pixel extrapolation method (see borderInterpolate ). BORDER_REFLECT101 , BORDER_REPLICATE , BORDER_CONSTANT , BORDER_REFLECT and BORDER_WRAP are supported for now.
  borderValue | Value used in case of a constant border. By default, it is 0.
  stream | Stream for the asynchronous version.

The function transforms the source image using the specified map:

\[\texttt{dst} (x,y) = \texttt{src} (xmap(x,y), ymap(x,y))\]

with the WARP_RELATIVE_MAP flag :

\[\texttt{dst} (x,y) = \texttt{src} (x+map_x(x,y),y+map_y(x,y))\]

Values of pixels with non-integer coordinates are computed using the bilinear interpolation.

See also
  remap

## ◆ resize()

void cv::cuda::resize | ( | InputArray | src,
|  | OutputArray | dst,
|  | Size | dsize,
|  | double | fx = 0,
|  | double | fy = 0,
|  | int | interpolation = INTER_LINEAR,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudawarping.hpp>`

Resizes an image.

Parameters

  src | Source image.
  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 .
  dsize | Destination image size. If it is zero, it is computed as: \[\texttt{dsize = Size(round(fx*src.cols), round(fy*src.rows))}\] Either dsize or both fx and fy must be non-zero.
  fx | Scale factor along the horizontal axis. If it is zero, it is computed as: \[\texttt{(double)dsize.width/src.cols}\]
  fy | Scale factor along the vertical axis. If it is zero, it is computed as: \[\texttt{(double)dsize.height/src.rows}\]
  interpolation | Interpolation method. INTER_NEAREST , INTER_LINEAR and INTER_CUBIC are supported for now.
  stream | Stream for the asynchronous version.

See also
  resize

## ◆ rotate()

void cv::cuda::rotate | ( | InputArray | src,
|  | OutputArray | dst,
|  | Size | dsize,
|  | double | angle,
|  | double | xShift = 0,
|  | double | yShift = 0,
|  | int | interpolation = INTER_LINEAR,
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudawarping.hpp>`

Rotates an image around the origin (0,0) and then shifts it.

Parameters

  src | Source image. Supports 1, 3 or 4 channels images with CV_8U , CV_16U or CV_32F depth.
  dst | Destination image with the same type as src . The size is dsize .
  dsize | Size of the destination image.
  angle | Angle of rotation in degrees.
  xShift | Shift along the horizontal axis.
  yShift | Shift along the vertical axis.
  interpolation | Interpolation method. Only INTER_NEAREST , INTER_LINEAR , and INTER_CUBIC are supported.
  stream | Stream for the asynchronous version.

See also
  cuda::warpAffine

## ◆ warpAffine() [1/3]

void cv::cuda::warpAffine | ( | InputArray | src,
|  | OutputArray | dst,
|  | InputArray | M,
|  | Size | dsize,
|  | int | flags = INTER_LINEAR,
|  | int | borderMode = BORDER_CONSTANT,
|  | Scalar | borderValue = Scalar(),
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudawarping.hpp>`

Applies an affine transformation to an image.

Parameters

  src | Source image. CV_8U , CV_16U , CV_32S , or CV_32F depth and 1, 3, or 4 channels are supported.
  dst | Destination image with the same type as src . The size is dsize .
  M | 2x3 Mat or UMat transformation matrix.
  dsize | Size of the destination image.
  flags | Combination of interpolation methods (see 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.
  borderMode |
  borderValue |
  stream | Stream for the asynchronous version.

See also
  warpAffine

## ◆ warpAffine() [2/3]

void cv::cuda::warpAffine | ( | InputArray | src,
|  | OutputArray | dst,
|  | Mat | M,
|  | Size | dsize,
|  | int | flags = INTER_LINEAR,
|  | int | borderMode = BORDER_CONSTANT,
|  | Scalar | borderValue = Scalar(),
|  | Stream & | stream = Stream::Null() )
| inline

`#include <opencv2/cudawarping.hpp>`

Here is the call graph for this function:

## ◆ warpAffine() [3/3]

void cv::cuda::warpAffine | ( | InputArray | src,
|  | OutputArray | dst,
|  | UMat | M,
|  | Size | dsize,
|  | int | flags = INTER_LINEAR,
|  | int | borderMode = BORDER_CONSTANT,
|  | Scalar | borderValue = Scalar(),
|  | Stream & | stream = Stream::Null() )
| inline

`#include <opencv2/cudawarping.hpp>`

Here is the call graph for this function:

## ◆ warpPerspective() [1/3]

void cv::cuda::warpPerspective | ( | InputArray | src,
|  | OutputArray | dst,
|  | InputArray | M,
|  | Size | dsize,
|  | int | flags = INTER_LINEAR,
|  | int | borderMode = BORDER_CONSTANT,
|  | Scalar | borderValue = Scalar(),
|  | Stream & | stream = Stream::Null() )

`#include <opencv2/cudawarping.hpp>`

Applies a perspective transformation to an image.

Parameters

  src | Source image. CV_8U , CV_16U , CV_32S , or CV_32F depth and 1, 3, or 4 channels are supported.
  dst | Destination image with the same type as src . The size is dsize .
  M | 3x3 Mat or UMat transformation matrix.
  dsize | Size of the destination image.
  flags | Combination of interpolation methods (see 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.
  borderMode |
  borderValue |
  stream | Stream for the asynchronous version.

See also
  warpPerspective

## ◆ warpPerspective() [2/3]

void cv::cuda::warpPerspective | ( | InputArray | src,
|  | OutputArray | dst,
|  | Mat | M,
|  | Size | dsize,
|  | int | flags = INTER_LINEAR,
|  | int | borderMode = BORDER_CONSTANT,
|  | Scalar | borderValue = Scalar(),
|  | Stream & | stream = Stream::Null() )
| inline

`#include <opencv2/cudawarping.hpp>`

Here is the call graph for this function:

## ◆ warpPerspective() [3/3]

void cv::cuda::warpPerspective | ( | InputArray | src,
|  | OutputArray | dst,
|  | UMat | M,
|  | Size | dsize,
|  | int | flags = INTER_LINEAR,
|  | int | borderMode = BORDER_CONSTANT,
|  | Scalar | borderValue = Scalar(),
|  | Stream & | stream = Stream::Null() )
| inline

`#include <opencv2/cudawarping.hpp>`

Here is the call graph for this function: