Table of Contents

Method Reshape

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

Reshape(int, int)

Changes the shape and/or the number of channels of a 2D matrix without copying the data.

public Mat Reshape(int cn, int rows = 0)

Parameters

cn int

New number of channels. If the parameter is 0, the number of channels remains the same.

rows int

New number of rows. If the parameter is 0, the number of rows remains the same.

Returns

Mat

Reshape(int, int[])

Changes the shape and/or the number of channels of a 2D matrix without copying the data.

public Mat Reshape(int cn, int[] newDims)

Parameters

cn int

New number of channels. If the parameter is 0, the number of channels remains the same.

newDims int[]

New number of rows. If the parameter is 0, the number of rows remains the same.

Returns

Mat

Reshape(int, MatShape)

Changes the shape (and optionally the number of channels) of the matrix without copying the data, using a MatShape (OpenCV 5).

public Mat Reshape(int cn, MatShape newShape)

Parameters

cn int

New number of channels. If 0, the number of channels remains the same.

newShape MatShape

New shape.

Returns

Mat