Table of Contents

Method WarpPerspective

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

WarpPerspective(InputArray, OutputArray, InputArray, Size, InterpolationFlags, BorderTypes, Scalar?, AlgorithmHint)

Applies a perspective transformation to an image.

public static void WarpPerspective(InputArray src, OutputArray dst, InputArray m, Size dsize, InterpolationFlags flags = InterpolationFlags.Linear, BorderTypes borderMode = BorderTypes.Constant, Scalar? borderValue = null, AlgorithmHint hint = AlgorithmHint.Default)

Parameters

src InputArray

input image.

dst OutputArray

output image that has the size dsize and the same type as src.

m InputArray

3x3 transformation matrix.

dsize Size

size of the output image.

flags InterpolationFlags

combination of interpolation methods (INTER_LINEAR or INTER_NEAREST) and the optional flag WARP_INVERSE_MAP, that sets M as the inverse transformation (dst -> src).

borderMode BorderTypes

pixel extrapolation method (BORDER_CONSTANT or BORDER_REPLICATE).

borderValue Scalar?

value used in case of a constant border; by default, it equals 0.

hint AlgorithmHint

Hint that selects between alternative algorithm implementations (OpenCV 5).

WarpPerspective(InputArray, OutputArray, float[,], Size, InterpolationFlags, BorderTypes, Scalar?, AlgorithmHint)

Applies a perspective transformation to an image.

public static void WarpPerspective(InputArray src, OutputArray dst, float[,] m, Size dsize, InterpolationFlags flags = InterpolationFlags.Linear, BorderTypes borderMode = BorderTypes.Constant, Scalar? borderValue = null, AlgorithmHint hint = AlgorithmHint.Default)

Parameters

src InputArray

input image.

dst OutputArray

output image that has the size dsize and the same type as src.

m float[,]

3x3 transformation matrix.

dsize Size

size of the output image.

flags InterpolationFlags

combination of interpolation methods (INTER_LINEAR or INTER_NEAREST) and the optional flag WARP_INVERSE_MAP, that sets M as the inverse transformation (dst -> src).

borderMode BorderTypes

pixel extrapolation method (BORDER_CONSTANT or BORDER_REPLICATE).

borderValue Scalar?

value used in case of a constant border; by default, it equals 0.

hint AlgorithmHint

Hint that selects between alternative algorithm implementations (OpenCV 5).