Show / Hide Table of Contents

Class Mat

OpenCV C++ n-dimensional dense array class (cv::Mat)

Inheritance
System.Object
DisposableObject
DisposableCvObject
Mat
Mat<TElem>
Implements
ICvPtrHolder
Inherited Members
DisposableCvObject.ptr
DisposableCvObject.CvPtr
DisposableObject.DataHandle
DisposableObject.IsDisposed
DisposableObject.IsEnabledDispose
DisposableObject.AllocatedMemory
DisposableObject.AllocatedMemorySize
DisposableObject.Dispose()
DisposableObject.Dispose(Boolean)
DisposableObject.AllocGCHandle(Object)
DisposableObject.AllocMemory(Int32)
DisposableObject.NotifyMemoryPressure(Int64)
DisposableObject.ThrowIfDisposed()
Namespace: OpenCvSharp
Assembly: OpenCvSharp.dll
Syntax
public class Mat : DisposableCvObject, ICvPtrHolder

Constructors

| Improve this Doc View Source

Mat()

Creates empty Mat

Declaration
public Mat()
| Improve this Doc View Source

Mat(IEnumerable<Int32>, MatType)

constructs n-dimensional matrix

Declaration
public Mat(IEnumerable<int> sizes, MatType type)
Parameters
Type Name Description
IEnumerable<System.Int32> sizes

Array of integers specifying an n-dimensional array shape.

OpenCvSharp.MatType type

Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices.

| Improve this Doc View Source

Mat(IEnumerable<Int32>, MatType, Array, Nullable<IEnumerable<Int64>>)

constructor for matrix headers pointing to user-allocated data

Declaration
protected Mat(IEnumerable<int> sizes, MatType type, Array data, IEnumerable<long>? steps = null)
Parameters
Type Name Description
IEnumerable<System.Int32> sizes

Array of integers specifying an n-dimensional array shape.

OpenCvSharp.MatType type

Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices.

Array data

Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. This operation is very efficient and can be used to process external data using OpenCV functions. The external data is not automatically de-allocated, so you should take care of it.

System.Nullable<IEnumerable<System.Int64>> steps

Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). If not specified, the matrix is assumed to be continuous.

| Improve this Doc View Source

Mat(IEnumerable<Int32>, MatType, Scalar)

constructs n-dimensional matrix

Declaration
public Mat(IEnumerable<int> sizes, MatType type, Scalar s)
Parameters
Type Name Description
IEnumerable<System.Int32> sizes

Array of integers specifying an n-dimensional array shape.

OpenCvSharp.MatType type

Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices.

OpenCvSharp.Scalar s

An optional value to initialize each matrix element with. To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method .

| Improve this Doc View Source

Mat(Mat)

Declaration
protected Mat(Mat m)
Parameters
Type Name Description
Mat m
| Improve this Doc View Source

Mat(Mat, Range, Nullable<Range>)

creates a matrix header for a part of the bigger matrix

Declaration
public Mat(Mat m, Range rowRange, Range? colRange = null)
Parameters
Type Name Description
Mat m

Array that (as a whole or partly) is assigned to the constructed matrix. No data is copied by these constructors. Instead, the header pointing to m data or its sub-array is constructed and associated with it. The reference counter, if any, is incremented. So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . If you want to have an independent copy of the sub-array, use Mat::clone() .

OpenCvSharp.Range rowRange

Range of the m rows to take. As usual, the range start is inclusive and the range end is exclusive. Use Range.All to take all the rows.

System.Nullable<OpenCvSharp.Range> colRange

Range of the m columns to take. Use Range.All to take all the columns.

| Improve this Doc View Source

Mat(Mat, Range[])

creates a matrix header for a part of the bigger matrix

Declaration
public Mat(Mat m, params Range[] ranges)
Parameters
Type Name Description
Mat m

Array that (as a whole or partly) is assigned to the constructed matrix. No data is copied by these constructors. Instead, the header pointing to m data or its sub-array is constructed and associated with it. The reference counter, if any, is incremented. So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . If you want to have an independent copy of the sub-array, use Mat.Clone() .

OpenCvSharp.Range[] ranges

Array of selected ranges of m along each dimensionality.

| Improve this Doc View Source

Mat(Mat, Rect)

creates a matrix header for a part of the bigger matrix

Declaration
public Mat(Mat m, Rect roi)
Parameters
Type Name Description
Mat m

Array that (as a whole or partly) is assigned to the constructed matrix. No data is copied by these constructors. Instead, the header pointing to m data or its sub-array is constructed and associated with it. The reference counter, if any, is incremented. So, when you modify the matrix formed using such a constructor, you also modify the corresponding elements of m . If you want to have an independent copy of the sub-array, use Mat.Clone() .

OpenCvSharp.Rect roi

Region of interest.

| Improve this Doc View Source

Mat(Size, MatType)

constructs 2D matrix of the specified size and type

Declaration
public Mat(Size size, MatType type)
Parameters
Type Name Description
OpenCvSharp.Size size

2D array size: Size(cols, rows) . In the Size() constructor, the number of rows and the number of columns go in the reverse order.

OpenCvSharp.MatType type

Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or MatType.CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices.

| Improve this Doc View Source

Mat(Size, MatType, Scalar)

constructs 2D matrix and fills it with the specified Scalar value.

Declaration
public Mat(Size size, MatType type, Scalar s)
Parameters
Type Name Description
OpenCvSharp.Size size

2D array size: Size(cols, rows) . In the Size() constructor, the number of rows and the number of columns go in the reverse order.

OpenCvSharp.MatType type

Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or CV_8UC(n), ..., CV_64FC(n) to create multi-channel (up to CV_CN_MAX channels) matrices.

OpenCvSharp.Scalar s

An optional value to initialize each matrix element with. To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method .

| Improve this Doc View Source

Mat(Int32, Int32, MatType)

constructs 2D matrix of the specified size and type

Declaration
public Mat(int rows, int cols, MatType type)
Parameters
Type Name Description
System.Int32 rows

Number of rows in a 2D array.

System.Int32 cols

Number of columns in a 2D array.

OpenCvSharp.MatType type

Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices.

| Improve this Doc View Source

Mat(Int32, Int32, MatType, Array, Int64)

constructor for matrix headers pointing to user-allocated data

Declaration
protected Mat(int rows, int cols, MatType type, Array data, long step = 0L)
Parameters
Type Name Description
System.Int32 rows

Number of rows in a 2D array.

System.Int32 cols

Number of columns in a 2D array.

OpenCvSharp.MatType type

Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices.

Array data

Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. This operation is very efficient and can be used to process external data using OpenCV functions. The external data is not automatically de-allocated, so you should take care of it.

System.Int64 step

Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() .

| Improve this Doc View Source

Mat(Int32, Int32, MatType, IntPtr, Int64)

constructor for matrix headers pointing to user-allocated data

Declaration
public Mat(int rows, int cols, MatType type, IntPtr data, long step = 0L)
Parameters
Type Name Description
System.Int32 rows

Number of rows in a 2D array.

System.Int32 cols

Number of columns in a 2D array.

OpenCvSharp.MatType type

Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices.

IntPtr data

Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. This operation is very efficient and can be used to process external data using OpenCV functions. The external data is not automatically de-allocated, so you should take care of it.

System.Int64 step

Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() .

| Improve this Doc View Source

Mat(Int32, Int32, MatType, Scalar)

constructs 2D matrix and fills it with the specified Scalar value.

Declaration
public Mat(int rows, int cols, MatType type, Scalar s)
Parameters
Type Name Description
System.Int32 rows

Number of rows in a 2D array.

System.Int32 cols

Number of columns in a 2D array.

OpenCvSharp.MatType type

Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices.

OpenCvSharp.Scalar s

An optional value to initialize each matrix element with. To set all the matrix elements to the particular value after the construction, use SetTo(Scalar s) method .

| Improve this Doc View Source

Mat(String, ImreadModes)

Loads an image from a file. (cv::imread)

Declaration
public Mat(string fileName, ImreadModes flags = ImreadModes.Color)
Parameters
Type Name Description
System.String fileName

Name of file to be loaded.

ImreadModes flags

Specifies color type of the loaded image

Fields

| Improve this Doc View Source

TypeMap

typeof(T) -> MatType

Declaration
protected static readonly IReadOnlyDictionary<Type, MatType> TypeMap
Field Value
Type Description
IReadOnlyDictionary<Type, OpenCvSharp.MatType>

Properties

| Improve this Doc View Source

Cols

the number of columns or -1 when the array has more than 2 dimensions

Declaration
public int Cols { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Data

pointer to the data

Declaration
public IntPtr Data { get; }
Property Value
Type Description
IntPtr
| Improve this Doc View Source

DataEnd

The pointer that is possible to compute a relative sub-array position in the main container array using locateROI()

Declaration
public IntPtr DataEnd { get; }
Property Value
Type Description
IntPtr
| Improve this Doc View Source

DataLimit

The pointer that is possible to compute a relative sub-array position in the main container array using locateROI()

Declaration
public IntPtr DataLimit { get; }
Property Value
Type Description
IntPtr
| Improve this Doc View Source

DataPointer

unsafe pointer to the data

Declaration
public byte *DataPointer { get; }
Property Value
Type Description
System.Byte*
| Improve this Doc View Source

DataStart

The pointer that is possible to compute a relative sub-array position in the main container array using locateROI()

Declaration
public IntPtr DataStart { get; }
Property Value
Type Description
IntPtr
| Improve this Doc View Source

Dims

the array dimensionality, >= 2

Declaration
public int Dims { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Flags

includes several bit-fields:

  • the magic signature
  • continuity flag
  • depth
  • number of channels
Declaration
public int Flags { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Height

the number of rows or -1 when the array has more than 2 dimensions

Declaration
public int Height { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Item[Range, Range]

Extracts a rectangular submatrix.

Declaration
public Mat this[Range rowRange, Range colRange] { get; set; }
Parameters
Type Name Description
OpenCvSharp.Range rowRange

Start and end row of the extracted submatrix. The upper boundary is not included. To select all the rows, use Range.All().

OpenCvSharp.Range colRange

Start and end column of the extracted submatrix. The upper boundary is not included. To select all the columns, use Range.All().

Property Value
Type Description
Mat
| Improve this Doc View Source

Item[Range[]]

Extracts a rectangular submatrix.

Declaration
public Mat this[params Range[] ranges] { get; set; }
Parameters
Type Name Description
OpenCvSharp.Range[] ranges

Array of selected ranges along each array dimension.

Property Value
Type Description
Mat
| Improve this Doc View Source

Item[Rect]

Extracts a rectangular submatrix.

Declaration
public Mat this[Rect roi] { get; set; }
Parameters
Type Name Description
OpenCvSharp.Rect roi

Extracted submatrix specified as a rectangle.

Property Value
Type Description
Mat
| Improve this Doc View Source

Item[Int32, Int32, Int32, Int32]

Extracts a rectangular submatrix.

Declaration
public Mat this[int rowStart, int rowEnd, int colStart, int colEnd] { get; set; }
Parameters
Type Name Description
System.Int32 rowStart

Start row of the extracted submatrix. The upper boundary is not included.

System.Int32 rowEnd

End row of the extracted submatrix. The upper boundary is not included.

System.Int32 colStart

Start column of the extracted submatrix. The upper boundary is not included.

System.Int32 colEnd

End column of the extracted submatrix. The upper boundary is not included.

Property Value
Type Description
Mat
| Improve this Doc View Source

Item[Range, Range]

Extracts a rectangular submatrix.

Declaration
public Mat this[Range rowRange, Range colRange] { get; set; }
Parameters
Type Name Description
System.Range rowRange

Start and end row of the extracted submatrix. The upper boundary is not included. To select all the rows, use Range.All().

System.Range colRange

Start and end column of the extracted submatrix. The upper boundary is not included. To select all the columns, use Range.All().

Property Value
Type Description
Mat
| Improve this Doc View Source

Rows

the number of rows or -1 when the array has more than 2 dimensions

Declaration
public int Rows { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Width

the number of columns or -1 when the array has more than 2 dimensions

Declaration
public int Width { get; }
Property Value
Type Description
System.Int32

Methods

| Improve this Doc View Source

Abs()

Computes absolute value of each matrix element

Declaration
public MatExpr Abs()
Returns
Type Description
MatExpr
| Improve this Doc View Source

Accumulate(InputArray)

Adds an image to the accumulator.

Declaration
public Mat Accumulate(InputArray mask)
Parameters
Type Name Description
InputArray mask

Optional operation mask.

Returns
Type Description
Mat

Accumulator image with the same number of channels as input image, 32-bit or 64-bit floating-point.

| Improve this Doc View Source

AccumulateSquare(InputArray)

Adds the square of a source image to the accumulator.

Declaration
public Mat AccumulateSquare(InputArray mask)
Parameters
Type Name Description
InputArray mask

Optional operation mask.

Returns
Type Description
Mat

Accumulator image with the same number of channels as input image, 32-bit or 64-bit floating-point.

| Improve this Doc View Source

AdaptiveThreshold(Double, AdaptiveThresholdTypes, ThresholdTypes, Int32, Double)

Applies an adaptive threshold to an array. Source matrix must be 8-bit single-channel image.

Declaration
public Mat AdaptiveThreshold(double maxValue, AdaptiveThresholdTypes adaptiveMethod, ThresholdTypes thresholdType, int blockSize, double c)
Parameters
Type Name Description
System.Double maxValue

Non-zero value assigned to the pixels for which the condition is satisfied. See the details below.

AdaptiveThresholdTypes adaptiveMethod

Adaptive thresholding algorithm to use, ADAPTIVE_THRESH_MEAN_C or ADAPTIVE_THRESH_GAUSSIAN_C .

ThresholdTypes thresholdType

Thresholding type that must be either THRESH_BINARY or THRESH_BINARY_INV .

System.Int32 blockSize

Size of a pixel neighborhood that is used to calculate a threshold value for the pixel: 3, 5, 7, and so on.

System.Double c

Constant subtracted from the mean or weighted mean (see the details below). Normally, it is positive but may be zero or negative as well.

Returns
Type Description
Mat

Destination image of the same size and the same type as src.

| Improve this Doc View Source

Add(Mat)

Declaration
public MatExpr Add(Mat m)
Parameters
Type Name Description
Mat m
Returns
Type Description
MatExpr
| Improve this Doc View Source

Add(Scalar)

Declaration
public MatExpr Add(Scalar s)
Parameters
Type Name Description
OpenCvSharp.Scalar s
Returns
Type Description
MatExpr
| Improve this Doc View Source

AdjustROI(Int32, Int32, Int32, Int32)

Adjusts a submatrix size and position within the parent matrix.

Declaration
public Mat AdjustROI(int dtop, int dbottom, int dleft, int dright)
Parameters
Type Name Description
System.Int32 dtop

Shift of the top submatrix boundary upwards.

System.Int32 dbottom

Shift of the bottom submatrix boundary downwards.

System.Int32 dleft

Shift of the left submatrix boundary to the left.

System.Int32 dright

Shift of the right submatrix boundary to the right.

Returns
Type Description
Mat
| Improve this Doc View Source

Alignment(Int32)

Declaration
public Mat Alignment(int n = 4)
Parameters
Type Name Description
System.Int32 n
Returns
Type Description
Mat
| Improve this Doc View Source

ApproxPolyDP(Double, Boolean)

Approximates contour or a curve using Douglas-Peucker algorithm. The input is the polygon or curve to approximate and it must be 1 x N or N x 1 matrix of type CV_32SC2 or CV_32FC2.

Declaration
public Mat ApproxPolyDP(double epsilon, bool closed)
Parameters
Type Name Description
System.Double epsilon

Specifies the approximation accuracy. This is the maximum distance between the original curve and its approximation.

System.Boolean closed

The result of the approximation; The type should match the type of the input curve

Returns
Type Description
Mat

The result of the approximation; The type should match the type of the input curve

| Improve this Doc View Source

ArcLength(Boolean)

Calculates a contour perimeter or a curve length. The input is 2D point set, represented by CV_32SC2 or CV_32FC2 matrix.

Declaration
public double ArcLength(bool closed)
Parameters
Type Name Description
System.Boolean closed

Indicates, whether the curve is closed or not

Returns
Type Description
System.Double
| Improve this Doc View Source

AssignTo(Mat, Nullable<MatType>)

Provides a functional form of convertTo.

Declaration
public void AssignTo(Mat m, MatType? type = null)
Parameters
Type Name Description
Mat m

Destination array.

System.Nullable<OpenCvSharp.MatType> type

Desired destination array depth (or -1 if it should be the same as the source type).

| Improve this Doc View Source

AsSpan<T>()

Creates a new span over the Mat.

Declaration
public Span<T> AsSpan<T>()
    where T : struct
Returns
Type Description
Span<T>
Type Parameters
Name Description
T
| Improve this Doc View Source

At<T>(Int32)

Returns a value to the specified array element.

Declaration
public ref T At<T>(int i0)
    where T : struct
Parameters
Type Name Description
System.Int32 i0

Index along the dimension 0

Returns
Type Description
T

A value to the specified array element.

Type Parameters
Name Description
T
| Improve this Doc View Source

At<T>(Int32, Int32)

Returns a value to the specified array element.

Declaration
public ref T At<T>(int i0, int i1)
    where T : struct
Parameters
Type Name Description
System.Int32 i0

Index along the dimension 0

System.Int32 i1

Index along the dimension 1

Returns
Type Description
T

A value to the specified array element.

Type Parameters
Name Description
T
| Improve this Doc View Source

At<T>(Int32, Int32, Int32)

Returns a value to the specified array element.

Declaration
public ref T At<T>(int i0, int i1, int i2)
    where T : struct
Parameters
Type Name Description
System.Int32 i0

Index along the dimension 0

System.Int32 i1

Index along the dimension 1

System.Int32 i2

Index along the dimension 2

Returns
Type Description
T

A value to the specified array element.

Type Parameters
Name Description
T
| Improve this Doc View Source

At<T>(Int32[])

Returns a value to the specified array element.

Declaration
public ref T At<T>(params int[] idx)
    where T : struct
Parameters
Type Name Description
System.Int32[] idx

Array of Mat::dims indices.

Returns
Type Description
T

A value to the specified array element.

Type Parameters
Name Description
T
| Improve this Doc View Source

BilateralFilter(Int32, Double, Double, BorderTypes)

Applies bilateral filter to the image The source image must be a 8-bit or floating-point, 1-channel or 3-channel image.

Declaration
public Mat BilateralFilter(int d, double sigmaColor, double sigmaSpace, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
System.Int32 d

The diameter of each pixel neighborhood, that is used during filtering. If it is non-positive, it's computed from sigmaSpace

System.Double sigmaColor

Filter sigma in the color space. Larger value of the parameter means that farther colors within the pixel neighborhood will be mixed together, resulting in larger areas of semi-equal color

System.Double sigmaSpace

Filter sigma in the coordinate space. Larger value of the parameter means that farther pixels will influence each other (as long as their colors are close enough; see sigmaColor). Then d>0 , it specifies the neighborhood size regardless of sigmaSpace, otherwise d is proportional to sigmaSpace

BorderTypes borderType
Returns
Type Description
Mat

The destination image; will have the same size and the same type as src

| Improve this Doc View Source

BitwiseAnd(Mat)

Declaration
public MatExpr BitwiseAnd(Mat m)
Parameters
Type Name Description
Mat m
Returns
Type Description
MatExpr
| Improve this Doc View Source

BitwiseAnd(Double)

Declaration
public MatExpr BitwiseAnd(double s)
Parameters
Type Name Description
System.Double s
Returns
Type Description
MatExpr
| Improve this Doc View Source

BitwiseOr(Mat)

Declaration
public MatExpr BitwiseOr(Mat m)
Parameters
Type Name Description
Mat m
Returns
Type Description
MatExpr
| Improve this Doc View Source

BitwiseOr(Double)

Declaration
public MatExpr BitwiseOr(double s)
Parameters
Type Name Description
System.Double s
Returns
Type Description
MatExpr
| Improve this Doc View Source

Blur(Size, Nullable<Point>, BorderTypes)

Smoothes image using normalized box filter

Declaration
public Mat Blur(Size ksize, Point? anchor = null, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
OpenCvSharp.Size ksize

The smoothing kernel size

System.Nullable<OpenCvSharp.Point> anchor

The anchor point. The default value Point(-1,-1) means that the anchor is at the kernel center

BorderTypes borderType

The border mode used to extrapolate pixels outside of the image

Returns
Type Description
Mat

The destination image; will have the same size and the same type as src

| Improve this Doc View Source

BoundingRect()

Calculates the up-right bounding rectangle of a point set. The input is 2D point set, represented by CV_32SC2 or CV_32FC2 matrix.

Declaration
public Rect BoundingRect()
Returns
Type Description
OpenCvSharp.Rect

Minimal up-right bounding rectangle for the specified point set.

| Improve this Doc View Source

BoxFilter(MatType, Size, Nullable<Point>, Boolean, BorderTypes)

Smoothes image using box filter

Declaration
public Mat BoxFilter(MatType ddepth, Size ksize, Point? anchor = null, bool normalize = true, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
OpenCvSharp.MatType ddepth
OpenCvSharp.Size ksize

The smoothing kernel size

System.Nullable<OpenCvSharp.Point> anchor

The anchor point. The default value Point(-1,-1) means that the anchor is at the kernel center

System.Boolean normalize

Indicates, whether the kernel is normalized by its area or not

BorderTypes borderType

The border mode used to extrapolate pixels outside of the image

Returns
Type Description
Mat

The destination image; will have the same size and the same type as src

| Improve this Doc View Source

BuildPyramid(Int32, BorderTypes)

Upsamples an image and then blurs it.

Declaration
public IEnumerable<Mat> BuildPyramid(int maxlevel, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
System.Int32 maxlevel
BorderTypes borderType
Returns
Type Description
IEnumerable<Mat>
| Improve this Doc View Source

Canny(Double, Double, Int32, Boolean)

Finds edges in an image using Canny algorithm.

Declaration
public Mat Canny(double threshold1, double threshold2, int apertureSize = 3, bool L2gradient = false)
Parameters
Type Name Description
System.Double threshold1

The first threshold for the hysteresis procedure

System.Double threshold2

The second threshold for the hysteresis procedure

System.Int32 apertureSize

Aperture size for the Sobel operator [By default this is ApertureSize.Size3]

System.Boolean L2gradient

Indicates, whether the more accurate L2 norm should be used to compute the image gradient magnitude (true), or a faster default L1 norm is enough (false). [By default this is false]

Returns
Type Description
Mat

The output edge map. It will have the same size and the same type as image

| Improve this Doc View Source

Cast<TMat>()

Creates type-specific Mat instance from this.

Declaration
public TMat Cast<TMat>()
    where TMat : Mat
Returns
Type Description
TMat
Type Parameters
Name Description
TMat
| Improve this Doc View Source

Channels()

Returns the number of matrix channels.

Declaration
public int Channels()
Returns
Type Description
System.Int32
| Improve this Doc View Source

CheckRange(Boolean)

checks that each matrix element is within the specified range.

Declaration
public bool CheckRange(bool quiet = true)
Parameters
Type Name Description
System.Boolean quiet

The flag indicating whether the functions quietly return false when the array elements are out of range, or they throw an exception.

Returns
Type Description
System.Boolean
| Improve this Doc View Source

CheckRange(Boolean, out Point, Double, Double)

checks that each matrix element is within the specified range.

Declaration
public bool CheckRange(bool quiet, out Point pos, double minVal = -1.7976931348623157E+308, double maxVal = 1.7976931348623157E+308)
Parameters
Type Name Description
System.Boolean quiet

The flag indicating whether the functions quietly return false when the array elements are out of range, or they throw an exception.

OpenCvSharp.Point pos

The optional output parameter, where the position of the first outlier is stored.

System.Double minVal

The inclusive lower boundary of valid values range

System.Double maxVal

The exclusive upper boundary of valid values range

Returns
Type Description
System.Boolean
| Improve this Doc View Source

CheckVector(Int32, Int32, Boolean)

Declaration
public int CheckVector(int elemChannels, int depth = -1, bool requireContinuous = true)
Parameters
Type Name Description
System.Int32 elemChannels

Number of channels or number of columns the matrix should have. For a 2-D matrix, when the matrix has only 1 column, then it should have elemChannels channels; When the matrix has only 1 channel, then it should have elemChannels columns. For a 3-D matrix, it should have only one channel. Furthermore, if the number of planes is not one, then the number of rows within every plane has to be 1; if the number of rows within every plane is not 1, then the number of planes has to be 1.

System.Int32 depth

The depth the matrix should have. Set it to -1 when any depth is fine.

System.Boolean requireContinuous

Set it to true to require the matrix to be continuous

Returns
Type Description
System.Int32

-1 if the requirement is not satisfied. Otherwise, it returns the number of elements in the matrix. Note that an element may have multiple channels.

| Improve this Doc View Source

Circle(Point, Int32, Scalar, Int32, LineTypes, Int32)

Draws a circle

Declaration
public void Circle(Point center, int radius, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0)
Parameters
Type Name Description
OpenCvSharp.Point center

Center of the circle.

System.Int32 radius

Radius of the circle.

OpenCvSharp.Scalar color

Circle color.

System.Int32 thickness

Thickness of the circle outline if positive, otherwise indicates that a filled circle has to be drawn. [By default this is 1]

LineTypes lineType

Type of the circle boundary. [By default this is LineType.Link8]

System.Int32 shift

Number of fractional bits in the center coordinates and radius value. [By default this is 0]

| Improve this Doc View Source

Circle(Int32, Int32, Int32, Scalar, Int32, LineTypes, Int32)

Draws a circle

Declaration
public void Circle(int centerX, int centerY, int radius, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0)
Parameters
Type Name Description
System.Int32 centerX

X-coordinate of the center of the circle.

System.Int32 centerY

Y-coordinate of the center of the circle.

System.Int32 radius

Radius of the circle.

OpenCvSharp.Scalar color

Circle color.

System.Int32 thickness

Thickness of the circle outline if positive, otherwise indicates that a filled circle has to be drawn. [By default this is 1]

LineTypes lineType

Type of the circle boundary. [By default this is LineType.Link8]

System.Int32 shift

Number of fractional bits in the center coordinates and radius value. [By default this is 0]

| Improve this Doc View Source

Clone()

Creates a full copy of the matrix.

Declaration
public Mat Clone()
Returns
Type Description
Mat
| Improve this Doc View Source

Clone(Rect)

Returns the partial Mat of the specified Mat

Declaration
public Mat Clone(Rect roi)
Parameters
Type Name Description
OpenCvSharp.Rect roi
Returns
Type Description
Mat
| Improve this Doc View Source

Col(Int32)

Creates a matrix header for the specified matrix column.

Declaration
public Mat Col(int x)
Parameters
Type Name Description
System.Int32 x

A 0-based column index.

Returns
Type Description
Mat
| Improve this Doc View Source

ColRange(Range)

Creates a matrix header for the specified column span.

Declaration
public Mat ColRange(Range range)
Parameters
Type Name Description
OpenCvSharp.Range range
Returns
Type Description
Mat
| Improve this Doc View Source

ColRange(Int32, Int32)

Creates a matrix header for the specified column span.

Declaration
public Mat ColRange(int startCol, int endCol)
Parameters
Type Name Description
System.Int32 startCol

An inclusive 0-based start index of the column span.

System.Int32 endCol

An exclusive 0-based ending index of the column span.

Returns
Type Description
Mat
| Improve this Doc View Source

ColRange(Range)

Creates a matrix header for the specified column span.

Declaration
public Mat ColRange(Range range)
Parameters
Type Name Description
System.Range range
Returns
Type Description
Mat
| Improve this Doc View Source

CompleteSymm(Boolean)

extends the symmetrical matrix from the lower half or from the upper half

Declaration
public void CompleteSymm(bool lowerToUpper = false)
Parameters
Type Name Description
System.Boolean lowerToUpper

If true, the lower half is copied to the upper half, otherwise the upper half is copied to the lower half

| Improve this Doc View Source

ConnectedComponents(OutputArray, PixelConnectivity)

computes the connected components labeled image of boolean image. image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image.

Declaration
public int ConnectedComponents(OutputArray labels, PixelConnectivity connectivity = PixelConnectivity.Connectivity8)
Parameters
Type Name Description
OutputArray labels

destination labeled image

PixelConnectivity connectivity

8 or 4 for 8-way or 4-way connectivity respectively

Returns
Type Description
System.Int32

The number of labels

| Improve this Doc View Source

ConnectedComponents(OutputArray, PixelConnectivity, MatType)

computes the connected components labeled image of boolean image. image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image.

Declaration
public int ConnectedComponents(OutputArray labels, PixelConnectivity connectivity, MatType ltype)
Parameters
Type Name Description
OutputArray labels

destination labeled image

PixelConnectivity connectivity

8 or 4 for 8-way or 4-way connectivity respectively

OpenCvSharp.MatType ltype

output image label type. Currently CV_32S and CV_16U are supported.

Returns
Type Description
System.Int32

The number of labels

| Improve this Doc View Source

ConnectedComponents(out Int32[,], PixelConnectivity)

computes the connected components labeled image of boolean image. image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image.

Declaration
public int ConnectedComponents(out int[, ] labels, PixelConnectivity connectivity)
Parameters
Type Name Description
System.Int32[,] labels

destination labeled rectangular array

PixelConnectivity connectivity

8 or 4 for 8-way or 4-way connectivity respectively

Returns
Type Description
System.Int32

The number of labels

| Improve this Doc View Source

ConnectedComponentsEx(PixelConnectivity)

computes the connected components labeled image of boolean image. image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image.

Declaration
public ConnectedComponents ConnectedComponentsEx(PixelConnectivity connectivity = PixelConnectivity.Connectivity8)
Parameters
Type Name Description
PixelConnectivity connectivity

8 or 4 for 8-way or 4-way connectivity respectively

Returns
Type Description
ConnectedComponents
| Improve this Doc View Source

ConnectedComponentsWithStats(OutputArray, OutputArray, OutputArray, PixelConnectivity)

computes the connected components labeled image of boolean image. image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image.

Declaration
public int ConnectedComponentsWithStats(OutputArray labels, OutputArray stats, OutputArray centroids, PixelConnectivity connectivity = PixelConnectivity.Connectivity8)
Parameters
Type Name Description
OutputArray labels

destination labeled image

OutputArray stats

statistics output for each label, including the background label, see below for available statistics. Statistics are accessed via stats(label, COLUMN) where COLUMN is one of cv::ConnectedComponentsTypes

OutputArray centroids

floating point centroid (x,y) output for each label, including the background label

PixelConnectivity connectivity

8 or 4 for 8-way or 4-way connectivity respectively

Returns
Type Description
System.Int32
| Improve this Doc View Source

ConnectedComponentsWithStats(OutputArray, OutputArray, OutputArray, PixelConnectivity, MatType)

computes the connected components labeled image of boolean image. image with 4 or 8 way connectivity - returns N, the total number of labels [0, N-1] where 0 represents the background label. ltype specifies the output label image type, an important consideration based on the total number of labels or alternatively the total number of pixels in the source image.

Declaration
public int ConnectedComponentsWithStats(OutputArray labels, OutputArray stats, OutputArray centroids, PixelConnectivity connectivity, MatType ltype)
Parameters
Type Name Description
OutputArray labels

destination labeled image

OutputArray stats

statistics output for each label, including the background label, see below for available statistics. Statistics are accessed via stats(label, COLUMN) where COLUMN is one of cv::ConnectedComponentsTypes

OutputArray centroids

floating point centroid (x,y) output for each label, including the background label

PixelConnectivity connectivity

8 or 4 for 8-way or 4-way connectivity respectively

OpenCvSharp.MatType ltype

output image label type. Currently CV_32S and CV_16U are supported.

Returns
Type Description
System.Int32
| Improve this Doc View Source

ContourArea(Boolean)

Calculates the contour area. The input is 2D point set, represented by CV_32SC2 or CV_32FC2 matrix.

Declaration
public double ContourArea(bool oriented = false)
Parameters
Type Name Description
System.Boolean oriented
Returns
Type Description
System.Double
| Improve this Doc View Source

ConvertScaleAbs(Double, Double)

Scales, computes absolute values and converts the result to 8-bit.

Declaration
public Mat ConvertScaleAbs(double alpha = 1, double beta = 0)
Parameters
Type Name Description
System.Double alpha

The optional scale factor. [By default this is 1]

System.Double beta

The optional delta added to the scaled values. [By default this is 0]

Returns
Type Description
Mat
| Improve this Doc View Source

ConvertTo(OutputArray, MatType, Double, Double)

Converts an array to another data type with optional scaling.

Declaration
public void ConvertTo(OutputArray m, MatType rtype, double alpha = 1, double beta = 0)
Parameters
Type Name Description
OutputArray m

output matrix; if it does not have a proper size or type before the operation, it is reallocated.

OpenCvSharp.MatType rtype

desired output matrix type or, rather, the depth since the number of channels are the same as the input has; if rtype is negative, the output matrix will have the same type as the input.

System.Double alpha

optional scale factor.

System.Double beta

optional delta added to the scaled values.

| Improve this Doc View Source

ConvexHull(Boolean, Boolean)

Computes convex hull for a set of 2D points.

Declaration
public Mat ConvexHull(bool clockwise = false, bool returnPoints = true)
Parameters
Type Name Description
System.Boolean clockwise

If true, the output convex hull will be oriented clockwise, otherwise it will be oriented counter-clockwise. Here, the usual screen coordinate system is assumed - the origin is at the top-left corner, x axis is oriented to the right, and y axis is oriented downwards.

System.Boolean returnPoints
Returns
Type Description
Mat

The output convex hull. It is either a vector of points that form the hull (must have the same type as the input points), or a vector of 0-based point indices of the hull points in the original array (since the set of convex hull points is a subset of the original point set).

| Improve this Doc View Source

ConvexHullFloatPoints(Boolean)

Computes convex hull for a set of 2D points.

Declaration
public Point2f[] ConvexHullFloatPoints(bool clockwise = false)
Parameters
Type Name Description
System.Boolean clockwise

If true, the output convex hull will be oriented clockwise, otherwise it will be oriented counter-clockwise. Here, the usual screen coordinate system is assumed - the origin is at the top-left corner, x axis is oriented to the right, and y axis is oriented downwards.

Returns
Type Description
OpenCvSharp.Point2f[]

The output convex hull. It is a vector of points that form the hull (must have the same type as the input points).

| Improve this Doc View Source

ConvexHullIndices(Boolean)

Computes convex hull for a set of 2D points.

Declaration
public int[] ConvexHullIndices(bool clockwise = false)
Parameters
Type Name Description
System.Boolean clockwise

If true, the output convex hull will be oriented clockwise, otherwise it will be oriented counter-clockwise. Here, the usual screen coordinate system is assumed - the origin is at the top-left corner, x axis is oriented to the right, and y axis is oriented downwards.

Returns
Type Description
System.Int32[]

The output convex hull. It is a vector of 0-based point indices of the hull points in the original array (since the set of convex hull points is a subset of the original point set).

| Improve this Doc View Source

ConvexHullPoints(Boolean)

Computes convex hull for a set of 2D points.

Declaration
public Point[] ConvexHullPoints(bool clockwise = false)
Parameters
Type Name Description
System.Boolean clockwise

If true, the output convex hull will be oriented clockwise, otherwise it will be oriented counter-clockwise. Here, the usual screen coordinate system is assumed - the origin is at the top-left corner, x axis is oriented to the right, and y axis is oriented downwards.

Returns
Type Description
OpenCvSharp.Point[]

The output convex hull. It is a vector of points that form the hull (must have the same type as the input points).

| Improve this Doc View Source

ConvexityDefects(InputArray)

Computes the contour convexity defects

Declaration
public Mat ConvexityDefects(InputArray convexHull)
Parameters
Type Name Description
InputArray convexHull

Convex hull obtained using convexHull() that should contain indices of the contour points that make the hull.

Returns
Type Description
Mat

The output vector of convexity defects. Each convexity defect is represented as 4-element integer vector (a.k.a. cv::Vec4i): (start_index, end_index, farthest_pt_index, fixpt_depth), where indices are 0-based indices in the original contour of the convexity defect beginning, end and the farthest point, and fixpt_depth is fixed-point approximation (with 8 fractional bits) of the distance between the farthest contour point and the hull. That is, to get the floating-point value of the depth will be fixpt_depth/256.0.

| Improve this Doc View Source

ConvexityDefectsAsVec(InputArray)

Computes the contour convexity defects

Declaration
public Vec4i[] ConvexityDefectsAsVec(InputArray convexHull)
Parameters
Type Name Description
InputArray convexHull

Convex hull obtained using convexHull() that should contain indices of the contour points that make the hull.

Returns
Type Description
Vec4i[]

The output vector of convexity defects. Each convexity defect is represented as 4-element integer vector (a.k.a. cv::Vec4i): (start_index, end_index, farthest_pt_index, fixpt_depth), where indices are 0-based indices in the original contour of the convexity defect beginning, end and the farthest point, and fixpt_depth is fixed-point approximation (with 8 fractional bits) of the distance between the farthest contour point and the hull. That is, to get the floating-point value of the depth will be fixpt_depth/256.0.

| Improve this Doc View Source

CopyMakeBorder(Int32, Int32, Int32, Int32, BorderTypes, Nullable<Scalar>)

Forms a border around the image

Declaration
public Mat CopyMakeBorder(int top, int bottom, int left, int right, BorderTypes borderType, Scalar? value = null)
Parameters
Type Name Description
System.Int32 top

Specify how much pixels in each direction from the source image rectangle one needs to extrapolate

System.Int32 bottom

Specify how much pixels in each direction from the source image rectangle one needs to extrapolate

System.Int32 left

Specify how much pixels in each direction from the source image rectangle one needs to extrapolate

System.Int32 right

Specify how much pixels in each direction from the source image rectangle one needs to extrapolate

BorderTypes borderType

The border type

System.Nullable<OpenCvSharp.Scalar> value

The border value if borderType == Constant

Returns
Type Description
Mat
| Improve this Doc View Source

CopyTo(Mat, InputArray)

Copies the matrix to another one.

Declaration
public void CopyTo(Mat m, InputArray mask = null)
Parameters
Type Name Description
Mat m

Destination matrix. If it does not have a proper size or type before the operation, it is reallocated.

InputArray mask

Operation mask. Its non-zero elements indicate which matrix elements need to be copied.

| Improve this Doc View Source

CopyTo(OutputArray, InputArray)

Copies the matrix to another one.

Declaration
public void CopyTo(OutputArray m, InputArray mask = null)
Parameters
Type Name Description
OutputArray m

Destination matrix. If it does not have a proper size or type before the operation, it is reallocated.

InputArray mask

Operation mask. Its non-zero elements indicate which matrix elements need to be copied.

| Improve this Doc View Source

CornerEigenValsAndVecs(Int32, Int32, BorderTypes)

computes both eigenvalues and the eigenvectors of 2x2 derivative covariation matrix at each pixel. The output is stored as 6-channel matrix.

Declaration
public Mat CornerEigenValsAndVecs(int blockSize, int ksize, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
System.Int32 blockSize
System.Int32 ksize
BorderTypes borderType
Returns
Type Description
Mat
| Improve this Doc View Source

CornerSubPix(IEnumerable<Point2f>, Size, Size, TermCriteria)

adjusts the corner locations with sub-pixel accuracy to maximize the certain cornerness criteria

Declaration
public Point2f[] CornerSubPix(IEnumerable<Point2f> inputCorners, Size winSize, Size zeroZone, TermCriteria criteria)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point2f> inputCorners

Initial coordinates of the input corners and refined coordinates provided for output.

OpenCvSharp.Size winSize

Half of the side length of the search window.

OpenCvSharp.Size zeroZone

Half of the size of the dead region in the middle of the search zone over which the summation in the formula below is not done. It is used sometimes to avoid possible singularities of the autocorrelation matrix. The value of (-1,-1) indicates that there is no such a size.

OpenCvSharp.TermCriteria criteria

Criteria for termination of the iterative process of corner refinement. That is, the process of corner position refinement stops either after criteria.maxCount iterations or when the corner position moves by less than criteria.epsilon on some iteration.

Returns
Type Description
OpenCvSharp.Point2f[]
| Improve this Doc View Source

CountNonZero()

computes the number of nonzero array elements

Declaration
public int CountNonZero()
Returns
Type Description
System.Int32

number of non-zero elements in mtx

| Improve this Doc View Source

Create(MatType, Int32[])

Allocates new array data if needed.

Declaration
public void Create(MatType type, params int[] sizes)
Parameters
Type Name Description
OpenCvSharp.MatType type

New matrix type.

System.Int32[] sizes

Array of integers specifying a new array shape.

| Improve this Doc View Source

Create(Size, MatType)

Allocates new array data if needed.

Declaration
public void Create(Size size, MatType type)
Parameters
Type Name Description
OpenCvSharp.Size size

Alternative new matrix size specification: Size(cols, rows)

OpenCvSharp.MatType type

New matrix type.

| Improve this Doc View Source

Create(Int32, Int32, MatType)

Allocates new array data if needed.

Declaration
public void Create(int rows, int cols, MatType type)
Parameters
Type Name Description
System.Int32 rows

New number of rows.

System.Int32 cols

New number of columns.

OpenCvSharp.MatType type

New matrix type.

| Improve this Doc View Source

CreateHanningWindow(Size, MatType)

Computes a Hanning window coefficients in two dimensions.

Declaration
public void CreateHanningWindow(Size winSize, MatType type)
Parameters
Type Name Description
OpenCvSharp.Size winSize

The window size specifications

OpenCvSharp.MatType type

Created array type

| Improve this Doc View Source

Cross(InputArray)

Computes a cross-product of two 3-element vectors.

Declaration
public Mat Cross(InputArray m)
Parameters
Type Name Description
InputArray m

Another cross-product operand.

Returns
Type Description
Mat
| Improve this Doc View Source

CvtColor(ColorConversionCodes, Int32)

Converts image from one color space to another

Declaration
public Mat CvtColor(ColorConversionCodes code, int dstCn = 0)
Parameters
Type Name Description
ColorConversionCodes code

The color space conversion code

System.Int32 dstCn

The 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

Returns
Type Description
Mat

The destination image; will have the same size and the same depth as src

| Improve this Doc View Source

Dct(DctFlags)

performs forward or inverse 1D or 2D Discrete Cosine Transformation

Declaration
public Mat Dct(DctFlags flags = DctFlags.None)
Parameters
Type Name Description
DctFlags flags

Transformation flags, a combination of DctFlag2 values

Returns
Type Description
Mat

The destination array; will have the same size and same type as src

| Improve this Doc View Source

Depth()

Returns the depth of a matrix element.

Declaration
public int Depth()
Returns
Type Description
System.Int32
| Improve this Doc View Source

Determinant()

computes determinant of a square matrix. The input matrix must have CV_32FC1 or CV_64FC1 type and square size.

Declaration
public double Determinant()
Returns
Type Description
System.Double

determinant of the specified matrix.

| Improve this Doc View Source

Dft(DftFlags, Int32)

Performs a forward Discrete Fourier transform of 1D or 2D floating-point array.

Declaration
public Mat Dft(DftFlags flags = DftFlags.None, int nonzeroRows = 0)
Parameters
Type Name Description
DftFlags flags

Transformation flags, a combination of the DftFlag2 values

System.Int32 nonzeroRows

When the parameter != 0, the function assumes that only the first nonzeroRows rows of the input array ( DFT_INVERSE is not set) or only the first nonzeroRows of the output array ( DFT_INVERSE is set) contain non-zeros, thus the function can handle the rest of the rows more efficiently and thus save some time. This technique is very useful for computing array cross-correlation or convolution using DFT

Returns
Type Description
Mat

The destination array, which size and type depends on the flags

| Improve this Doc View Source

Diag(Mat)

Extracts a diagonal from a matrix, or creates a diagonal matrix.

Declaration
public static Mat Diag(Mat d)
Parameters
Type Name Description
Mat d

One-dimensional matrix that represents the main diagonal.

Returns
Type Description
Mat
| Improve this Doc View Source

Diag(MatDiagType)

Single-column matrix that forms a diagonal matrix or index of the diagonal, with the following values:

Declaration
public Mat Diag(MatDiagType d = MatDiagType.Main)
Parameters
Type Name Description
MatDiagType d

Single-column matrix that forms a diagonal matrix or index of the diagonal, with the following values:

Returns
Type Description
Mat
| Improve this Doc View Source

Dilate(InputArray, Nullable<Point>, Int32, BorderTypes, Nullable<Scalar>)

Dilates an image by using a specific structuring element.

Declaration
public Mat Dilate(InputArray element, Point? anchor = null, int iterations = 1, BorderTypes borderType = BorderTypes.Constant, Scalar? borderValue = null)
Parameters
Type Name Description
InputArray element

The structuring element used for dilation. If element=new Mat() , a 3x3 rectangular structuring element is used

System.Nullable<OpenCvSharp.Point> anchor

Position of the anchor within the element. The default value (-1, -1) means that the anchor is at the element center

System.Int32 iterations

The number of times dilation is applied. [By default this is 1]

BorderTypes borderType

The pixel extrapolation method. [By default this is BorderTypes.Constant]

System.Nullable<OpenCvSharp.Scalar> borderValue

The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()]

Returns
Type Description
Mat

The destination image. It will have the same size and the same type as src

| Improve this Doc View Source

DisposeManaged()

Releases managed resources

Declaration
protected override void DisposeManaged()
Overrides
DisposableObject.DisposeManaged()
| Improve this Doc View Source

DisposeUnmanaged()

Releases unmanaged resources

Declaration
protected override void DisposeUnmanaged()
Overrides
DisposableCvObject.DisposeUnmanaged()
| Improve this Doc View Source

DistanceTransform(DistanceTypes, DistanceTransformMasks)

Computes the distance transform map

Declaration
public Mat<float> DistanceTransform(DistanceTypes distanceType, DistanceTransformMasks maskSize)
Parameters
Type Name Description
DistanceTypes distanceType
DistanceTransformMasks maskSize
Returns
Type Description
Mat<System.Single>
| Improve this Doc View Source

Divide(Mat)

Declaration
public MatExpr Divide(Mat m)
Parameters
Type Name Description
Mat m
Returns
Type Description
MatExpr
| Improve this Doc View Source

Divide(Double)

Declaration
public MatExpr Divide(double s)
Parameters
Type Name Description
System.Double s
Returns
Type Description
MatExpr
| Improve this Doc View Source

Dot(InputArray)

Computes a dot-product of two vectors.

Declaration
public double Dot(InputArray m)
Parameters
Type Name Description
InputArray m

another dot-product operand.

Returns
Type Description
System.Double
| Improve this Doc View Source

DrawContours(IEnumerable<IEnumerable<Point>>, Int32, Scalar, Int32, LineTypes, Nullable<IEnumerable<HierarchyIndex>>, Int32, Nullable<Point>)

Draws contours in the image

Declaration
public void DrawContours(IEnumerable<IEnumerable<Point>> contours, int contourIdx, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, IEnumerable<HierarchyIndex>? hierarchy = null, int maxLevel = 2147483647, Point? offset = null)
Parameters
Type Name Description
IEnumerable<IEnumerable<OpenCvSharp.Point>> contours

All the input contours. Each contour is stored as a point vector.

System.Int32 contourIdx

Parameter indicating a contour to draw. If it is negative, all the contours are drawn.

OpenCvSharp.Scalar color

Color of the contours.

System.Int32 thickness

Thickness of lines the contours are drawn with. If it is negative (for example, thickness=CV_FILLED ), the contour interiors are drawn.

LineTypes lineType

Line connectivity.

System.Nullable<IEnumerable<HierarchyIndex>> hierarchy

Optional information about hierarchy. It is only needed if you want to draw only some of the contours

System.Int32 maxLevel

Maximal level for drawn contours. If it is 0, only the specified contour is drawn. If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This parameter is only taken into account when there is hierarchy available.

System.Nullable<OpenCvSharp.Point> offset

Optional contour shift parameter. Shift all the drawn contours by the specified offset = (dx, dy)

| Improve this Doc View Source

DrawContours(IEnumerable<Mat>, Int32, Scalar, Int32, LineTypes, Mat, Int32, Nullable<Point>)

Draws contours in the image

Declaration
public void DrawContours(IEnumerable<Mat> contours, int contourIdx, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, Mat hierarchy = null, int maxLevel = 2147483647, Point? offset = null)
Parameters
Type Name Description
IEnumerable<Mat> contours

All the input contours. Each contour is stored as a point vector.

System.Int32 contourIdx

Parameter indicating a contour to draw. If it is negative, all the contours are drawn.

OpenCvSharp.Scalar color

Color of the contours.

System.Int32 thickness

Thickness of lines the contours are drawn with. If it is negative (for example, thickness=CV_FILLED ), the contour interiors are drawn.

LineTypes lineType

Line connectivity.

Mat hierarchy

Optional information about hierarchy. It is only needed if you want to draw only some of the contours

System.Int32 maxLevel

Maximal level for drawn contours. If it is 0, only the specified contour is drawn. If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This parameter is only taken into account when there is hierarchy available.

System.Nullable<OpenCvSharp.Point> offset

Optional contour shift parameter. Shift all the drawn contours by the specified offset = (dx, dy)

| Improve this Doc View Source

DrawMarker(Point, Scalar, MarkerTypes, Int32, Int32, LineTypes)

Draws a marker on a predefined position in an image.

The function cv::drawMarker draws a marker on a given position in the image.For the moment several marker types are supported, see #MarkerTypes for more information.

Declaration
public void DrawMarker(Point position, Scalar color, MarkerTypes markerType = MarkerTypes.Cross, int markerSize = 20, int thickness = 1, LineTypes lineType = LineTypes.Link8)
Parameters
Type Name Description
OpenCvSharp.Point position

The point where the crosshair is positioned.

OpenCvSharp.Scalar color

Line color.

MarkerTypes markerType

The specific type of marker you want to use.

System.Int32 markerSize

The length of the marker axis [default = 20 pixels]

System.Int32 thickness

Line thickness.

LineTypes lineType

Type of the line.

| Improve this Doc View Source

Dump(FormatType)

Returns a string that represents each element value of Mat. This method corresponds to std::ostream << Mat

Declaration
public string Dump(FormatType format = FormatType.Default)
Parameters
Type Name Description
FormatType format
Returns
Type Description
System.String
| Improve this Doc View Source

ElemSize()

Returns the matrix element size in bytes.

Declaration
public int ElemSize()
Returns
Type Description
System.Int32
| Improve this Doc View Source

ElemSize1()

Returns the size of each matrix element channel in bytes.

Declaration
public int ElemSize1()
Returns
Type Description
System.Int32
| Improve this Doc View Source

Ellipse(Point, Size, Double, Double, Double, Scalar, Int32, LineTypes, Int32)

Draws simple or thick elliptic arc or fills ellipse sector

Declaration
public void Ellipse(Point center, Size axes, double angle, double startAngle, double endAngle, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0)
Parameters
Type Name Description
OpenCvSharp.Point center

Center of the ellipse.

OpenCvSharp.Size axes

Length of the ellipse axes.

System.Double angle

Rotation angle.

System.Double startAngle

Starting angle of the elliptic arc.

System.Double endAngle

Ending angle of the elliptic arc.

OpenCvSharp.Scalar color

Ellipse color.

System.Int32 thickness

Thickness of the ellipse arc. [By default this is 1]

LineTypes lineType

Type of the ellipse boundary. [By default this is LineType.Link8]

System.Int32 shift

Number of fractional bits in the center coordinates and axes' values. [By default this is 0]

| Improve this Doc View Source

Ellipse(RotatedRect, Scalar, Int32, LineTypes)

Draws simple or thick elliptic arc or fills ellipse sector

Declaration
public void Ellipse(RotatedRect box, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8)
Parameters
Type Name Description
OpenCvSharp.RotatedRect box

The enclosing box of the ellipse drawn

OpenCvSharp.Scalar color

Ellipse color.

System.Int32 thickness

Thickness of the ellipse boundary. [By default this is 1]

LineTypes lineType

Type of the ellipse boundary. [By default this is LineType.Link8]

| Improve this Doc View Source

Empty()

Returns true if the array has no elements.

Declaration
public bool Empty()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

EmptyClone()

Makes a Mat that have the same size, depth and channels as this image

Declaration
public Mat EmptyClone()
Returns
Type Description
Mat
| Improve this Doc View Source

EqualizeHist()

Normalizes the grayscale image brightness and contrast by normalizing its histogram. The source matrix is 8-bit single channel image.

Declaration
public Mat EqualizeHist()
Returns
Type Description
Mat

The destination image; will have the same size and the same type as src

| Improve this Doc View Source

Equals(Mat)

operator ==

Declaration
public MatExpr Equals(Mat m)
Parameters
Type Name Description
Mat m
Returns
Type Description
MatExpr
| Improve this Doc View Source

Equals(Double)

operator ==

Declaration
public MatExpr Equals(double d)
Parameters
Type Name Description
System.Double d
Returns
Type Description
MatExpr
| Improve this Doc View Source

Erode(InputArray, Nullable<Point>, Int32, BorderTypes, Nullable<Scalar>)

Erodes an image by using a specific structuring element.

Declaration
public Mat Erode(InputArray element, Point? anchor = null, int iterations = 1, BorderTypes borderType = BorderTypes.Constant, Scalar? borderValue = null)
Parameters
Type Name Description
InputArray element

The structuring element used for dilation. If element=new Mat(), a 3x3 rectangular structuring element is used

System.Nullable<OpenCvSharp.Point> anchor

Position of the anchor within the element. The default value (-1, -1) means that the anchor is at the element center

System.Int32 iterations

The number of times erosion is applied

BorderTypes borderType

The pixel extrapolation method

System.Nullable<OpenCvSharp.Scalar> borderValue

The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()]

Returns
Type Description
Mat

The destination image. It will have the same size and the same type as src

| Improve this Doc View Source

Exp()

computes exponent of each matrix element (dst = e**src)

Declaration
public Mat Exp()
Returns
Type Description
Mat

The destination array; will have the same size and same type as src

| Improve this Doc View Source

ExtractChannel(Int32)

extracts a single channel from src (coi is 0-based index)

Declaration
public Mat ExtractChannel(int coi)
Parameters
Type Name Description
System.Int32 coi
Returns
Type Description
Mat
| Improve this Doc View Source

Eye(Size, MatType)

Returns an identity matrix of the specified size and type.

Declaration
public static MatExpr Eye(Size size, MatType type)
Parameters
Type Name Description
OpenCvSharp.Size size

Alternative to the matrix size specification Size(cols, rows) .

OpenCvSharp.MatType type

Created matrix type.

Returns
Type Description
MatExpr
| Improve this Doc View Source

Eye(Int32, Int32, MatType)

Returns an identity matrix of the specified size and type.

Declaration
public static MatExpr Eye(int rows, int cols, MatType type)
Parameters
Type Name Description
System.Int32 rows

Number of rows.

System.Int32 cols

Number of columns.

OpenCvSharp.MatType type

Created matrix type.

Returns
Type Description
MatExpr
| Improve this Doc View Source

FillConvexPoly(IEnumerable<Point>, Scalar, LineTypes, Int32)

Fills a convex polygon.

Declaration
public void FillConvexPoly(IEnumerable<Point> pts, Scalar color, LineTypes lineType = LineTypes.Link8, int shift = 0)
Parameters
Type Name Description
IEnumerable<OpenCvSharp.Point> pts

The polygon vertices

OpenCvSharp.Scalar color

Polygon color

LineTypes lineType

Type of the polygon boundaries

System.Int32 shift

The number of fractional bits in the vertex coordinates

| Improve this Doc View Source

FillPoly(IEnumerable<IEnumerable<Point>>, Scalar, LineTypes, Int32, Nullable<Point>)

Fills the area bounded by one or more polygons

Declaration
public void FillPoly(IEnumerable<IEnumerable<Point>> pts, Scalar color, LineTypes lineType = LineTypes.Link8, int shift = 0, Point? offset = null)
Parameters
Type Name Description
IEnumerable<IEnumerable<OpenCvSharp.Point>> pts

Array of polygons, each represented as an array of points

OpenCvSharp.Scalar color

Polygon color

LineTypes lineType

Type of the polygon boundaries

System.Int32 shift

The number of fractional bits in the vertex coordinates

System.Nullable<OpenCvSharp.Point> offset
| Improve this Doc View Source

Filter2D(MatType, InputArray, Nullable<Point>, Double, BorderTypes)

Convolves an image with the kernel

Declaration
public Mat Filter2D(MatType ddepth, InputArray kernel, Point? anchor = null, double delta = 0, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
OpenCvSharp.MatType ddepth

The desired depth of the destination image. If it is negative, it will be the same as src.depth()

InputArray kernel

Convolution kernel (or rather a correlation kernel), a single-channel floating point matrix. If you want to apply different kernels to different channels, split the image into separate color planes using split() and process them individually

System.Nullable<OpenCvSharp.Point> anchor

The anchor of the kernel that indicates the relative position of a filtered point within the kernel. The anchor should lie within the kernel. The special default value (-1,-1) means that the anchor is at the kernel center

System.Double delta

The optional value added to the filtered pixels before storing them in dst

BorderTypes borderType

The pixel extrapolation method

Returns
Type Description
Mat

The destination image. It will have the same size and the same number of channels as src

| Improve this Doc View Source

FindContours(out Mat[], OutputArray, RetrievalModes, ContourApproximationModes, Nullable<Point>)

Finds contours in a binary image. The source is an 8-bit single-channel image. Non-zero pixels are treated as 1’s. Zero pixels remain 0’s, so the image is treated as binary. The function modifies this image while extracting the contours.

Declaration
public void FindContours(out Mat[] contours, OutputArray hierarchy, RetrievalModes mode, ContourApproximationModes method, Point? offset = null)
Parameters
Type Name Description
Mat[] contours

Detected contours. Each contour is stored as a vector of points.

OutputArray hierarchy

Optional output vector, containing information about the image topology. It has as many elements as the number of contours. For each i-th contour contours[i], the members of the elements hierarchy[i] are set to 0-based indices in contours of the next and previous contours at the same hierarchical level, the first child contour and the parent contour, respectively. If for the contour i there are no next, previous, parent, or nested contours, the corresponding elements of hierarchy[i] will be negative.

RetrievalModes mode

Contour retrieval mode

ContourApproximationModes method

Contour approximation method

System.Nullable<OpenCvSharp.Point> offset

Optional offset by which every contour point is shifted. This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context.

| Improve this Doc View Source

FindContours(out Point[][], out HierarchyIndex[], RetrievalModes, ContourApproximationModes, Nullable<Point>)

Finds contours in a binary image. The source is an 8-bit single-channel image. Non-zero pixels are treated as 1’s. Zero pixels remain 0’s, so the image is treated as binary. The function modifies this image while extracting the contours.

Declaration
public void FindContours(out Point[][] contours, out HierarchyIndex[] hierarchy, RetrievalModes mode, ContourApproximationModes method, Point? offset = null)
Parameters
Type Name Description
OpenCvSharp.Point[][] contours

Detected contours. Each contour is stored as a vector of points.

HierarchyIndex[] hierarchy

Optional output vector, containing information about the image topology. It has as many elements as the number of contours. For each i-th contour contours[i], the members of the elements hierarchy[i] are set to 0-based indices in contours of the next and previous contours at the same hierarchical level, the first child contour and the parent contour, respectively. If for the contour i there are no next, previous, parent, or nested contours, the corresponding elements of hierarchy[i] will be negative.

RetrievalModes mode

Contour retrieval mode

ContourApproximationModes method

Contour approximation method

System.Nullable<OpenCvSharp.Point> offset

Optional offset by which every contour point is shifted. This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context.

| Improve this Doc View Source

FindContoursAsArray(RetrievalModes, ContourApproximationModes, Nullable<Point>)

Finds contours in a binary image. The source is an 8-bit single-channel image. Non-zero pixels are treated as 1’s. Zero pixels remain 0’s, so the image is treated as binary. The function modifies this image while extracting the contours.

Declaration
public Point[][] FindContoursAsArray(RetrievalModes mode, ContourApproximationModes method, Point? offset = null)
Parameters
Type Name Description
RetrievalModes mode

Contour retrieval mode

ContourApproximationModes method

Contour approximation method

System.Nullable<OpenCvSharp.Point> offset

Optional offset by which every contour point is shifted. This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context.

Returns
Type Description
OpenCvSharp.Point[][]

Detected contours. Each contour is stored as a vector of points.

| Improve this Doc View Source

FindContoursAsMat(RetrievalModes, ContourApproximationModes, Nullable<Point>)

Finds contours in a binary image. The source is an 8-bit single-channel image. Non-zero pixels are treated as 1’s. Zero pixels remain 0’s, so the image is treated as binary. The function modifies this image while extracting the contours.

Declaration
public Mat<Point>[] FindContoursAsMat(RetrievalModes mode, ContourApproximationModes method, Point? offset = null)
Parameters
Type Name Description
RetrievalModes mode

Contour retrieval mode

ContourApproximationModes method

Contour approximation method

System.Nullable<OpenCvSharp.Point> offset

Optional offset by which every contour point is shifted. This is useful if the contours are extracted from the image ROI and then they should be analyzed in the whole image context.

Returns
Type Description
Mat<OpenCvSharp.Point>[]

Detected contours. Each contour is stored as a vector of points.

| Improve this Doc View Source

FindNonZero()

returns the list of locations of non-zero pixels

Declaration
public Mat FindNonZero()
Returns
Type Description
Mat
| Improve this Doc View Source

FitEllipse()

Fits ellipse to the set of 2D points.

Declaration
public RotatedRect FitEllipse()
Returns
Type Description
OpenCvSharp.RotatedRect
| Improve this Doc View Source

FitLine2D(DistanceTypes, Double, Double, Double)

Fits line to the set of 2D points using M-estimator algorithm. The input is vector of 2D points.

Declaration
public Line2D FitLine2D(DistanceTypes distType, double param, double reps, double aeps)
Parameters
Type Name Description
DistanceTypes distType

Distance used by the M-estimator

System.Double param

Numerical parameter ( C ) for some types of distances. If it is 0, an optimal value is chosen.

System.Double reps

Sufficient accuracy for the radius (distance between the coordinate origin and the line).

System.Double aeps

Sufficient accuracy for the angle. 0.01 would be a good default value for reps and aeps.

Returns
Type Description
Line2D

Output line parameters.

| Improve this Doc View Source

FitLine3D(DistanceTypes, Double, Double, Double)

Fits line to the set of 3D points using M-estimator algorithm. The input is vector of 3D points.

Declaration
public Line3D FitLine3D(DistanceTypes distType, double param, double reps, double aeps)
Parameters
Type Name Description
DistanceTypes distType

Distance used by the M-estimator

System.Double param

Numerical parameter ( C ) for some types of distances. If it is 0, an optimal value is chosen.

System.Double reps

Sufficient accuracy for the radius (distance between the coordinate origin and the line).

System.Double aeps

Sufficient accuracy for the angle. 0.01 would be a good default value for reps and aeps.

Returns
Type Description
Line3D

Output line parameters.

| Improve this Doc View Source

Flip(FlipMode)

reverses the order of the rows, columns or both in a matrix

Declaration
public Mat Flip(FlipMode flipCode)
Parameters
Type Name Description
FlipMode flipCode

Specifies how to flip the array: 0 means flipping around the x-axis, positive (e.g., 1) means flipping around y-axis, and negative (e.g., -1) means flipping around both axes. See also the discussion below for the formulas.

Returns
Type Description
Mat

The destination array; will have the same size and same type as src

| Improve this Doc View Source

FloodFill(InputOutputArray, Point, Scalar)

Fills a connected component with the given color. Input/output 1- or 3-channel, 8-bit, or floating-point image. It is modified by the function unless the FLOODFILL_MASK_ONLY flag is set in the second variant of the function. See the details below.

Declaration
public int FloodFill(InputOutputArray mask, Point seedPoint, Scalar newVal)
Parameters
Type Name Description
InputOutputArray mask

(For the second function only) Operation mask that should be a single-channel 8-bit image, 2 pixels wider and 2 pixels taller. The function uses and updates the mask, so you take responsibility of initializing the mask content. Flood-filling cannot go across non-zero pixels in the mask. For example, an edge detector output can be used as a mask to stop filling at edges. It is possible to use the same mask in multiple calls to the function to make sure the filled area does not overlap.

OpenCvSharp.Point seedPoint

Starting point.

OpenCvSharp.Scalar newVal

New value of the repainted domain pixels.

Returns
Type Description
System.Int32
| Improve this Doc View Source

FloodFill(InputOutputArray, Point, Scalar, out Rect, Nullable<Scalar>, Nullable<Scalar>, FloodFillFlags)

Fills a connected component with the given color. Input/output 1- or 3-channel, 8-bit, or floating-point image. It is modified by the function unless the FLOODFILL_MASK_ONLY flag is set in the second variant of the function. See the details below.

Declaration
public int FloodFill(InputOutputArray mask, Point seedPoint, Scalar newVal, out Rect rect, Scalar? loDiff = null, Scalar? upDiff = null, FloodFillFlags flags = FloodFillFlags.Link4)
Parameters
Type Name Description
InputOutputArray mask

(For the second function only) Operation mask that should be a single-channel 8-bit image, 2 pixels wider and 2 pixels taller. The function uses and updates the mask, so you take responsibility of initializing the mask content. Flood-filling cannot go across non-zero pixels in the mask. For example, an edge detector output can be used as a mask to stop filling at edges. It is possible to use the same mask in multiple calls to the function to make sure the filled area does not overlap.

OpenCvSharp.Point seedPoint

Starting point.

OpenCvSharp.Scalar newVal

New value of the repainted domain pixels.

OpenCvSharp.Rect rect

Optional output parameter set by the function to the minimum bounding rectangle of the repainted domain.

System.Nullable<OpenCvSharp.Scalar> loDiff

Maximal lower brightness/color difference between the currently observed pixel and one of its neighbors belonging to the component, or a seed pixel being added to the component.

System.Nullable<OpenCvSharp.Scalar> upDiff

Maximal upper brightness/color difference between the currently observed pixel and one of its neighbors belonging to the component, or a seed pixel being added to the component.

FloodFillFlags flags

Operation flags. Lower bits contain a connectivity value, 4 (default) or 8, used within the function. Connectivity determines which neighbors of a pixel are considered.

Returns
Type Description
System.Int32
| Improve this Doc View Source

FloodFill(Point, Scalar)

Fills a connected component with the given color. Input/output 1- or 3-channel, 8-bit, or floating-point image. It is modified by the function unless the FLOODFILL_MASK_ONLY flag is set in the second variant of the function. See the details below.

Declaration
public int FloodFill(Point seedPoint, Scalar newVal)
Parameters
Type Name Description
OpenCvSharp.Point seedPoint

Starting point.

OpenCvSharp.Scalar newVal

New value of the repainted domain pixels.

Returns
Type Description
System.Int32
| Improve this Doc View Source

FloodFill(Point, Scalar, out Rect, Nullable<Scalar>, Nullable<Scalar>, FloodFillFlags)

Fills a connected component with the given color. Input/output 1- or 3-channel, 8-bit, or floating-point image. It is modified by the function unless the FLOODFILL_MASK_ONLY flag is set in the second variant of the function. See the details below.

Declaration
public int FloodFill(Point seedPoint, Scalar newVal, out Rect rect, Scalar? loDiff = null, Scalar? upDiff = null, FloodFillFlags flags = FloodFillFlags.Link4)
Parameters
Type Name Description
OpenCvSharp.Point seedPoint

Starting point.

OpenCvSharp.Scalar newVal

New value of the repainted domain pixels.

OpenCvSharp.Rect rect

Optional output parameter set by the function to the minimum bounding rectangle of the repainted domain.

System.Nullable<OpenCvSharp.Scalar> loDiff

Maximal lower brightness/color difference between the currently observed pixel and one of its neighbors belonging to the component, or a seed pixel being added to the component.

System.Nullable<OpenCvSharp.Scalar> upDiff

Maximal upper brightness/color difference between the currently observed pixel and one of its neighbors belonging to the component, or a seed pixel being added to the component.

FloodFillFlags flags

Operation flags. Lower bits contain a connectivity value, 4 (default) or 8, used within the function. Connectivity determines which neighbors of a pixel are considered.

Returns
Type Description
System.Int32
| Improve this Doc View Source

ForEachAsByte(MatForeachFunctionByte)

Runs the given functor over all matrix elements in parallel.

Declaration
public void ForEachAsByte(MatForeachFunctionByte operation)
Parameters
Type Name Description
MatForeachFunctionByte operation
| Improve this Doc View Source

ForEachAsDouble(MatForeachFunctionDouble)

Runs the given functor over all matrix elements in parallel.

Declaration
public void ForEachAsDouble(MatForeachFunctionDouble operation)
Parameters
Type Name Description
MatForeachFunctionDouble operation
| Improve this Doc View Source

ForEachAsFloat(MatForeachFunctionFloat)

Runs the given functor over all matrix elements in parallel.

Declaration
public void ForEachAsFloat(MatForeachFunctionFloat operation)
Parameters
Type Name Description
MatForeachFunctionFloat operation
| Improve this Doc View Source

ForEachAsInt16(MatForeachFunctionInt16)

Runs the given functor over all matrix elements in parallel.

Declaration
public void ForEachAsInt16(MatForeachFunctionInt16 operation)
Parameters
Type Name Description
MatForeachFunctionInt16 operation
| Improve this Doc View Source

ForEachAsInt32(MatForeachFunctionInt32)

Runs the given functor over all matrix elements in parallel.

Declaration
public void ForEachAsInt32(MatForeachFunctionInt32 operation)
Parameters
Type Name Description
MatForeachFunctionInt32 operation
| Improve this Doc View Source

ForEachAsVec2b(MatForeachFunctionVec2b)

Runs the given functor over all matrix elements in parallel.

Declaration
public void ForEachAsVec2b(MatForeachFunctionVec2b operation)
Parameters
Type Name Description
MatForeachFunctionVec2b operation
| Improve this Doc View Source

ForEachAsVec2d(MatForeachFunctionVec2d)

Runs the given functor over all matrix elements in parallel.

Declaration
public void ForEachAsVec2d(MatForeachFunctionVec2d operation)
Parameters
Type Name Description
MatForeachFunctionVec2d operation
| Improve this Doc View Source

ForEachAsVec2f(MatForeachFunctionVec2f)

Runs the given functor over all matrix elements in parallel.

Declaration
public void ForEachAsVec2f(MatForeachFunctionVec2f operation)
Parameters
Type Name Description
MatForeachFunctionVec2f operation
| Improve this Doc View Source

ForEachAsVec2i(MatForeachFunctionVec2i)

Runs the given functor over all matrix elements in parallel.

Declaration
public void ForEachAsVec2i(MatForeachFunctionVec2i operation)
Parameters
Type Name Description
MatForeachFunctionVec2i operation
| Improve this Doc View Source

ForEachAsVec2s(MatForeachFunctionVec2s)

Runs the given functor over all matrix elements in parallel.

Declaration
public void ForEachAsVec2s(MatForeachFunctionVec2s operation)
Parameters
Type Name Description
MatForeachFunctionVec2s operation
| Improve this Doc View Source

ForEachAsVec3b(MatForeachFunctionVec3b)

Runs the given functor over all matrix elements in parallel.

Declaration
public void ForEachAsVec3b(MatForeachFunctionVec3b operation)
Parameters
Type Name Description
MatForeachFunctionVec3b operation
| Improve this Doc View Source

ForEachAsVec3d(MatForeachFunctionVec3d)

Runs the given functor over all matrix elements in parallel.

Declaration
public void ForEachAsVec3d(MatForeachFunctionVec3d operation)
Parameters
Type Name Description
MatForeachFunctionVec3d operation
| Improve this Doc View Source

ForEachAsVec3f(MatForeachFunctionVec3f)

Runs the given functor over all matrix elements in parallel.

Declaration
public void ForEachAsVec3f(MatForeachFunctionVec3f operation)
Parameters
Type Name Description
MatForeachFunctionVec3f operation
| Improve this Doc View Source

ForEachAsVec3i(MatForeachFunctionVec3i)

Runs the given functor over all matrix elements in parallel.

Declaration
public void ForEachAsVec3i(MatForeachFunctionVec3i operation)
Parameters
Type Name Description
MatForeachFunctionVec3i operation
| Improve this Doc View Source

ForEachAsVec3s(MatForeachFunctionVec3s)

Runs the given functor over all matrix elements in parallel.

Declaration
public void ForEachAsVec3s(MatForeachFunctionVec3s operation)
Parameters
Type Name Description
MatForeachFunctionVec3s operation
| Improve this Doc View Source

ForEachAsVec4b(MatForeachFunctionVec4b)

Runs the given functor over all matrix elements in parallel.

Declaration
public void ForEachAsVec4b(MatForeachFunctionVec4b operation)
Parameters
Type Name Description
MatForeachFunctionVec4b operation
| Improve this Doc View Source

ForEachAsVec4d(MatForeachFunctionVec4d)

Runs the given functor over all matrix elements in parallel.

Declaration
public void ForEachAsVec4d(MatForeachFunctionVec4d operation)
Parameters
Type Name Description
MatForeachFunctionVec4d operation
| Improve this Doc View Source

ForEachAsVec4f(MatForeachFunctionVec4f)

Runs the given functor over all matrix elements in parallel.

Declaration
public void ForEachAsVec4f(MatForeachFunctionVec4f operation)
Parameters
Type Name Description
MatForeachFunctionVec4f operation
| Improve this Doc View Source

ForEachAsVec4i(MatForeachFunctionVec4i)

Runs the given functor over all matrix elements in parallel.

Declaration
public void ForEachAsVec4i(MatForeachFunctionVec4i operation)
Parameters
Type Name Description
MatForeachFunctionVec4i operation
| Improve this Doc View Source

ForEachAsVec4s(MatForeachFunctionVec4s)

Runs the given functor over all matrix elements in parallel.

Declaration
public void ForEachAsVec4s(MatForeachFunctionVec4s operation)
Parameters
Type Name Description
MatForeachFunctionVec4s operation
| Improve this Doc View Source

ForEachAsVec6b(MatForeachFunctionVec6b)

Runs the given functor over all matrix elements in parallel.

Declaration
public void ForEachAsVec6b(MatForeachFunctionVec6b operation)
Parameters
Type Name Description
MatForeachFunctionVec6b operation
| Improve this Doc View Source

ForEachAsVec6d(MatForeachFunctionVec6d)

Runs the given functor over all matrix elements in parallel.

Declaration
public void ForEachAsVec6d(MatForeachFunctionVec6d operation)
Parameters
Type Name Description
MatForeachFunctionVec6d operation
| Improve this Doc View Source

ForEachAsVec6f(MatForeachFunctionVec6f)

Runs the given functor over all matrix elements in parallel.

Declaration
public void ForEachAsVec6f(MatForeachFunctionVec6f operation)
Parameters
Type Name Description
MatForeachFunctionVec6f operation
| Improve this Doc View Source

ForEachAsVec6i(MatForeachFunctionVec6i)

Runs the given functor over all matrix elements in parallel.

Declaration
public void ForEachAsVec6i(MatForeachFunctionVec6i operation)
Parameters
Type Name Description
MatForeachFunctionVec6i operation
| Improve this Doc View Source

ForEachAsVec6s(MatForeachFunctionVec6s)

Runs the given functor over all matrix elements in parallel.

Declaration
public void ForEachAsVec6s(MatForeachFunctionVec6s operation)
Parameters
Type Name Description
MatForeachFunctionVec6s operation
| Improve this Doc View Source

FromArray<TElem>(TElem[])

Initializes as N x 1 matrix and copies array data to this

Declaration
public static Mat<TElem> FromArray<TElem>(params TElem[] arr)
    where TElem : struct
Parameters
Type Name Description
TElem[] arr

Source array data to be copied to this

Returns
Type Description
Mat<TElem>
Type Parameters
Name Description
TElem
| Improve this Doc View Source

FromArray<TElem>(TElem[,])

Initializes as M x N matrix and copies array data to this

Declaration
public static Mat<TElem> FromArray<TElem>(TElem[, ] arr)
    where TElem : struct
Parameters
Type Name Description
TElem[,] arr

Source array data to be copied to this

Returns
Type Description
Mat<TElem>
Type Parameters
Name Description
TElem
| Improve this Doc View Source

FromArray<TElem>(IEnumerable<TElem>)

Initializes as N x 1 matrix and copies array data to this

Declaration
public static Mat<TElem> FromArray<TElem>(IEnumerable<TElem> enumerable)
    where TElem : struct
Parameters
Type Name Description
IEnumerable<TElem> enumerable

Source array data to be copied to this

Returns
Type Description
Mat<TElem>
Type Parameters
Name Description
TElem
| Improve this Doc View Source

FromImageData(ReadOnlySpan<Byte>, ImreadModes)

Reads image from the specified buffer in memory.

Declaration
public static Mat FromImageData(ReadOnlySpan<byte> span, ImreadModes mode = ImreadModes.Color)
Parameters
Type Name Description
ReadOnlySpan<System.Byte> span

The input slice of bytes.

ImreadModes mode

The same flags as in imread

Returns
Type Description
Mat
| Improve this Doc View Source

FromImageData(Byte[], ImreadModes)

Creates the Mat instance from image data (using cv::decode)

Declaration
public static Mat FromImageData(byte[] imageBytes, ImreadModes mode = ImreadModes.Color)
Parameters
Type Name Description
System.Byte[] imageBytes
ImreadModes mode
Returns
Type Description
Mat
| Improve this Doc View Source

FromNativePointer(IntPtr)

Creates from native cv::Mat* pointer

Declaration
public static Mat FromNativePointer(IntPtr ptr)
Parameters
Type Name Description
IntPtr ptr
Returns
Type Description
Mat
| Improve this Doc View Source

FromPixelData(IEnumerable<Int32>, MatType, Array, Nullable<IEnumerable<Int64>>)

constructor for matrix headers pointing to user-allocated data

Declaration
public static Mat FromPixelData(IEnumerable<int> sizes, MatType type, Array data, IEnumerable<long>? steps = null)
Parameters
Type Name Description
IEnumerable<System.Int32> sizes

Array of integers specifying an n-dimensional array shape.

OpenCvSharp.MatType type

Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices.

Array data

Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. This operation is very efficient and can be used to process external data using OpenCV functions. The external data is not automatically de-allocated, so you should take care of it.

System.Nullable<IEnumerable<System.Int64>> steps

Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). If not specified, the matrix is assumed to be continuous.

Returns
Type Description
Mat
| Improve this Doc View Source

FromPixelData(IEnumerable<Int32>, MatType, IntPtr, Nullable<IEnumerable<Int64>>)

constructor for matrix headers pointing to user-allocated data

Declaration
public static Mat FromPixelData(IEnumerable<int> sizes, MatType type, IntPtr data, IEnumerable<long>? steps = null)
Parameters
Type Name Description
IEnumerable<System.Int32> sizes

Array of integers specifying an n-dimensional array shape.

OpenCvSharp.MatType type

Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices.

IntPtr data

Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. This operation is very efficient and can be used to process external data using OpenCV functions. The external data is not automatically de-allocated, so you should take care of it.

System.Nullable<IEnumerable<System.Int64>> steps

Array of ndims-1 steps in case of a multi-dimensional array (the last step is always set to the element size). If not specified, the matrix is assumed to be continuous.

Returns
Type Description
Mat
| Improve this Doc View Source

FromPixelData(Int32, Int32, MatType, Array, Int64)

constructor for matrix headers pointing to user-allocated data

Declaration
public static Mat FromPixelData(int rows, int cols, MatType type, Array data, long step = 0L)
Parameters
Type Name Description
System.Int32 rows

Number of rows in a 2D array.

System.Int32 cols

Number of columns in a 2D array.

OpenCvSharp.MatType type

Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices.

Array data

Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. This operation is very efficient and can be used to process external data using OpenCV functions. The external data is not automatically de-allocated, so you should take care of it.

System.Int64 step

Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() .

Returns
Type Description
Mat
| Improve this Doc View Source

FromPixelData(Int32, Int32, MatType, IntPtr, Int64)

constructor for matrix headers pointing to user-allocated data

Declaration
public static Mat FromPixelData(int rows, int cols, MatType type, IntPtr data, long step = 0L)
Parameters
Type Name Description
System.Int32 rows

Number of rows in a 2D array.

System.Int32 cols

Number of columns in a 2D array.

OpenCvSharp.MatType type

Array type. Use MatType.CV_8UC1, ..., CV_64FC4 to create 1-4 channel matrices, or MatType. CV_8UC(n), ..., CV_64FC(n) to create multi-channel matrices.

IntPtr data

Pointer to the user data. Matrix constructors that take data and step parameters do not allocate matrix data. Instead, they just initialize the matrix header that points to the specified data, which means that no data is copied. This operation is very efficient and can be used to process external data using OpenCV functions. The external data is not automatically de-allocated, so you should take care of it.

System.Int64 step

Number of bytes each matrix row occupies. The value should include the padding bytes at the end of each row, if any. If the parameter is missing (set to AUTO_STEP ), no padding is assumed and the actual step is calculated as cols*elemSize() .

Returns
Type Description
Mat
| Improve this Doc View Source

FromStream(Stream, ImreadModes)

Creates the Mat instance from System.IO.Stream

Declaration
public static Mat FromStream(Stream stream, ImreadModes mode)
Parameters
Type Name Description
Stream stream
ImreadModes mode
Returns
Type Description
Mat
| Improve this Doc View Source

GaussianBlur(Size, Double, Double, BorderTypes)

Blurs an image using a Gaussian filter. The input image can have any number of channels, which are processed independently, but the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.

Declaration
public Mat GaussianBlur(Size ksize, double sigmaX, double sigmaY = 0, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
OpenCvSharp.Size ksize

Gaussian kernel size. ksize.width and ksize.height can differ but they both must be positive and odd. Or, they can be zero’s and then they are computed from sigma* .

System.Double sigmaX

Gaussian kernel standard deviation in X direction.

System.Double sigmaY

Gaussian kernel standard deviation in Y direction; if sigmaY is zero, it is set to be equal to sigmaX, if both sigmas are zeros, they are computed from ksize.width and ksize.height, respectively (see getGaussianKernel() for details); to fully control the result regardless of possible future modifications of all this semantics, it is recommended to specify all of ksize, sigmaX, and sigmaY.

BorderTypes borderType

pixel extrapolation method

Returns
Type Description
Mat
| Improve this Doc View Source

Get<T>(Int32)

Returns a value to the specified array element.

Declaration
public T Get<T>(int i0)
    where T : struct
Parameters
Type Name Description
System.Int32 i0

Index along the dimension 0

Returns
Type Description
T

A value to the specified array element.

Type Parameters
Name Description
T
| Improve this Doc View Source

Get<T>(Int32, Int32)

Returns a value to the specified array element.

Declaration
public T Get<T>(int i0, int i1)
    where T : struct
Parameters
Type Name Description
System.Int32 i0

Index along the dimension 0

System.Int32 i1

Index along the dimension 1

Returns
Type Description
T

A value to the specified array element.

Type Parameters
Name Description
T
| Improve this Doc View Source

Get<T>(Int32, Int32, Int32)

Returns a value to the specified array element.

Declaration
public T Get<T>(int i0, int i1, int i2)
    where T : struct
Parameters
Type Name Description
System.Int32 i0

Index along the dimension 0

System.Int32 i1

Index along the dimension 1

System.Int32 i2

Index along the dimension 2

Returns
Type Description
T

A value to the specified array element.

Type Parameters
Name Description
T
| Improve this Doc View Source

Get<T>(Int32[])

Returns a value to the specified array element.

Declaration
public T Get<T>(params int[] idx)
    where T : struct
Parameters
Type Name Description
System.Int32[] idx

Array of Mat::dims indices.

Returns
Type Description
T

A value to the specified array element.

Type Parameters
Name Description
T
| Improve this Doc View Source

GetArray<T>(out T[])

Get the data of this matrix as array

Declaration
[Pure]
public bool GetArray<T>(out T[] data)
    where T : struct
Parameters
Type Name Description
T[] data

Primitive or Vec array to be copied

Returns
Type Description
System.Boolean

Length of copied bytes

Type Parameters
Name Description
T
Examples

using var m1 = new Mat(1, 1, MatType.CV_8UC1); m1.GetArray(out byte[] array);

using var m2 = new Mat(1, 1, MatType.CV_32SC1); m2.GetArray(out int[] array);

using var m3 = new Mat(1, 1, MatType.CV_8UC(6)); m3.GetArray(out Vec6b[] array);

using var m4 = new Mat(1, 1, MatType.CV_64FC4); m4.GetArray(out Vec4d[] array);

| Improve this Doc View Source

GetDefaultNewCameraMatrix(Nullable<Size>, Boolean)

returns the default new camera matrix (by default it is the same as cameraMatrix unless centerPricipalPoint=true)

Declaration
public Mat GetDefaultNewCameraMatrix(Size? imgSize = null, bool centerPrincipalPoint = false)
Parameters
Type Name Description
System.Nullable<OpenCvSharp.Size> imgSize

Camera view image size in pixels.

System.Boolean centerPrincipalPoint

Location of the principal point in the new camera matrix. The parameter indicates whether this location should be at the image center or not.

Returns
Type Description
Mat

the camera matrix that is either an exact copy of the input cameraMatrix (when centerPrinicipalPoint=false), or the modified one (when centerPrincipalPoint=true).

| Improve this Doc View Source

GetGenericIndexer<T>()

Gets a type-specific indexer. The indexer has getters/setters to access each matrix element.

Declaration
public Mat.Indexer<T> GetGenericIndexer<T>()
    where T : struct
Returns
Type Description
Mat.Indexer<T>
Type Parameters
Name Description
T
| Improve this Doc View Source

GetRectangularArray<T>(out T[,])

Get the data of this matrix as array

Declaration
[Pure]
public bool GetRectangularArray<T>(out T[, ] data)
    where T : struct
Parameters
Type Name Description
T[,] data

Primitive or Vec array to be copied

Returns
Type Description
System.Boolean

Length of copied bytes

Type Parameters
Name Description
T
Examples

using var m1 = new Mat(1, 1, MatType.CV_8UC1); m1.GetRectangularArray(out byte[,] array);

using var m2 = new Mat(1, 1, MatType.CV_32SC1); m2.GetRectangularArray(out int[,] array);

using var m3 = new Mat(1, 1, MatType.CV_8UC(6)); m3.GetRectangularArray(out Vec6b[,] array);

using var m4 = new Mat(1, 1, MatType.CV_64FC4); m4.GetRectangularArray(out Vec4d[,] array);

| Improve this Doc View Source

GetRectSubPix(Size, Point2f, Int32)

Retrieves a pixel rectangle from an image with sub-pixel accuracy.

Declaration
public Mat GetRectSubPix(Size patchSize, Point2f center, int patchType = -1)
Parameters
Type Name Description
OpenCvSharp.Size patchSize

Size of the extracted patch.

OpenCvSharp.Point2f center

Floating point coordinates of the center of the extracted rectangle within the source image. The center must be inside the image.

System.Int32 patchType

Depth of the extracted pixels. By default, they have the same depth as src.

Returns
Type Description
Mat

Extracted patch that has the size patchSize and the same number of channels as src .

| Improve this Doc View Source

GetUMat(AccessFlag, UMatUsageFlags)

Retrieve UMat from Mat

Declaration
public UMat GetUMat(AccessFlag accessFlags, UMatUsageFlags usageFlags)
Parameters
Type Name Description
AccessFlag accessFlags
UMatUsageFlags usageFlags
Returns
Type Description
UMat
| Improve this Doc View Source

GetUnsafeGenericIndexer<T>()

Gets a type-specific unsafe indexer. The indexer has getters/setters to access each matrix element.

Declaration
public Mat.UnsafeIndexer<T> GetUnsafeGenericIndexer<T>()
    where T : struct
Returns
Type Description
Mat.UnsafeIndexer<T>
Type Parameters
Name Description
T
| Improve this Doc View Source

GoodFeaturesToTrack(Int32, Double, Double, InputArray, Int32, Boolean, Double)

Finds the strong enough corners where the cornerMinEigenVal() or cornerHarris() report the local maxima. Input matrix must be 8-bit or floating-point 32-bit, single-channel image.

Declaration
public Point2f[] GoodFeaturesToTrack(int maxCorners, double qualityLevel, double minDistance, InputArray mask, int blockSize, bool useHarrisDetector, double k)
Parameters
Type Name Description
System.Int32 maxCorners

Maximum number of corners to return. If there are more corners than are found, the strongest of them is returned.

System.Double qualityLevel

Parameter characterizing the minimal accepted quality of image corners. The parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue or the Harris function response (see cornerHarris() ). The corners with the quality measure less than the product are rejected. For example, if the best corner has the quality measure = 1500, and the qualityLevel=0.01, then all the corners with the quality measure less than 15 are rejected.

System.Double minDistance

Minimum possible Euclidean distance between the returned corners.

InputArray mask

Optional region of interest. If the image is not empty (it needs to have the type CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.

System.Int32 blockSize

Size of an average block for computing a derivative covariation matrix over each pixel neighborhood.

System.Boolean useHarrisDetector

Parameter indicating whether to use a Harris detector

System.Double k

Free parameter of the Harris detector.

Returns
Type Description
OpenCvSharp.Point2f[]

Output vector of detected corners.

| Improve this Doc View Source

GrabCut(InputOutputArray, Rect, InputOutputArray, InputOutputArray, Int32, GrabCutModes)

Segments the image using GrabCut algorithm. The input is 8-bit 3-channel image.

Declaration
public void GrabCut(InputOutputArray mask, Rect rect, InputOutputArray bgdModel, InputOutputArray fgdModel, int iterCount, GrabCutModes mode)
Parameters
Type Name Description
InputOutputArray mask

Input/output 8-bit single-channel mask. The mask is initialized by the function when mode is set to GC_INIT_WITH_RECT. Its elements may have Cv2.GC_BGD / Cv2.GC_FGD / Cv2.GC_PR_BGD / Cv2.GC_PR_FGD

OpenCvSharp.Rect rect

ROI containing a segmented object. The pixels outside of the ROI are marked as "obvious background". The parameter is only used when mode==GC_INIT_WITH_RECT.

InputOutputArray bgdModel

Temporary array for the background model. Do not modify it while you are processing the same image.

InputOutputArray fgdModel

Temporary arrays for the foreground model. Do not modify it while you are processing the same image.

System.Int32 iterCount

Number of iterations the algorithm should make before returning the result. Note that the result can be refined with further calls with mode==GC_INIT_WITH_MASK or mode==GC_EVAL .

GrabCutModes mode

Operation mode that could be one of GrabCutFlag value.

| Improve this Doc View Source

GreaterThan(Mat)

operator >

Declaration
public MatExpr GreaterThan(Mat m)
Parameters
Type Name Description
Mat m
Returns
Type Description
MatExpr
| Improve this Doc View Source

GreaterThan(Double)

operator >

Declaration
public MatExpr GreaterThan(double d)
Parameters
Type Name Description
System.Double d
Returns
Type Description
MatExpr
| Improve this Doc View Source

GreaterThanOrEqual(Mat)

operator >=

Declaration
public MatExpr GreaterThanOrEqual(Mat m)
Parameters
Type Name Description
Mat m
Returns
Type Description
MatExpr
| Improve this Doc View Source

GreaterThanOrEqual(Double)

operator >=

Declaration
public MatExpr GreaterThanOrEqual(double d)
Parameters
Type Name Description
System.Double d
Returns
Type Description
MatExpr
| Improve this Doc View Source

HoughCircles(HoughModes, Double, Double, Double, Double, Int32, Int32)

Finds circles in a grayscale image using a Hough transform. The input matrix must be 8-bit, single-channel and grayscale.

Declaration
public CircleSegment[] HoughCircles(HoughModes method, double dp, double minDist, double param1 = 100, double param2 = 100, int minRadius = 0, int maxRadius = 0)
Parameters
Type Name Description
HoughModes method

The available methods are HoughMethods.Gradient and HoughMethods.GradientAlt

System.Double dp

The inverse ratio of the accumulator resolution to the image resolution.

System.Double minDist

Minimum distance between the centers of the detected circles.

System.Double param1

The first method-specific parameter. [By default this is 100]

System.Double param2

The second method-specific parameter. [By default this is 100]

System.Int32 minRadius

Minimum circle radius. [By default this is 0]

System.Int32 maxRadius

Maximum circle radius. [By default this is 0]

Returns
Type Description
CircleSegment[]

The output vector found circles. Each vector is encoded as 3-element floating-point vector (x, y, radius)

| Improve this Doc View Source

HoughLines(Double, Double, Int32, Double, Double)

Finds lines in a binary image using standard Hough transform. The input matrix must be 8-bit, single-channel, binary source image. This image may be modified by the function.

Declaration
public LineSegmentPolar[] HoughLines(double rho, double theta, int threshold, double srn = 0, double stn = 0)
Parameters
Type Name Description
System.Double rho

Distance resolution of the accumulator in pixels

System.Double theta

Angle resolution of the accumulator in radians

System.Int32 threshold

The accumulator threshold parameter. Only those lines are returned that get enough votes ( > threshold )

System.Double srn

For the multi-scale Hough transform it is the divisor for the distance resolution rho. [By default this is 0]

System.Double stn

For the multi-scale Hough transform it is the divisor for the distance resolution theta. [By default this is 0]

Returns
Type Description
LineSegmentPolar[]

The output vector of lines. Each line is represented by a two-element vector (rho, theta) . rho is the distance from the coordinate origin (0,0) (top-left corner of the image) and theta is the line rotation angle in radians

| Improve this Doc View Source

HoughLinesP(Double, Double, Int32, Double, Double)

Finds lines segments in a binary image using probabilistic Hough transform.

Declaration
public LineSegmentPoint[] HoughLinesP(double rho, double theta, int threshold, double minLineLength = 0, double maxLineGap = 0)
Parameters
Type Name Description
System.Double rho

Distance resolution of the accumulator in pixels

System.Double theta

Angle resolution of the accumulator in radians

System.Int32 threshold

The accumulator threshold parameter. Only those lines are returned that get enough votes ( > threshold )

System.Double minLineLength

The minimum line length. Line segments shorter than that will be rejected. [By default this is 0]

System.Double maxLineGap

The maximum allowed gap between points on the same line to link them. [By default this is 0]

Returns
Type Description
LineSegmentPoint[]

The output lines. Each line is represented by a 4-element vector (x1, y1, x2, y2)

| Improve this Doc View Source

Idct(DctFlags)

performs inverse 1D or 2D Discrete Cosine Transformation

Declaration
public Mat Idct(DctFlags flags = DctFlags.None)
Parameters
Type Name Description
DctFlags flags

Transformation flags, a combination of DctFlag2 values

Returns
Type Description
Mat

The destination array; will have the same size and same type as src

| Improve this Doc View Source

Idft(DftFlags, Int32)

Performs an inverse Discrete Fourier transform of 1D or 2D floating-point array.

Declaration
public Mat Idft(DftFlags flags = DftFlags.None, int nonzeroRows = 0)
Parameters
Type Name Description
DftFlags flags

Transformation flags, a combination of the DftFlag2 values

System.Int32 nonzeroRows

When the parameter != 0, the function assumes that only the first nonzeroRows rows of the input array ( DFT_INVERSE is not set) or only the first nonzeroRows of the output array ( DFT_INVERSE is set) contain non-zeros, thus the function can handle the rest of the rows more efficiently and thus save some time. This technique is very useful for computing array cross-correlation or convolution using DFT

Returns
Type Description
Mat

The destination array, which size and type depends on the flags

| Improve this Doc View Source

ImDecode(ReadOnlySpan<Byte>, ImreadModes)

Reads image from the specified buffer in memory.

Declaration
public static Mat ImDecode(ReadOnlySpan<byte> span, ImreadModes mode = ImreadModes.Color)
Parameters
Type Name Description
ReadOnlySpan<System.Byte> span

The input slice of bytes.

ImreadModes mode

The same flags as in imread

Returns
Type Description
Mat
| Improve this Doc View Source

ImDecode(Byte[], ImreadModes)

Creates the Mat instance from image data (using cv::decode)

Declaration
public static Mat ImDecode(byte[] imageBytes, ImreadModes mode = ImreadModes.Color)
Parameters
Type Name Description
System.Byte[] imageBytes
ImreadModes mode
Returns
Type Description
Mat
| Improve this Doc View Source

ImEncode(String, ImageEncodingParam[])

Encodes an image into a memory buffer.

Declaration
public byte[] ImEncode(string ext = ".png", params ImageEncodingParam[] prms)
Parameters
Type Name Description
System.String ext

Encodes an image into a memory buffer.

ImageEncodingParam[] prms

Format-specific parameters.

Returns
Type Description
System.Byte[]
| Improve this Doc View Source

ImEncode(String, Int32[])

Encodes an image into a memory buffer.

Declaration
public byte[] ImEncode(string ext = ".png", int[] prms = null)
Parameters
Type Name Description
System.String ext

Encodes an image into a memory buffer.

System.Int32[] prms

Format-specific parameters.

Returns
Type Description
System.Byte[]
| Improve this Doc View Source

ImWrite(String, ImageEncodingParam[])

Saves an image to a specified file.

Declaration
public bool ImWrite(string fileName, params ImageEncodingParam[] prms)
Parameters
Type Name Description
System.String fileName
ImageEncodingParam[] prms
Returns
Type Description
System.Boolean
| Improve this Doc View Source

ImWrite(String, Int32[])

Saves an image to a specified file.

Declaration
public bool ImWrite(string fileName, int[] prms = null)
Parameters
Type Name Description
System.String fileName
System.Int32[] prms
Returns
Type Description
System.Boolean
| Improve this Doc View Source

InRange(InputArray, InputArray)

Checks if array elements lie between the elements of two other arrays.

Declaration
public Mat InRange(InputArray lowerb, InputArray upperb)
Parameters
Type Name Description
InputArray lowerb

inclusive lower boundary array or a scalar.

InputArray upperb

inclusive upper boundary array or a scalar.

Returns
Type Description
Mat

The destination array, will have the same size as src and CV_8U type

| Improve this Doc View Source

InRange(Scalar, Scalar)

Checks if array elements lie between the elements of two other arrays.

Declaration
public Mat InRange(Scalar lowerb, Scalar upperb)
Parameters
Type Name Description
OpenCvSharp.Scalar lowerb

inclusive lower boundary array or a scalar.

OpenCvSharp.Scalar upperb

inclusive upper boundary array or a scalar.

Returns
Type Description
Mat

The destination array, will have the same size as src and CV_8U type

| Improve this Doc View Source

InsertChannel(InputOutputArray, Int32)

inserts a single channel to dst (coi is 0-based index)

Declaration
public void InsertChannel(InputOutputArray dst, int coi)
Parameters
Type Name Description
InputOutputArray dst
System.Int32 coi
| Improve this Doc View Source

Inv(DecompTypes)

Inverses a matrix.

Declaration
public MatExpr Inv(DecompTypes method = DecompTypes.LU)
Parameters
Type Name Description
DecompTypes method

Matrix inversion method

Returns
Type Description
MatExpr
| Improve this Doc View Source

InvertAffineTransform()

Inverts an affine transformation.

Declaration
public Mat InvertAffineTransform()
Returns
Type Description
Mat

Output reverse affine transformation.

| Improve this Doc View Source

IsContinuous()

Reports whether the matrix is continuous or not.

Declaration
public bool IsContinuous()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsContourConvex()

Returns true if the contour is convex. Does not support contours with self-intersection

Declaration
public bool IsContourConvex()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

IsSubmatrix()

Returns whether this matrix is a part of other matrix or not.

Declaration
public bool IsSubmatrix()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Laplacian(MatType, Int32, Double, Double, BorderTypes)

Calculates the Laplacian of an image

Declaration
public Mat Laplacian(MatType ddepth, int ksize = 1, double scale = 1, double delta = 0, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
OpenCvSharp.MatType ddepth

The desired depth of the destination image

System.Int32 ksize

The aperture size used to compute the second-derivative filters

System.Double scale

The optional scale factor for the computed Laplacian values (by default, no scaling is applied

System.Double delta

The optional delta value, added to the results prior to storing them in dst

BorderTypes borderType

The pixel extrapolation method

Returns
Type Description
Mat

Destination image; will have the same size and the same number of channels as src

| Improve this Doc View Source

LessThan(Mat)

operator <

Declaration
public MatExpr LessThan(Mat m)
Parameters
Type Name Description
Mat m
Returns
Type Description
MatExpr
| Improve this Doc View Source

LessThan(Double)

operator <

Declaration
public MatExpr LessThan(double d)
Parameters
Type Name Description
System.Double d
Returns
Type Description
MatExpr
| Improve this Doc View Source

LessThanOrEqual(Mat)

operator <=

Declaration
public MatExpr LessThanOrEqual(Mat m)
Parameters
Type Name Description
Mat m
Returns
Type Description
MatExpr
| Improve this Doc View Source

LessThanOrEqual(Double)

operator <=

Declaration
public MatExpr LessThanOrEqual(double d)
Parameters
Type Name Description
System.Double d
Returns
Type Description
MatExpr
| Improve this Doc View Source

Line(Point, Point, Scalar, Int32, LineTypes, Int32)

Draws a line segment connecting two points

Declaration
public void Line(Point pt1, Point pt2, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0)
Parameters
Type Name Description
OpenCvSharp.Point pt1

First point of the line segment.

OpenCvSharp.Point pt2

Second point of the line segment.

OpenCvSharp.Scalar color

Line color.

System.Int32 thickness

Line thickness. [By default this is 1]

LineTypes lineType

Type of the line. [By default this is LineType.Link8]

System.Int32 shift

Number of fractional bits in the point coordinates. [By default this is 0]

| Improve this Doc View Source

Line(Int32, Int32, Int32, Int32, Scalar, Int32, LineTypes, Int32)

Draws a line segment connecting two points

Declaration
public void Line(int pt1X, int pt1Y, int pt2X, int pt2Y, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0)
Parameters
Type Name Description
System.Int32 pt1X

First point's x-coordinate of the line segment.

System.Int32 pt1Y

First point's y-coordinate of the line segment.

System.Int32 pt2X

Second point's x-coordinate of the line segment.

System.Int32 pt2Y

Second point's y-coordinate of the line segment.

OpenCvSharp.Scalar color

Line color.

System.Int32 thickness

Line thickness. [By default this is 1]

LineTypes lineType

Type of the line. [By default this is LineType.Link8]

System.Int32 shift

Number of fractional bits in the point coordinates. [By default this is 0]

| Improve this Doc View Source

LocateROI(out Size, out Point)

Locates the matrix header within a parent matrix.

Declaration
public void LocateROI(out Size wholeSize, out Point ofs)
Parameters
Type Name Description
OpenCvSharp.Size wholeSize

Output parameter that contains the size of the whole matrix containing *this as a part.

OpenCvSharp.Point ofs

Output parameter that contains an offset of *this inside the whole matrix.

| Improve this Doc View Source

Log()

computes natural logarithm of absolute value of each matrix element: dst = log(abs(src))

Declaration
public Mat Log()
Returns
Type Description
Mat

The destination array; will have the same size and same type as src

| Improve this Doc View Source

LUT(InputArray)

transforms array of numbers using a lookup table: dst(i)=lut(src(i))

Declaration
public Mat LUT(InputArray lut)
Parameters
Type Name Description
InputArray lut

Look-up table of 256 elements. In the case of multi-channel source array, the table should either have a single channel (in this case the same table is used for all channels) or the same number of channels as in the source array

Returns
Type Description
Mat
| Improve this Doc View Source

LUT(Byte[])

transforms array of numbers using a lookup table: dst(i)=lut(src(i))

Declaration
public Mat LUT(byte[] lut)
Parameters
Type Name Description
System.Byte[] lut

Look-up table of 256 elements. In the case of multi-channel source array, the table should either have a single channel (in this case the same table is used for all channels) or the same number of channels as in the source array

Returns
Type Description
Mat
| Improve this Doc View Source

MatchTemplate(InputArray, TemplateMatchModes, InputArray)

Computes the proximity map for the raster template and the image where the template is searched for The input is Image where the search is running; should be 8-bit or 32-bit floating-point.

Declaration
public Mat MatchTemplate(InputArray templ, TemplateMatchModes method, InputArray mask = null)
Parameters
Type Name Description
InputArray templ

Searched template; must be not greater than the source image and have the same data type

TemplateMatchModes method

Specifies the comparison method

InputArray mask

Mask of searched template. It must have the same datatype and size with templ. It is not set by default.

Returns
Type Description
Mat

A map of comparison results; will be single-channel 32-bit floating-point. If image is WxH and templ is wxh then result will be (W-w+1) x (H-h+1).

| Improve this Doc View Source

Mean(InputArray)

computes mean value of selected array elements

Declaration
public Scalar Mean(InputArray mask = null)
Parameters
Type Name Description
InputArray mask

The optional operation mask

Returns
Type Description
OpenCvSharp.Scalar
| Improve this Doc View Source

MeanStdDev(OutputArray, OutputArray, InputArray)

computes mean value and standard deviation of all or selected array elements

Declaration
public void MeanStdDev(OutputArray mean, OutputArray stddev, InputArray mask = null)
Parameters
Type Name Description
OutputArray mean

The output parameter: computed mean value

OutputArray stddev

The output parameter: computed standard deviation

InputArray mask

The optional operation mask

| Improve this Doc View Source

MedianBlur(Int32)

Smoothes image using median filter. The source image must have 1-, 3- or 4-channel and its depth should be CV_8U , CV_16U or CV_32F.

Declaration
public Mat MedianBlur(int ksize)
Parameters
Type Name Description
System.Int32 ksize

The aperture linear size. It must be odd and more than 1, i.e. 3, 5, 7 ...

Returns
Type Description
Mat

The destination array; will have the same size and the same type as src.

| Improve this Doc View Source

MinAreaRect()

Finds the minimum area rotated rectangle enclosing a 2D point set. The input is 2D point set, represented by CV_32SC2 or CV_32FC2 matrix.

Declaration
public RotatedRect MinAreaRect()
Returns
Type Description
OpenCvSharp.RotatedRect
| Improve this Doc View Source

MinEnclosingCircle(out Point2f, out Single)

Finds the minimum area circle enclosing a 2D point set. The input is 2D point set, represented by CV_32SC2 or CV_32FC2 matrix.

Declaration
public void MinEnclosingCircle(out Point2f center, out float radius)
Parameters
Type Name Description
OpenCvSharp.Point2f center

The output center of the circle

System.Single radius

The output radius of the circle

| Improve this Doc View Source

MinMaxIdx(out Double, out Double)

finds global minimum and maximum array elements and returns their values and their locations

Declaration
public void MinMaxIdx(out double minVal, out double maxVal)
Parameters
Type Name Description
System.Double minVal

Pointer to returned minimum value

System.Double maxVal

Pointer to returned maximum value

| Improve this Doc View Source

MinMaxIdx(out Double, out Double, Int32[], Int32[], InputArray)

finds global minimum and maximum array elements and returns their values and their locations

Declaration
public void MinMaxIdx(out double minVal, out double maxVal, int[] minIdx, int[] maxIdx, InputArray mask = null)
Parameters
Type Name Description
System.Double minVal

Pointer to returned minimum value

System.Double maxVal

Pointer to returned maximum value

System.Int32[] minIdx
System.Int32[] maxIdx
InputArray mask
| Improve this Doc View Source

MinMaxIdx(Int32[], Int32[])

finds global minimum and maximum array elements and returns their values and their locations

Declaration
public void MinMaxIdx(int[] minIdx, int[] maxIdx)
Parameters
Type Name Description
System.Int32[] minIdx
System.Int32[] maxIdx
| Improve this Doc View Source

MinMaxLoc(out Point, out Point)

finds global minimum and maximum array elements and returns their values and their locations

Declaration
public void MinMaxLoc(out Point minLoc, out Point maxLoc)
Parameters
Type Name Description
OpenCvSharp.Point minLoc

Pointer to returned minimum location

OpenCvSharp.Point maxLoc

Pointer to returned maximum location

| Improve this Doc View Source

MinMaxLoc(out Double, out Double)

finds global minimum and maximum array elements and returns their values and their locations

Declaration
public void MinMaxLoc(out double minVal, out double maxVal)
Parameters
Type Name Description
System.Double minVal

Pointer to returned minimum value

System.Double maxVal

Pointer to returned maximum value

| Improve this Doc View Source

MinMaxLoc(out Double, out Double, out Point, out Point, InputArray)

finds global minimum and maximum array elements and returns their values and their locations

Declaration
public void MinMaxLoc(out double minVal, out double maxVal, out Point minLoc, out Point maxLoc, InputArray mask = null)
Parameters
Type Name Description
System.Double minVal

Pointer to returned minimum value

System.Double maxVal

Pointer to returned maximum value

OpenCvSharp.Point minLoc

Pointer to returned minimum location

OpenCvSharp.Point maxLoc

Pointer to returned maximum location

InputArray mask

The optional mask used to select a sub-array

| Improve this Doc View Source

Moments(Boolean)

Calculates all of the moments up to the third order of a polygon or rasterized shape. The input is a raster image (single-channel, 8-bit or floating-point 2D array).

Declaration
public Moments Moments(bool binaryImage = false)
Parameters
Type Name Description
System.Boolean binaryImage

If it is true, then all the non-zero image pixels are treated as 1’s

Returns
Type Description
Moments
| Improve this Doc View Source

MorphologyEx(MorphTypes, InputArray, Nullable<Point>, Int32, BorderTypes, Nullable<Scalar>)

Performs advanced morphological transformations

Declaration
public Mat MorphologyEx(MorphTypes op, InputArray element, Point? anchor = null, int iterations = 1, BorderTypes borderType = BorderTypes.Constant, Scalar? borderValue = null)
Parameters
Type Name Description
MorphTypes op

Type of morphological operation

InputArray element

Structuring element

System.Nullable<OpenCvSharp.Point> anchor

Position of the anchor within the element. The default value (-1, -1) means that the anchor is at the element center

System.Int32 iterations

Number of times erosion and dilation are applied. [By default this is 1]

BorderTypes borderType

The pixel extrapolation method. [By default this is BorderTypes.Constant]

System.Nullable<OpenCvSharp.Scalar> borderValue

The border value in case of a constant border. The default value has a special meaning. [By default this is CvCpp.MorphologyDefaultBorderValue()]

Returns
Type Description
Mat

Destination image. It will have the same size and the same type as src

| Improve this Doc View Source

Mul(InputArray, Double)

Performs an element-wise multiplication or division of the two matrices.

Declaration
public MatExpr Mul(InputArray m, double scale = 1)
Parameters
Type Name Description
InputArray m
System.Double scale
Returns
Type Description
MatExpr
| Improve this Doc View Source

Multiply(Mat)

Declaration
public MatExpr Multiply(Mat m)
Parameters
Type Name Description
Mat m
Returns
Type Description
MatExpr
| Improve this Doc View Source

Multiply(Double)

Declaration
public MatExpr Multiply(double s)
Parameters
Type Name Description
System.Double s
Returns
Type Description
MatExpr
| Improve this Doc View Source

MulTransposed(Boolean, InputArray, Double, Int32)

multiplies matrix by its transposition from the left or from the right

Declaration
public Mat MulTransposed(bool aTa, InputArray delta = null, double scale = 1, int dtype = -1)
Parameters
Type Name Description
System.Boolean aTa

Specifies the multiplication ordering; see the description below

InputArray delta

The optional delta matrix, subtracted from src before the multiplication. When the matrix is empty ( delta=Mat() ), it’s assumed to be zero, i.e. nothing is subtracted, otherwise if it has the same size as src, then it’s simply subtracted, otherwise it is "repeated" to cover the full src and then subtracted. Type of the delta matrix, when it's not empty, must be the same as the type of created destination matrix, see the rtype description

System.Double scale

The optional scale factor for the matrix product

System.Int32 dtype

When it’s negative, the destination matrix will have the same type as src . Otherwise, it will have type=CV_MAT_DEPTH(rtype), which should be either CV_32F or CV_64F

Returns
Type Description
Mat
| Improve this Doc View Source

Negate()

Declaration
public MatExpr Negate()
Returns
Type Description
MatExpr
| Improve this Doc View Source

Norm(NormTypes, InputArray)

computes norm of the selected array part

Declaration
public double Norm(NormTypes normType = NormTypes.L2, InputArray mask = null)
Parameters
Type Name Description
NormTypes normType

Type of the norm

InputArray mask

The optional operation mask

Returns
Type Description
System.Double
| Improve this Doc View Source

Normalize(Double, Double, NormTypes, Int32, InputArray)

scales and shifts array elements so that either the specified norm (alpha) or the minimum (alpha) and maximum (beta) array values get the specified values

Declaration
public Mat Normalize(double alpha = 1, double beta = 0, NormTypes normType = NormTypes.L2, int dtype = -1, InputArray mask = null)
Parameters
Type Name Description
System.Double alpha

The norm value to normalize to or the lower range boundary in the case of range normalization

System.Double beta

The upper range boundary in the case of range normalization; not used for norm normalization

NormTypes normType

The normalization type

System.Int32 dtype

When the parameter is negative, the destination array will have the same type as src, otherwise it will have the same number of channels as src and the depth =CV_MAT_DEPTH(rtype)

InputArray mask

The optional operation mask

Returns
Type Description
Mat
| Improve this Doc View Source

NotEquals(Mat)

operator !=

Declaration
public MatExpr NotEquals(Mat m)
Parameters
Type Name Description
Mat m
Returns
Type Description
MatExpr
| Improve this Doc View Source

NotEquals(Double)

operator !=

Declaration
public MatExpr NotEquals(double d)
Parameters
Type Name Description
System.Double d
Returns
Type Description
MatExpr
| Improve this Doc View Source

Ones(MatType, Int32[])

Returns an array of all 1’s of the specified size and type.

Declaration
public static MatExpr Ones(MatType type, params int[] sizes)
Parameters
Type Name Description
OpenCvSharp.MatType type

Created matrix type.

System.Int32[] sizes

Array of integers specifying the array shape.

Returns
Type Description
MatExpr
| Improve this Doc View Source

Ones(Size, MatType)

Returns an array of all 1’s of the specified size and type.

Declaration
public static MatExpr Ones(Size size, MatType type)
Parameters
Type Name Description
OpenCvSharp.Size size

Alternative to the matrix size specification Size(cols, rows) .

OpenCvSharp.MatType type

Created matrix type.

Returns
Type Description
MatExpr
| Improve this Doc View Source

Ones(Int32, Int32, MatType)

Returns an array of all 1’s of the specified size and type.

Declaration
public static MatExpr Ones(int rows, int cols, MatType type)
Parameters
Type Name Description
System.Int32 rows

Number of rows.

System.Int32 cols

Number of columns.

OpenCvSharp.MatType type

Created matrix type.

Returns
Type Description
MatExpr
| Improve this Doc View Source

OnesComplement()

Declaration
public MatExpr OnesComplement()
Returns
Type Description
MatExpr
| Improve this Doc View Source

PatchNaNs(Double)

converts NaN's to the given number

Declaration
public void PatchNaNs(double val = 0)
Parameters
Type Name Description
System.Double val
| Improve this Doc View Source

PerspectiveTransform(InputArray)

performs perspective transformation of each element of multi-channel input matrix

Declaration
public Mat PerspectiveTransform(InputArray m)
Parameters
Type Name Description
InputArray m

3x3 or 4x4 transformation matrix

Returns
Type Description
Mat

The destination array; it will have the same size and same type as src

| Improve this Doc View Source

Plus()

Declaration
public MatExpr Plus()
Returns
Type Description
MatExpr
| Improve this Doc View Source

PointPolygonTest(Point2f, Boolean)

Checks if the point is inside the contour. Optionally computes the signed distance from the point to the contour boundary.

Declaration
public double PointPolygonTest(Point2f pt, bool measureDist)
Parameters
Type Name Description
OpenCvSharp.Point2f pt

Point tested against the contour.

System.Boolean measureDist

If true, the function estimates the signed distance from the point to the nearest contour edge. Otherwise, the function only checks if the point is inside a contour or not.

Returns
Type Description
System.Double

Positive (inside), negative (outside), or zero (on an edge) value.

| Improve this Doc View Source

Polylines(IEnumerable<IEnumerable<Point>>, Boolean, Scalar, Int32, LineTypes, Int32)

draws one or more polygonal curves

Declaration
public void Polylines(IEnumerable<IEnumerable<Point>> pts, bool isClosed, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0)
Parameters
Type Name Description
IEnumerable<IEnumerable<OpenCvSharp.Point>> pts
System.Boolean isClosed
OpenCvSharp.Scalar color
System.Int32 thickness
LineTypes lineType
System.Int32 shift
| Improve this Doc View Source

PopBack(Int32)

removes several hyper-planes from bottom of the matrix (Mat.pop_back)

Declaration
public void PopBack(int nElems = 1)
Parameters
Type Name Description
System.Int32 nElems
| Improve this Doc View Source

Pow(Double)

raises the input matrix elements to the specified power (b = a**power)

Declaration
public Mat Pow(double power)
Parameters
Type Name Description
System.Double power

The exponent of power

Returns
Type Description
Mat

The destination array; will have the same size and the same type as src

| Improve this Doc View Source

PreCornerDetect(Int32, BorderTypes)

computes another complex cornerness criteria at each pixel

Declaration
public Mat PreCornerDetect(int ksize, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
System.Int32 ksize
BorderTypes borderType
Returns
Type Description
Mat
| Improve this Doc View Source

Ptr(Int32)

Returns a pointer to the specified matrix row.

Declaration
public IntPtr Ptr(int i0)
Parameters
Type Name Description
System.Int32 i0

Index along the dimension 0

Returns
Type Description
IntPtr
| Improve this Doc View Source

Ptr(Int32, Int32)

Returns a pointer to the specified matrix element.

Declaration
public IntPtr Ptr(int i0, int i1)
Parameters
Type Name Description
System.Int32 i0

Index along the dimension 0

System.Int32 i1

Index along the dimension 1

Returns
Type Description
IntPtr
| Improve this Doc View Source

Ptr(Int32, Int32, Int32)

Returns a pointer to the specified matrix element.

Declaration
public IntPtr Ptr(int i0, int i1, int i2)
Parameters
Type Name Description
System.Int32 i0

Index along the dimension 0

System.Int32 i1

Index along the dimension 1

System.Int32 i2

Index along the dimension 2

Returns
Type Description
IntPtr
| Improve this Doc View Source

Ptr(Int32[])

Returns a pointer to the specified matrix element.

Declaration
public IntPtr Ptr(params int[] idx)
Parameters
Type Name Description
System.Int32[] idx

Array of Mat::dims indices.

Returns
Type Description
IntPtr
| Improve this Doc View Source

PushBack(Mat)

Adds elements to the bottom of the matrix. (Mat.push_back)

Declaration
public void PushBack(Mat m)
Parameters
Type Name Description
Mat m

Added line(s)

| Improve this Doc View Source

PushBack(Point)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Point value)
Parameters
Type Name Description
OpenCvSharp.Point value

Added element

| Improve this Doc View Source

PushBack(Point2d)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Point2d value)
Parameters
Type Name Description
OpenCvSharp.Point2d value

Added element

| Improve this Doc View Source

PushBack(Point2f)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Point2f value)
Parameters
Type Name Description
OpenCvSharp.Point2f value

Added element

| Improve this Doc View Source

PushBack(Point3d)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Point3d value)
Parameters
Type Name Description
OpenCvSharp.Point3d value

Added element

| Improve this Doc View Source

PushBack(Point3f)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Point3f value)
Parameters
Type Name Description
OpenCvSharp.Point3f value

Added element

| Improve this Doc View Source

PushBack(Point3i)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Point3i value)
Parameters
Type Name Description
OpenCvSharp.Point3i value

Added element

| Improve this Doc View Source

PushBack(Rect)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Rect value)
Parameters
Type Name Description
OpenCvSharp.Rect value

Added element

| Improve this Doc View Source

PushBack(Rect2d)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Rect2d value)
Parameters
Type Name Description
OpenCvSharp.Rect2d value

Added element

| Improve this Doc View Source

PushBack(Rect2f)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Rect2f value)
Parameters
Type Name Description
OpenCvSharp.Rect2f value

Added element

| Improve this Doc View Source

PushBack(Size)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Size value)
Parameters
Type Name Description
OpenCvSharp.Size value

Added element

| Improve this Doc View Source

PushBack(Size2d)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Size2d value)
Parameters
Type Name Description
OpenCvSharp.Size2d value

Added element

| Improve this Doc View Source

PushBack(Size2f)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Size2f value)
Parameters
Type Name Description
OpenCvSharp.Size2f value

Added element

| Improve this Doc View Source

PushBack(Vec2b)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Vec2b value)
Parameters
Type Name Description
Vec2b value

Added element

| Improve this Doc View Source

PushBack(Vec2d)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Vec2d value)
Parameters
Type Name Description
Vec2d value

Added element

| Improve this Doc View Source

PushBack(Vec2f)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Vec2f value)
Parameters
Type Name Description
Vec2f value

Added element

| Improve this Doc View Source

PushBack(Vec2i)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Vec2i value)
Parameters
Type Name Description
Vec2i value

Added element

| Improve this Doc View Source

PushBack(Vec2s)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Vec2s value)
Parameters
Type Name Description
Vec2s value

Added element

| Improve this Doc View Source

PushBack(Vec2w)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Vec2w value)
Parameters
Type Name Description
Vec2w value

Added element

| Improve this Doc View Source

PushBack(Vec3b)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Vec3b value)
Parameters
Type Name Description
Vec3b value

Added element

| Improve this Doc View Source

PushBack(Vec3d)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Vec3d value)
Parameters
Type Name Description
Vec3d value

Added element

| Improve this Doc View Source

PushBack(Vec3f)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Vec3f value)
Parameters
Type Name Description
Vec3f value

Added element

| Improve this Doc View Source

PushBack(Vec3i)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Vec3i value)
Parameters
Type Name Description
Vec3i value

Added element

| Improve this Doc View Source

PushBack(Vec3s)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Vec3s value)
Parameters
Type Name Description
Vec3s value

Added element

| Improve this Doc View Source

PushBack(Vec3w)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Vec3w value)
Parameters
Type Name Description
Vec3w value

Added element

| Improve this Doc View Source

PushBack(Vec4b)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Vec4b value)
Parameters
Type Name Description
Vec4b value

Added element

| Improve this Doc View Source

PushBack(Vec4d)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Vec4d value)
Parameters
Type Name Description
Vec4d value

Added element

| Improve this Doc View Source

PushBack(Vec4f)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Vec4f value)
Parameters
Type Name Description
Vec4f value

Added element

| Improve this Doc View Source

PushBack(Vec4i)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Vec4i value)
Parameters
Type Name Description
Vec4i value

Added element

| Improve this Doc View Source

PushBack(Vec4s)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Vec4s value)
Parameters
Type Name Description
Vec4s value

Added element

| Improve this Doc View Source

PushBack(Vec4w)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Vec4w value)
Parameters
Type Name Description
Vec4w value

Added element

| Improve this Doc View Source

PushBack(Vec6b)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Vec6b value)
Parameters
Type Name Description
Vec6b value

Added element

| Improve this Doc View Source

PushBack(Vec6d)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Vec6d value)
Parameters
Type Name Description
Vec6d value

Added element

| Improve this Doc View Source

PushBack(Vec6f)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Vec6f value)
Parameters
Type Name Description
Vec6f value

Added element

| Improve this Doc View Source

PushBack(Vec6i)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Vec6i value)
Parameters
Type Name Description
Vec6i value

Added element

| Improve this Doc View Source

PushBack(Vec6s)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Vec6s value)
Parameters
Type Name Description
Vec6s value

Added element

| Improve this Doc View Source

PushBack(Vec6w)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(Vec6w value)
Parameters
Type Name Description
Vec6w value

Added element

| Improve this Doc View Source

PushBack(Byte)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(byte value)
Parameters
Type Name Description
System.Byte value

Added element

| Improve this Doc View Source

PushBack(Double)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(double value)
Parameters
Type Name Description
System.Double value

Added element

| Improve this Doc View Source

PushBack(Int16)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(short value)
Parameters
Type Name Description
System.Int16 value

Added element

| Improve this Doc View Source

PushBack(Int32)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(int value)
Parameters
Type Name Description
System.Int32 value

Added element

| Improve this Doc View Source

PushBack(SByte)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(sbyte value)
Parameters
Type Name Description
System.SByte value

Added element

| Improve this Doc View Source

PushBack(Single)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(float value)
Parameters
Type Name Description
System.Single value

Added element

| Improve this Doc View Source

PushBack(UInt16)

Adds elements to the bottom of the matrix. (Mat::push_back)

Declaration
public void PushBack(ushort value)
Parameters
Type Name Description
System.UInt16 value

Added element

| Improve this Doc View Source

PutText(String, Point, HersheyFonts, Double, Scalar, Int32, LineTypes, Boolean)

renders text string in the image

Declaration
public void PutText(string text, Point org, HersheyFonts fontFace, double fontScale, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, bool bottomLeftOrigin = false)
Parameters
Type Name Description
System.String text
OpenCvSharp.Point org
HersheyFonts fontFace
System.Double fontScale
OpenCvSharp.Scalar color
System.Int32 thickness
LineTypes lineType
System.Boolean bottomLeftOrigin
| Improve this Doc View Source

PyrDown(Nullable<Size>, BorderTypes)

Blurs an image and downsamples it.

Declaration
public Mat PyrDown(Size? dstSize = null, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
System.Nullable<OpenCvSharp.Size> dstSize

size of the output image; by default, it is computed as Size((src.cols+1)/2

BorderTypes borderType
Returns
Type Description
Mat
| Improve this Doc View Source

PyrMeanShiftFiltering(Double, Double, Int32, Nullable<TermCriteria>)

Performs initial step of meanshift segmentation of an image. The source matrix is 8-bit, 3-channel image.

Declaration
public Mat PyrMeanShiftFiltering(double sp, double sr, int maxLevel = 1, TermCriteria? termcrit = null)
Parameters
Type Name Description
System.Double sp

The spatial window radius.

System.Double sr

The color window radius.

System.Int32 maxLevel

Maximum level of the pyramid for the segmentation.

System.Nullable<OpenCvSharp.TermCriteria> termcrit

Termination criteria: when to stop meanshift iterations.

Returns
Type Description
Mat

The destination image of the same format and the same size as the source.

| Improve this Doc View Source

PyrUp(Nullable<Size>, BorderTypes)

Upsamples an image and then blurs it.

Declaration
public Mat PyrUp(Size? dstSize = null, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
System.Nullable<OpenCvSharp.Size> dstSize

size of the output image; by default, it is computed as Size(src.cols2, (src.rows2)

BorderTypes borderType
Returns
Type Description
Mat
| Improve this Doc View Source

Randn(InputArray, InputArray)

fills array with normally-distributed random numbers with the specified mean and the standard deviation

Declaration
public void Randn(InputArray mean, InputArray stddev)
Parameters
Type Name Description
InputArray mean

The mean value (expectation) of the generated random numbers

InputArray stddev

The standard deviation of the generated random numbers

| Improve this Doc View Source

Randn(Scalar, Scalar)

fills array with normally-distributed random numbers with the specified mean and the standard deviation

Declaration
public void Randn(Scalar mean, Scalar stddev)
Parameters
Type Name Description
OpenCvSharp.Scalar mean

The mean value (expectation) of the generated random numbers

OpenCvSharp.Scalar stddev

The standard deviation of the generated random numbers

| Improve this Doc View Source

RandShuffle(Double)

shuffles the input array elements

Declaration
public void RandShuffle(double iterFactor)
Parameters
Type Name Description
System.Double iterFactor

The scale factor that determines the number of random swap operations.

| Improve this Doc View Source

RandShuffle(Double, ref RNG)

shuffles the input array elements

Declaration
public void RandShuffle(double iterFactor, ref RNG rng)
Parameters
Type Name Description
System.Double iterFactor

The scale factor that determines the number of random swap operations.

RNG rng

The optional random number generator used for shuffling. If it is null, theRng() is used instead.

| Improve this Doc View Source

Randu(InputArray, InputArray)

fills array with uniformly-distributed random numbers from the range [low, high)

Declaration
public void Randu(InputArray low, InputArray high)
Parameters
Type Name Description
InputArray low

The inclusive lower boundary of the generated random numbers

InputArray high

The exclusive upper boundary of the generated random numbers

| Improve this Doc View Source

Randu(Scalar, Scalar)

fills array with uniformly-distributed random numbers from the range [low, high)

Declaration
public void Randu(Scalar low, Scalar high)
Parameters
Type Name Description
OpenCvSharp.Scalar low

The inclusive lower boundary of the generated random numbers

OpenCvSharp.Scalar high

The exclusive upper boundary of the generated random numbers

| Improve this Doc View Source

Rectangle(Point, Point, Scalar, Int32, LineTypes, Int32)

Draws simple, thick or filled rectangle

Declaration
public void Rectangle(Point pt1, Point pt2, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0)
Parameters
Type Name Description
OpenCvSharp.Point pt1

One of the rectangle vertices.

OpenCvSharp.Point pt2

Opposite rectangle vertex.

OpenCvSharp.Scalar color

Line color (RGB) or brightness (grayscale image).

System.Int32 thickness

Thickness of lines that make up the rectangle. Negative values make the function to draw a filled rectangle. [By default this is 1]

LineTypes lineType

Type of the line, see cvLine description. [By default this is LineType.Link8]

System.Int32 shift

Number of fractional bits in the point coordinates. [By default this is 0]

| Improve this Doc View Source

Rectangle(Rect, Scalar, Int32, LineTypes, Int32)

Draws simple, thick or filled rectangle

Declaration
public void Rectangle(Rect rect, Scalar color, int thickness = 1, LineTypes lineType = LineTypes.Link8, int shift = 0)
Parameters
Type Name Description
OpenCvSharp.Rect rect

Rectangle.

OpenCvSharp.Scalar color

Line color (RGB) or brightness (grayscale image).

System.Int32 thickness

Thickness of lines that make up the rectangle. Negative values make the function to draw a filled rectangle. [By default this is 1]

LineTypes lineType

Type of the line, see cvLine description. [By default this is LineType.Link8]

System.Int32 shift

Number of fractional bits in the point coordinates. [By default this is 0]

| Improve this Doc View Source

Reduce(ReduceDimension, ReduceTypes, Int32)

transforms 2D matrix to 1D row or column vector by taking sum, minimum, maximum or mean value over all the rows

Declaration
public Mat Reduce(ReduceDimension dim, ReduceTypes rtype, int dtype)
Parameters
Type Name Description
ReduceDimension dim

The dimension index along which the matrix is reduced. 0 means that the matrix is reduced to a single row and 1 means that the matrix is reduced to a single column

ReduceTypes rtype
System.Int32 dtype

When it is negative, the destination vector will have the same type as the source matrix, otherwise, its type will be CV_MAKE_TYPE(CV_MAT_DEPTH(dtype), mtx.channels())

Returns
Type Description
Mat
| Improve this Doc View Source

Release()

Releases the resources

Declaration
public void Release()
| Improve this Doc View Source

Remap(InputArray, InputArray, InterpolationFlags, BorderTypes, Nullable<Scalar>)

Applies a generic geometrical transformation to an image.

Declaration
public Mat Remap(InputArray map1, InputArray map2, InterpolationFlags interpolation = InterpolationFlags.Linear, BorderTypes borderMode = BorderTypes.Constant, Scalar? borderValue = null)
Parameters
Type Name Description
InputArray map1

The first map of either (x,y) points or just x values having the type CV_16SC2, CV_32FC1, or CV_32FC2.

InputArray map2

The second map of y values having the type CV_16UC1, CV_32FC1, or none (empty map if map1 is (x,y) points), respectively.

InterpolationFlags interpolation

Interpolation method. The method INTER_AREA is not supported by this function.

BorderTypes borderMode

Pixel extrapolation method. When borderMode=BORDER_TRANSPARENT, it means that the pixels in the destination image that corresponds to the "outliers" in the source image are not modified by the function.

System.Nullable<OpenCvSharp.Scalar> borderValue

Value used in case of a constant border. By default, it is 0.

Returns
Type Description
Mat

Destination image. It has the same size as map1 and the same type as src

| Improve this Doc View Source

Repeat(Int32, Int32)

replicates the input matrix the specified number of times in the horizontal and/or vertical direction

Declaration
public Mat Repeat(int ny, int nx)
Parameters
Type Name Description
System.Int32 ny

How many times the src is repeated along the vertical axis

System.Int32 nx

How many times the src is repeated along the horizontal axis

Returns
Type Description
Mat
| Improve this Doc View Source

Reserve(Int32)

Reserves space for the certain number of rows.

The method reserves space for sz rows. If the matrix already has enough space to store sz rows, nothing happens. If the matrix is reallocated, the first Mat::rows rows are preserved. The method emulates the corresponding method of the STL vector class.

Declaration
public void Reserve(int sz)
Parameters
Type Name Description
System.Int32 sz

Number of rows.

| Improve this Doc View Source

ReserveBuffer(Int32)

Reserves space for the certain number of bytes.

The method reserves space for sz bytes. If the matrix already has enough space to store sz bytes, nothing happens. If matrix has to be reallocated its previous content could be lost.

Declaration
public void ReserveBuffer(int sz)
Parameters
Type Name Description
System.Int32 sz

Number of bytes.

| Improve this Doc View Source

Reshape(Int32, Int32)

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

Declaration
public Mat Reshape(int cn, int rows = 0)
Parameters
Type Name Description
System.Int32 cn

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

System.Int32 rows

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

Returns
Type Description
Mat
| Improve this Doc View Source

Reshape(Int32, Int32[])

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

Declaration
public Mat Reshape(int cn, params int[] newDims)
Parameters
Type Name Description
System.Int32 cn

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

System.Int32[] newDims

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

Returns
Type Description
Mat
| Improve this Doc View Source

Resize(Size, Double, Double, InterpolationFlags)

Resizes an image.

Declaration
public Mat Resize(Size dsize, double fx = 0, double fy = 0, InterpolationFlags interpolation = InterpolationFlags.Linear)
Parameters
Type Name Description
OpenCvSharp.Size dsize

output image size; if it equals zero, it is computed as: dsize = Size(round(fxsrc.cols), round(fysrc.rows)) Either dsize or both fx and fy must be non-zero.

System.Double fx

scale factor along the horizontal axis; when it equals 0, it is computed as: (double)dsize.width/src.cols

System.Double fy

scale factor along the vertical axis; when it equals 0, it is computed as: (double)dsize.height/src.rows

InterpolationFlags interpolation

interpolation method

Returns
Type Description
Mat

output image; it has the size dsize (when it is non-zero) or the size computed from src.size(), fx, and fy; the type of dst is the same as of src.

| Improve this Doc View Source

Resize(Int32)

Changes the number of matrix rows.

Declaration
public void Resize(int sz)
Parameters
Type Name Description
System.Int32 sz

New number of rows.

| Improve this Doc View Source

Resize(Int32, Scalar)

Changes the number of matrix rows.

Declaration
public void Resize(int sz, Scalar s)
Parameters
Type Name Description
System.Int32 sz

New number of rows.

OpenCvSharp.Scalar s

Value assigned to the newly added elements.

| Improve this Doc View Source

Row(Int32)

Creates a matrix header for the specified matrix row.

Declaration
public Mat Row(int y)
Parameters
Type Name Description
System.Int32 y

A 0-based row index.

Returns
Type Description
Mat
| Improve this Doc View Source

RowRange(Range)

Creates a matrix header for the specified row span.

Declaration
public Mat RowRange(Range range)
Parameters
Type Name Description
OpenCvSharp.Range range
Returns
Type Description
Mat
| Improve this Doc View Source

RowRange(Int32, Int32)

Creates a matrix header for the specified row span.

Declaration
public Mat RowRange(int startRow, int endRow)
Parameters
Type Name Description
System.Int32 startRow
System.Int32 endRow
Returns
Type Description
Mat
| Improve this Doc View Source

RowRange(Range)

Creates a matrix header for the specified row span.

Declaration
public Mat RowRange(Range range)
Parameters
Type Name Description
System.Range range
Returns
Type Description
Mat
| Improve this Doc View Source

SaveImage(String, ImageEncodingParam[])

Saves an image to a specified file.

Declaration
public bool SaveImage(string fileName, params ImageEncodingParam[] prms)
Parameters
Type Name Description
System.String fileName
ImageEncodingParam[] prms
Returns
Type Description
System.Boolean
| Improve this Doc View Source

SaveImage(String, Int32[])

Saves an image to a specified file.

Declaration
public bool SaveImage(string fileName, int[] prms = null)
Parameters
Type Name Description
System.String fileName
System.Int32[] prms
Returns
Type Description
System.Boolean
| Improve this Doc View Source

Scharr(MatType, Int32, Int32, Double, Double, BorderTypes)

Calculates the first x- or y- image derivative using Scharr operator

Declaration
public Mat Scharr(MatType ddepth, int xorder, int yorder, double scale = 1, double delta = 0, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
OpenCvSharp.MatType ddepth

The destination image depth

System.Int32 xorder

Order of the derivative x

System.Int32 yorder

Order of the derivative y

System.Double scale

The optional scale factor for the computed derivative values (by default, no scaling is applie

System.Double delta

The optional delta value, added to the results prior to storing them in dst

BorderTypes borderType

The pixel extrapolation method

Returns
Type Description
Mat

The destination image; will have the same size and the same number of channels as src

| Improve this Doc View Source

SepFilter2D(MatType, InputArray, InputArray, Nullable<Point>, Double, BorderTypes)

Applies separable linear filter to an image

Declaration
public Mat SepFilter2D(MatType ddepth, InputArray kernelX, InputArray kernelY, Point? anchor = null, double delta = 0, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
OpenCvSharp.MatType ddepth

The destination image depth

InputArray kernelX

The coefficients for filtering each row

InputArray kernelY

The coefficients for filtering each column

System.Nullable<OpenCvSharp.Point> anchor

The anchor position within the kernel; The default value (-1, 1) means that the anchor is at the kernel center

System.Double delta

The value added to the filtered results before storing them

BorderTypes borderType

The pixel extrapolation method

Returns
Type Description
Mat

The destination image; will have the same size and the same number of channels as src

| Improve this Doc View Source

Set<T>(Int32, T)

Set a value to the specified array element.

Declaration
public void Set<T>(int i0, T value)
    where T : struct
Parameters
Type Name Description
System.Int32 i0

Index along the dimension 0

T value
Type Parameters
Name Description
T
| Improve this Doc View Source

Set<T>(Int32, Int32, T)

Set a value to the specified array element.

Declaration
public void Set<T>(int i0, int i1, T value)
    where T : struct
Parameters
Type Name Description
System.Int32 i0

Index along the dimension 0

System.Int32 i1

Index along the dimension 1

T value
Type Parameters
Name Description
T
| Improve this Doc View Source

Set<T>(Int32, Int32, Int32, T)

Set a value to the specified array element.

Declaration
public void Set<T>(int i0, int i1, int i2, T value)
    where T : struct
Parameters
Type Name Description
System.Int32 i0

Index along the dimension 0

System.Int32 i1

Index along the dimension 1

System.Int32 i2

Index along the dimension 2

T value
Type Parameters
Name Description
T
| Improve this Doc View Source

Set<T>(Int32[], T)

Set a value to the specified array element.

Declaration
public void Set<T>(int[] idx, T value)
    where T : struct
Parameters
Type Name Description
System.Int32[] idx

Array of Mat::dims indices.

T value
Type Parameters
Name Description
T
| Improve this Doc View Source

SetArray<T>(T[])

Set the specified array data to this matrix

Declaration
public bool SetArray<T>(params T[] data)
    where T : struct
Parameters
Type Name Description
T[] data

Primitive or Vec array to be copied

Returns
Type Description
System.Boolean

Length of copied bytes

Type Parameters
Name Description
T
| Improve this Doc View Source

SetIdentity(Nullable<Scalar>)

initializes scaled identity matrix (not necessarily square).

Declaration
public void SetIdentity(Scalar? s = null)
Parameters
Type Name Description
System.Nullable<OpenCvSharp.Scalar> s

The value to assign to the diagonal elements

| Improve this Doc View Source

SetRectangularArray<T>(T[,])

Set the specified array data to this matrix

Declaration
public bool SetRectangularArray<T>(T[, ] data)
    where T : struct
Parameters
Type Name Description
T[,] data

Primitive or Vec array to be copied

Returns
Type Description
System.Boolean

Length of copied bytes

Type Parameters
Name Description
T
| Improve this Doc View Source

SetTo(InputArray, Mat)

Sets all or some of the array elements to the specified value.

Declaration
public Mat SetTo(InputArray value, Mat mask = null)
Parameters
Type Name Description
InputArray value
Mat mask
Returns
Type Description
Mat
| Improve this Doc View Source

SetTo(Scalar, Mat)

Sets all or some of the array elements to the specified value.

Declaration
public Mat SetTo(Scalar value, Mat mask = null)
Parameters
Type Name Description
OpenCvSharp.Scalar value
Mat mask
Returns
Type Description
Mat
| Improve this Doc View Source

Size()

Returns a matrix size.

Declaration
public Size Size()
Returns
Type Description
OpenCvSharp.Size
| Improve this Doc View Source

Size(Int32)

Returns a matrix size.

Declaration
public int Size(int dim)
Parameters
Type Name Description
System.Int32 dim
Returns
Type Description
System.Int32
| Improve this Doc View Source

Sobel(MatType, Int32, Int32, Int32, Double, Double, BorderTypes)

Calculates the first, second, third or mixed image derivatives using an extended Sobel operator

Declaration
public Mat Sobel(MatType ddepth, int xorder, int yorder, int ksize = 3, double scale = 1, double delta = 0, BorderTypes borderType = BorderTypes.Reflect101)
Parameters
Type Name Description
OpenCvSharp.MatType ddepth

The destination image depth

System.Int32 xorder

Order of the derivative x

System.Int32 yorder

Order of the derivative y

System.Int32 ksize

Size of the extended Sobel kernel, must be 1, 3, 5 or 7

System.Double scale

The optional scale factor for the computed derivative values (by default, no scaling is applied

System.Double delta

The optional delta value, added to the results prior to storing them in dst

BorderTypes borderType

The pixel extrapolation method

Returns
Type Description
Mat

The destination image; will have the same size and the same number of channels as src

| Improve this Doc View Source

Sort(SortFlags)

sorts independently each matrix row or each matrix column

Declaration
public Mat Sort(SortFlags flags)
Parameters
Type Name Description
SortFlags flags

The operation flags, a combination of the SortFlag values

Returns
Type Description
Mat

The destination array of the same size and the same type as src

| Improve this Doc View Source

SortIdx(SortFlags)

sorts independently each matrix row or each matrix column

Declaration
public Mat SortIdx(SortFlags flags)
Parameters
Type Name Description
SortFlags flags

The operation flags, a combination of SortFlag values

Returns
Type Description
Mat

The destination integer array of the same size as src

| Improve this Doc View Source

Split()

Copies each plane of a multi-channel array to a dedicated array

Declaration
public Mat[] Split()
Returns
Type Description
Mat[]

The number of arrays must match mtx.channels() . The arrays themselves will be reallocated if needed

| Improve this Doc View Source

Sqrt()

computes square root of each matrix element (dst = src**0.5)

Declaration
public Mat Sqrt()
Returns
Type Description
Mat

The destination array; will have the same size and the same type as src

| Improve this Doc View Source

Step()

Returns number of bytes each matrix row occupies.

Declaration
public long Step()
Returns
Type Description
System.Int64
| Improve this Doc View Source

Step(Int32)

Returns number of bytes each matrix row occupies.

Declaration
public long Step(int i)
Parameters
Type Name Description
System.Int32 i
Returns
Type Description
System.Int64
| Improve this Doc View Source

Step1(Int32)

Returns a normalized step.

Declaration
public long Step1(int i = 0)
Parameters
Type Name Description
System.Int32 i
Returns
Type Description
System.Int64
| Improve this Doc View Source

SubMat(Range, Range)

Extracts a rectangular submatrix.

Declaration
public Mat SubMat(Range rowRange, Range colRange)
Parameters
Type Name Description
OpenCvSharp.Range rowRange

Start and end row of the extracted submatrix. The upper boundary is not included. To select all the rows, use Range::all().

OpenCvSharp.Range colRange

Start and end column of the extracted submatrix. The upper boundary is not included. To select all the columns, use Range::all().

Returns
Type Description
Mat
| Improve this Doc View Source

SubMat(Range[])

Extracts a rectangular submatrix.

Declaration
public Mat SubMat(params Range[] ranges)
Parameters
Type Name Description
OpenCvSharp.Range[] ranges

Array of selected ranges along each array dimension.

Returns
Type Description
Mat
| Improve this Doc View Source

SubMat(Rect)

Extracts a rectangular submatrix.

Declaration
public Mat SubMat(Rect roi)
Parameters
Type Name Description
OpenCvSharp.Rect roi

Extracted submatrix specified as a rectangle.

Returns
Type Description
Mat
| Improve this Doc View Source

SubMat(Int32, Int32, Int32, Int32)

Extracts a rectangular submatrix.

Declaration
public Mat SubMat(int rowStart, int rowEnd, int colStart, int colEnd)
Parameters
Type Name Description
System.Int32 rowStart
System.Int32 rowEnd
System.Int32 colStart
System.Int32 colEnd
Returns
Type Description
Mat
| Improve this Doc View Source

SubMat(Range, Range)

Extracts a rectangular submatrix.

Declaration
public Mat SubMat(Range rowRange, Range colRange)
Parameters
Type Name Description
System.Range rowRange

Start and end row of the extracted submatrix. The upper boundary is not included. To select all the rows, use Range::all().

System.Range colRange

Start and end column of the extracted submatrix. The upper boundary is not included. To select all the columns, use Range::all().

Returns
Type Description
Mat
| Improve this Doc View Source

Subtract(Mat)

Declaration
public MatExpr Subtract(Mat m)
Parameters
Type Name Description
Mat m
Returns
Type Description
MatExpr
| Improve this Doc View Source

Subtract(Scalar)

Declaration
public MatExpr Subtract(Scalar s)
Parameters
Type Name Description
OpenCvSharp.Scalar s
Returns
Type Description
MatExpr
| Improve this Doc View Source

Sum()

computes sum of array elements

Declaration
public Scalar Sum()
Returns
Type Description
OpenCvSharp.Scalar
| Improve this Doc View Source

T()

Transposes a matrix.

Declaration
public MatExpr T()
Returns
Type Description
MatExpr
| Improve this Doc View Source

Threshold(Double, Double, ThresholdTypes)

Applies a fixed-level threshold to each array element. The input matrix must be single-channel, 8-bit or 32-bit floating point.

Declaration
public Mat Threshold(double thresh, double maxval, ThresholdTypes type)
Parameters
Type Name Description
System.Double thresh

threshold value.

System.Double maxval

maximum value to use with the THRESH_BINARY and THRESH_BINARY_INV thresholding types.

ThresholdTypes type

thresholding type (see the details below).

Returns
Type Description
Mat

output array of the same size and type as src.

| Improve this Doc View Source

ToBytes(String, ImageEncodingParam[])

Encodes an image into a memory buffer.

Declaration
public byte[] ToBytes(string ext = ".png", params ImageEncodingParam[] prms)
Parameters
Type Name Description
System.String ext

Encodes an image into a memory buffer.

ImageEncodingParam[] prms

Format-specific parameters.

Returns
Type Description
System.Byte[]
| Improve this Doc View Source

ToBytes(String, Int32[])

Encodes an image into a memory buffer.

Declaration
public byte[] ToBytes(string ext = ".png", int[] prms = null)
Parameters
Type Name Description
System.String ext

Encodes an image into a memory buffer.

System.Int32[] prms

Format-specific parameters.

Returns
Type Description
System.Byte[]
| Improve this Doc View Source

ToMemoryStream(String, ImageEncodingParam[])

Converts Mat to System.IO.MemoryStream

Declaration
public MemoryStream ToMemoryStream(string ext = ".png", params ImageEncodingParam[] prms)
Parameters
Type Name Description
System.String ext
ImageEncodingParam[] prms
Returns
Type Description
MemoryStream
| Improve this Doc View Source

ToString()

Returns a string that represents this Mat.

Declaration
public override string ToString()
Returns
Type Description
System.String
| Improve this Doc View Source

Total()

Returns the total number of array elements.

Declaration
public long Total()
Returns
Type Description
System.Int64
| Improve this Doc View Source

Total(Int32, Int32)

Returns the total number of array elements. The method returns the number of elements within a certain sub-array slice with startDim <= dim < endDim

Declaration
public long Total(int startDim, int endDim = 2147483647)
Parameters
Type Name Description
System.Int32 startDim
System.Int32 endDim
Returns
Type Description
System.Int64
| Improve this Doc View Source

Trace()

computes trace of a matrix

Declaration
public Scalar Trace()
Returns
Type Description
OpenCvSharp.Scalar
| Improve this Doc View Source

Transform(InputArray)

performs affine transformation of each element of multi-channel input matrix

Declaration
public Mat Transform(InputArray m)
Parameters
Type Name Description
InputArray m

The transformation matrix

Returns
Type Description
Mat

The destination array; will have the same size and depth as src and as many channels as mtx.rows

| Improve this Doc View Source

Transpose()

transposes the matrix

Declaration
public Mat Transpose()
Returns
Type Description
Mat

The destination array of the same type as src

| Improve this Doc View Source

Type()

Returns the type of a matrix element.

Declaration
public MatType Type()
Returns
Type Description
OpenCvSharp.MatType
| Improve this Doc View Source

Undistort(InputArray, InputArray, InputArray)

corrects lens distortion for the given camera matrix and distortion coefficients

Declaration
public Mat Undistort(InputArray cameraMatrix, InputArray distCoeffs, InputArray newCameraMatrix = null)
Parameters
Type Name Description
InputArray cameraMatrix

Input camera matrix

InputArray distCoeffs

Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. If the vector is null, the zero distortion coefficients are assumed.

InputArray newCameraMatrix

Camera matrix of the distorted image. By default, it is the same as cameraMatrix but you may additionally scale and shift the result by using a different matrix.

Returns
Type Description
Mat

Output (corrected) image that has the same size and type as src .

| Improve this Doc View Source

UndistortPoints(InputArray, InputArray, InputArray, InputArray)

Computes the ideal point coordinates from the observed point coordinates. Input matrix is an observed point coordinates, 1xN or Nx1 2-channel (CV_32FC2 or CV_64FC2).

Declaration
public Mat UndistortPoints(InputArray cameraMatrix, InputArray distCoeffs, InputArray r = null, InputArray p = null)
Parameters
Type Name Description
InputArray cameraMatrix

Camera matrix

InputArray distCoeffs

Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. If the vector is null, the zero distortion coefficients are assumed.

InputArray r

Rectification transformation in the object space (3x3 matrix). R1 or R2 computed by stereoRectify() can be passed here. If the matrix is empty, the identity transformation is used.

InputArray p

New camera matrix (3x3) or new projection matrix (3x4). P1 or P2 computed by stereoRectify() can be passed here. If the matrix is empty, the identity new camera matrix is used.

Returns
Type Description
Mat

Output ideal point coordinates after undistortion and reverse perspective transformation. If matrix P is identity or omitted, dst will contain normalized point coordinates.

| Improve this Doc View Source

WarpAffine(InputArray, Size, InterpolationFlags, BorderTypes, Nullable<Scalar>)

Applies an affine transformation to an image.

Declaration
public Mat WarpAffine(InputArray m, Size dsize, InterpolationFlags flags = InterpolationFlags.Linear, BorderTypes borderMode = BorderTypes.Constant, Scalar? borderValue = null)
Parameters
Type Name Description
InputArray m

2x3 transformation matrix.

OpenCvSharp.Size dsize

size of the output image.

InterpolationFlags flags

combination of interpolation methods and the optional flag WARP_INVERSE_MAP that means that M is the inverse transformation (dst -> src) .

BorderTypes borderMode

pixel extrapolation method; when borderMode=BORDER_TRANSPARENT, it means that the pixels in the destination image corresponding to the "outliers" in the source image are not modified by the function.

System.Nullable<OpenCvSharp.Scalar> borderValue

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

Returns
Type Description
Mat

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

| Improve this Doc View Source

WarpPerspective(Mat, Size, InterpolationFlags, BorderTypes, Nullable<Scalar>)

Applies a perspective transformation to an image.

Declaration
public Mat WarpPerspective(Mat m, Size dsize, InterpolationFlags flags = InterpolationFlags.Linear, BorderTypes borderMode = BorderTypes.Constant, Scalar? borderValue = null)
Parameters
Type Name Description
Mat m

3x3 transformation matrix.

OpenCvSharp.Size dsize

size of the output image.

InterpolationFlags flags

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

BorderTypes borderMode

pixel extrapolation method (BORDER_CONSTANT or BORDER_REPLICATE).

System.Nullable<OpenCvSharp.Scalar> borderValue

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

Returns
Type Description
Mat

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

| Improve this Doc View Source

Watershed(InputOutputArray)

Performs a marker-based image segmentation using the watershed algorithm. Input matrix is 8-bit 3-channel image.

Declaration
public void Watershed(InputOutputArray markers)
Parameters
Type Name Description
InputOutputArray markers

Input/output 32-bit single-channel image (map) of markers. It should have the same size as image.

| Improve this Doc View Source

WriteToStream(Stream, String, ImageEncodingParam[])

Writes image data encoded from this Mat to System.IO.Stream

Declaration
public void WriteToStream(Stream stream, string ext = ".png", params ImageEncodingParam[] prms)
Parameters
Type Name Description
Stream stream
System.String ext
ImageEncodingParam[] prms
| Improve this Doc View Source

Xor(Mat)

Declaration
public MatExpr Xor(Mat m)
Parameters
Type Name Description
Mat m
Returns
Type Description
MatExpr
| Improve this Doc View Source

Xor(Double)

Declaration
public MatExpr Xor(double s)
Parameters
Type Name Description
System.Double s
Returns
Type Description
MatExpr
| Improve this Doc View Source

Zeros(MatType, Int32[])

Returns a zero array of the specified size and type.

Declaration
public static MatExpr Zeros(MatType type, params int[] sizes)
Parameters
Type Name Description
OpenCvSharp.MatType type

Created matrix type.

System.Int32[] sizes
Returns
Type Description
MatExpr
| Improve this Doc View Source

Zeros(Size, MatType)

Returns a zero array of the specified size and type.

Declaration
public static MatExpr Zeros(Size size, MatType type)
Parameters
Type Name Description
OpenCvSharp.Size size

Alternative to the matrix size specification Size(cols, rows) .

OpenCvSharp.MatType type

Created matrix type.

Returns
Type Description
MatExpr
| Improve this Doc View Source

Zeros(Int32, Int32, MatType)

Returns a zero array of the specified size and type.

Declaration
public static MatExpr Zeros(int rows, int cols, MatType type)
Parameters
Type Name Description
System.Int32 rows

Number of rows.

System.Int32 cols

Number of columns.

OpenCvSharp.MatType type

Created matrix type.

Returns
Type Description
MatExpr

Operators

| Improve this Doc View Source

Addition(Mat, Mat)

Declaration
public static MatExpr operator +(Mat a, Mat b)
Parameters
Type Name Description
Mat a
Mat b
Returns
Type Description
MatExpr
| Improve this Doc View Source

Addition(Mat, Scalar)

Declaration
public static MatExpr operator +(Mat a, Scalar s)
Parameters
Type Name Description
Mat a
OpenCvSharp.Scalar s
Returns
Type Description
MatExpr
| Improve this Doc View Source

Addition(Scalar, Mat)

Declaration
public static MatExpr operator +(Scalar s, Mat a)
Parameters
Type Name Description
OpenCvSharp.Scalar s
Mat a
Returns
Type Description
MatExpr
| Improve this Doc View Source

BitwiseAnd(Mat, Mat)

Declaration
public static MatExpr operator &(Mat a, Mat b)
Parameters
Type Name Description
Mat a
Mat b
Returns
Type Description
MatExpr
| Improve this Doc View Source

BitwiseAnd(Mat, Double)

Declaration
public static MatExpr operator &(Mat a, double s)
Parameters
Type Name Description
Mat a
System.Double s
Returns
Type Description
MatExpr
| Improve this Doc View Source

BitwiseAnd(Double, Mat)

Declaration
public static MatExpr operator &(double s, Mat a)
Parameters
Type Name Description
System.Double s
Mat a
Returns
Type Description
MatExpr
| Improve this Doc View Source

BitwiseOr(Mat, Mat)

Declaration
public static MatExpr operator |(Mat a, Mat b)
Parameters
Type Name Description
Mat a
Mat b
Returns
Type Description
MatExpr
| Improve this Doc View Source

BitwiseOr(Mat, Double)

Declaration
public static MatExpr operator |(Mat a, double s)
Parameters
Type Name Description
Mat a
System.Double s
Returns
Type Description
MatExpr
| Improve this Doc View Source

BitwiseOr(Double, Mat)

Declaration
public static MatExpr operator |(double s, Mat a)
Parameters
Type Name Description
System.Double s
Mat a
Returns
Type Description
MatExpr
| Improve this Doc View Source

Division(Mat, Mat)

Declaration
public static MatExpr operator /(Mat a, Mat b)
Parameters
Type Name Description
Mat a
Mat b
Returns
Type Description
MatExpr
| Improve this Doc View Source

Division(Mat, Double)

Declaration
public static MatExpr operator /(Mat a, double s)
Parameters
Type Name Description
Mat a
System.Double s
Returns
Type Description
MatExpr
| Improve this Doc View Source

Division(Double, Mat)

Declaration
public static MatExpr operator /(double s, Mat a)
Parameters
Type Name Description
System.Double s
Mat a
Returns
Type Description
MatExpr
| Improve this Doc View Source

ExclusiveOr(Mat, Mat)

Declaration
public static MatExpr operator ^(Mat a, Mat b)
Parameters
Type Name Description
Mat a
Mat b
Returns
Type Description
MatExpr
| Improve this Doc View Source

ExclusiveOr(Mat, Double)

Declaration
public static MatExpr operator ^(Mat a, double s)
Parameters
Type Name Description
Mat a
System.Double s
Returns
Type Description
MatExpr
| Improve this Doc View Source

ExclusiveOr(Double, Mat)

Declaration
public static MatExpr operator ^(double s, Mat a)
Parameters
Type Name Description
System.Double s
Mat a
Returns
Type Description
MatExpr
| Improve this Doc View Source

Multiply(Mat, Mat)

Declaration
public static MatExpr operator *(Mat a, Mat b)
Parameters
Type Name Description
Mat a
Mat b
Returns
Type Description
MatExpr
| Improve this Doc View Source

Multiply(Mat, Double)

Declaration
public static MatExpr operator *(Mat a, double s)
Parameters
Type Name Description
Mat a
System.Double s
Returns
Type Description
MatExpr
| Improve this Doc View Source

Multiply(Double, Mat)

Declaration
public static MatExpr operator *(double s, Mat a)
Parameters
Type Name Description
System.Double s
Mat a
Returns
Type Description
MatExpr
| Improve this Doc View Source

OnesComplement(Mat)

Declaration
public static MatExpr operator ~(Mat m)
Parameters
Type Name Description
Mat m
Returns
Type Description
MatExpr
| Improve this Doc View Source

Subtraction(Mat, Mat)

Declaration
public static MatExpr operator -(Mat a, Mat b)
Parameters
Type Name Description
Mat a
Mat b
Returns
Type Description
MatExpr
| Improve this Doc View Source

Subtraction(Mat, Scalar)

Declaration
public static MatExpr operator -(Mat a, Scalar s)
Parameters
Type Name Description
Mat a
OpenCvSharp.Scalar s
Returns
Type Description
MatExpr
| Improve this Doc View Source

Subtraction(Scalar, Mat)

Declaration
public static MatExpr operator -(Scalar s, Mat a)
Parameters
Type Name Description
OpenCvSharp.Scalar s
Mat a
Returns
Type Description
MatExpr
| Improve this Doc View Source

UnaryNegation(Mat)

Declaration
public static MatExpr operator -(Mat mat)
Parameters
Type Name Description
Mat mat
Returns
Type Description
MatExpr
| Improve this Doc View Source

UnaryPlus(Mat)

Declaration
public static Mat operator +(Mat mat)
Parameters
Type Name Description
Mat mat
Returns
Type Description
Mat

Implements

ICvPtrHolder

Extension Methods

CvExtensions.HoughLinesProbabilisticEx(Mat, Double, Double, Int32, Double, Double, Double, Double)
BitmapSourceConverter.ToBitmapSource(Mat)
BitmapSourceConverter.ToBitmapSource(Mat, Int32, Int32, PixelFormat, BitmapPalette)
BitmapSourceConverter.CopyFrom(Mat, BitmapSource)
WriteableBitmapConverter.ToWriteableBitmap(Mat, Double, Double, PixelFormat, BitmapPalette)
WriteableBitmapConverter.ToWriteableBitmap(Mat, PixelFormat)
WriteableBitmapConverter.ToWriteableBitmap(Mat)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX