### Navigation

- index
- next |
- previous |
- OpenCV 3.0.0.0-dev documentation »
- OpenCV API Reference »
- gpuwarping. GPU-accelerated Image Warping »

# Image Warping

## gpu::remap

Applies a generic geometrical transformation to an image.

C++:`` void `gpu::``remap`(InputArray src, OutputArray dst, InputArray xmap, InputArray ymap, int interpolation, int borderMode=BORDER_CONSTANT, Scalar borderValue=Scalar(), Stream& stream=Stream::Null())

  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. 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:

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

See also

`remap()`

## gpu::resize

Resizes an image.

C++:`` void `gpu::``resize`(InputArray src, OutputArray dst, Size dsize, double fx=0, double fy=0, int interpolation=INTER_LINEAR, Stream& stream=Stream::Null())

  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: 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: fy – Scale factor along the vertical axis. If it is zero, it is computed as: interpolation – Interpolation method. `INTER_NEAREST` , `INTER_LINEAR` and `INTER_CUBIC` are supported for now. stream – Stream for the asynchronous version.

See also

`resize()`

## gpu::warpAffine

Applies an affine transformation to an image.

C++:`` void `gpu::``warpAffine`(InputArray src, OutputArray dst, InputArray M, Size dsize, int flags=INTER_LINEAR, int borderMode=BORDER_CONSTANT, Scalar borderValue=Scalar(), Stream& stream=Stream::Null())

  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 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. stream – Stream for the asynchronous version.

See also

`warpAffine()`

## gpu::buildWarpAffineMaps

Builds transformation maps for affine transformation.

C++:`` void `gpu::``buildWarpAffineMaps`(InputArray M, bool inverse, Size dsize, OutputArray xmap, OutputArray ymap, Stream& stream=Stream::Null())

  Parameters: | M – 2x3 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

`gpu::warpAffine()` , `gpu::remap()`

## gpu::warpPerspective

Applies a perspective transformation to an image.

C++:`` void `gpu::``warpPerspective`(InputArray src, OutputArray dst, InputArray M, Size dsize, int flags=INTER_LINEAR, int borderMode=BORDER_CONSTANT, Scalar borderValue=Scalar(), Stream& stream=Stream::Null())

  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 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. stream – Stream for the asynchronous version.

See also

`warpPerspective()`

## gpu::buildWarpPerspectiveMaps

Builds transformation maps for perspective transformation.

C++:`` void `gpu::``buildWarpAffineMaps`(InputArray M, bool inverse, Size dsize, OutputArray xmap, OutputArray ymap, Stream& stream=Stream::Null())

  Parameters: | M – 3x3 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

`gpu::warpPerspective()` , `gpu::remap()`

## gpu::buildWarpPlaneMaps

Builds plane warping maps.

C++:`` void `gpu::``buildWarpPlaneMaps`(Size src_size, Rect dst_roi, InputArray K, InputArray R, InputArray T, float scale, OutputArray map_x, OutputArray map_y, Stream& stream=Stream::Null())

  Parameters: | stream – Stream for the asynchronous version.

## gpu::buildWarpCylindricalMaps

Builds cylindrical warping maps.

C++:`` void `gpu::``buildWarpCylindricalMaps`(Size src_size, Rect dst_roi, InputArray K, InputArray R, float scale, OutputArray map_x, OutputArray map_y, Stream& stream=Stream::Null())

  Parameters: | stream – Stream for the asynchronous version.

## gpu::buildWarpSphericalMaps

Builds spherical warping maps.

C++:`` void `gpu::``buildWarpSphericalMaps`(Size src_size, Rect dst_roi, InputArray K, InputArray R, float scale, OutputArray map_x, OutputArray map_y, Stream& stream=Stream::Null())

  Parameters: | stream – Stream for the asynchronous version.

## gpu::rotate

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

C++:`` void `gpu::``rotate`(InputArray src, OutputArray dst, Size dsize, double angle, double xShift=0, double yShift=0, int interpolation=INTER_LINEAR, Stream& stream=Stream::Null())

  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

`gpu::warpAffine()`

## gpu::pyrDown

Smoothes an image and downsamples it.

C++:`` void `gpu::``pyrDown`(InputArray src, OutputArray dst, Stream& stream=Stream::Null())

  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()`

## gpu::pyrUp

Upsamples an image and then smoothes it.

C++:`` void `gpu::``pyrUp`(InputArray src, OutputArray dst, Stream& stream=Stream::Null())

  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.

See also

`pyrUp()`

## Help and Feedback

You did not find what you were looking for?

- Ask a question on the Q&A forum.
- If you think something is missing or wrong in the documentation, please file a bug report.

### Navigation

- index
- next |
- previous |
- OpenCV 3.0.0.0-dev documentation »
- OpenCV API Reference »
- gpuwarping. GPU-accelerated Image Warping »