Class Mat
OpenCV C++ n-dimensional dense array class (cv::Mat)
Implements
Inherited Members
Namespace: OpenCvSharp
Assembly: OpenCvSharp.dll
Syntax
public class Mat : DisposableCvObject, ICvPtrHolder
Constructors
| Improve this Doc View SourceMat()
Creates empty Mat
Declaration
public Mat()
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. |
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. |
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 . |
Mat(Mat)
Declaration
protected Mat(Mat m)
Parameters
Type | Name | Description |
---|---|---|
Mat | m |
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. |
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. |
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. |
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. |
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 . |
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. |
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() . |
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() . |
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 . |
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 SourceTypeMap
typeof(T) -> MatType
Declaration
protected static readonly IReadOnlyDictionary<Type, MatType> TypeMap
Field Value
Type | Description |
---|---|
IReadOnlyDictionary<Type, OpenCvSharp.MatType> |
Properties
| Improve this Doc View SourceCols
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 |
Data
pointer to the data
Declaration
public IntPtr Data { get; }
Property Value
Type | Description |
---|---|
IntPtr |
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 |
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 |
DataPointer
unsafe pointer to the data
Declaration
public byte *DataPointer { get; }
Property Value
Type | Description |
---|---|
System.Byte* |
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 |
Dims
the array dimensionality, >= 2
Declaration
public int Dims { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 SourceAbs()
Computes absolute value of each matrix element
Declaration
public MatExpr Abs()
Returns
Type | Description |
---|---|
MatExpr |
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. |
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. |
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. |
Add(Mat)
Declaration
public MatExpr Add(Mat m)
Parameters
Type | Name | Description |
---|---|---|
Mat | m |
Returns
Type | Description |
---|---|
MatExpr |
Add(Scalar)
Declaration
public MatExpr Add(Scalar s)
Parameters
Type | Name | Description |
---|---|---|
OpenCvSharp.Scalar | s |
Returns
Type | Description |
---|---|
MatExpr |
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 |
Alignment(Int32)
Declaration
public Mat Alignment(int n = 4)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | n |
Returns
Type | Description |
---|---|
Mat |
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 |
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 |
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). |
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 |
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 |
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 |
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 |
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 |
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 |
BitwiseAnd(Mat)
Declaration
public MatExpr BitwiseAnd(Mat m)
Parameters
Type | Name | Description |
---|---|---|
Mat | m |
Returns
Type | Description |
---|---|
MatExpr |
BitwiseAnd(Double)
Declaration
public MatExpr BitwiseAnd(double s)
Parameters
Type | Name | Description |
---|---|---|
System.Double | s |
Returns
Type | Description |
---|---|
MatExpr |
BitwiseOr(Mat)
Declaration
public MatExpr BitwiseOr(Mat m)
Parameters
Type | Name | Description |
---|---|---|
Mat | m |
Returns
Type | Description |
---|---|
MatExpr |
BitwiseOr(Double)
Declaration
public MatExpr BitwiseOr(double s)
Parameters
Type | Name | Description |
---|---|---|
System.Double | s |
Returns
Type | Description |
---|---|
MatExpr |
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 |
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. |
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 |
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> |
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 |
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 |
Channels()
Returns the number of matrix channels.
Declaration
public int Channels()
Returns
Type | Description |
---|---|
System.Int32 |
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 |
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 |
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. |
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] |
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] |
Clone()
Creates a full copy of the matrix.
Declaration
public Mat Clone()
Returns
Type | Description |
---|---|
Mat |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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. |
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). |
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). |
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). |
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). |
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. |
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. |
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 |
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. |
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. |
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 |
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[] |
CountNonZero()
computes the number of nonzero array elements
Declaration
public int CountNonZero()
Returns
Type | Description |
---|---|
System.Int32 | number of non-zero elements in mtx |
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. |
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. |
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. |
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 |
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 |
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 |
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 |
Depth()
Returns the depth of a matrix element.
Declaration
public int Depth()
Returns
Type | Description |
---|---|
System.Int32 |
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. |
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 |
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 |
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 |
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 |
DisposeManaged()
Releases managed resources
Declaration
protected override void DisposeManaged()
Overrides
| Improve this Doc View SourceDisposeUnmanaged()
Releases unmanaged resources
Declaration
protected override void DisposeUnmanaged()
Overrides
| Improve this Doc View SourceDistanceTransform(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> |
Divide(Mat)
Declaration
public MatExpr Divide(Mat m)
Parameters
Type | Name | Description |
---|---|---|
Mat | m |
Returns
Type | Description |
---|---|
MatExpr |
Divide(Double)
Declaration
public MatExpr Divide(double s)
Parameters
Type | Name | Description |
---|---|---|
System.Double | s |
Returns
Type | Description |
---|---|
MatExpr |
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 |
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) |
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) |
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. |
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 |
ElemSize()
Returns the matrix element size in bytes.
Declaration
public int ElemSize()
Returns
Type | Description |
---|---|
System.Int32 |
ElemSize1()
Returns the size of each matrix element channel in bytes.
Declaration
public int ElemSize1()
Returns
Type | Description |
---|---|
System.Int32 |
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] |
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] |
Empty()
Returns true if the array has no elements.
Declaration
public bool Empty()
Returns
Type | Description |
---|---|
System.Boolean |
EmptyClone()
Makes a Mat that have the same size, depth and channels as this image
Declaration
public Mat EmptyClone()
Returns
Type | Description |
---|---|
Mat |
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 |
Equals(Mat)
operator ==
Declaration
public MatExpr Equals(Mat m)
Parameters
Type | Name | Description |
---|---|---|
Mat | m |
Returns
Type | Description |
---|---|
MatExpr |
Equals(Double)
operator ==
Declaration
public MatExpr Equals(double d)
Parameters
Type | Name | Description |
---|---|---|
System.Double | d |
Returns
Type | Description |
---|---|
MatExpr |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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. |
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. |
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. |
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. |
FindNonZero()
returns the list of locations of non-zero pixels
Declaration
public Mat FindNonZero()
Returns
Type | Description |
---|---|
Mat |
FitEllipse()
Fits ellipse to the set of 2D points.
Declaration
public RotatedRect FitEllipse()
Returns
Type | Description |
---|---|
OpenCvSharp.RotatedRect |
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. |
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. |
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 |
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 |
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 |
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 |
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 |
ForEachAsByte(MatForeachFunctionByte)
Runs the given functor over all matrix elements in parallel.
Declaration
public void ForEachAsByte(MatForeachFunctionByte operation)
Parameters
Type | Name | Description |
---|---|---|
MatForeachFunctionByte | operation |
ForEachAsDouble(MatForeachFunctionDouble)
Runs the given functor over all matrix elements in parallel.
Declaration
public void ForEachAsDouble(MatForeachFunctionDouble operation)
Parameters
Type | Name | Description |
---|---|---|
MatForeachFunctionDouble | operation |
ForEachAsFloat(MatForeachFunctionFloat)
Runs the given functor over all matrix elements in parallel.
Declaration
public void ForEachAsFloat(MatForeachFunctionFloat operation)
Parameters
Type | Name | Description |
---|---|---|
MatForeachFunctionFloat | operation |
ForEachAsInt16(MatForeachFunctionInt16)
Runs the given functor over all matrix elements in parallel.
Declaration
public void ForEachAsInt16(MatForeachFunctionInt16 operation)
Parameters
Type | Name | Description |
---|---|---|
MatForeachFunctionInt16 | operation |
ForEachAsInt32(MatForeachFunctionInt32)
Runs the given functor over all matrix elements in parallel.
Declaration
public void ForEachAsInt32(MatForeachFunctionInt32 operation)
Parameters
Type | Name | Description |
---|---|---|
MatForeachFunctionInt32 | operation |
ForEachAsVec2b(MatForeachFunctionVec2b)
Runs the given functor over all matrix elements in parallel.
Declaration
public void ForEachAsVec2b(MatForeachFunctionVec2b operation)
Parameters
Type | Name | Description |
---|---|---|
MatForeachFunctionVec2b | operation |
ForEachAsVec2d(MatForeachFunctionVec2d)
Runs the given functor over all matrix elements in parallel.
Declaration
public void ForEachAsVec2d(MatForeachFunctionVec2d operation)
Parameters
Type | Name | Description |
---|---|---|
MatForeachFunctionVec2d | operation |
ForEachAsVec2f(MatForeachFunctionVec2f)
Runs the given functor over all matrix elements in parallel.
Declaration
public void ForEachAsVec2f(MatForeachFunctionVec2f operation)
Parameters
Type | Name | Description |
---|---|---|
MatForeachFunctionVec2f | operation |
ForEachAsVec2i(MatForeachFunctionVec2i)
Runs the given functor over all matrix elements in parallel.
Declaration
public void ForEachAsVec2i(MatForeachFunctionVec2i operation)
Parameters
Type | Name | Description |
---|---|---|
MatForeachFunctionVec2i | operation |
ForEachAsVec2s(MatForeachFunctionVec2s)
Runs the given functor over all matrix elements in parallel.
Declaration
public void ForEachAsVec2s(MatForeachFunctionVec2s operation)
Parameters
Type | Name | Description |
---|---|---|
MatForeachFunctionVec2s | operation |
ForEachAsVec3b(MatForeachFunctionVec3b)
Runs the given functor over all matrix elements in parallel.
Declaration
public void ForEachAsVec3b(MatForeachFunctionVec3b operation)
Parameters
Type | Name | Description |
---|---|---|
MatForeachFunctionVec3b | operation |
ForEachAsVec3d(MatForeachFunctionVec3d)
Runs the given functor over all matrix elements in parallel.
Declaration
public void ForEachAsVec3d(MatForeachFunctionVec3d operation)
Parameters
Type | Name | Description |
---|---|---|
MatForeachFunctionVec3d | operation |
ForEachAsVec3f(MatForeachFunctionVec3f)
Runs the given functor over all matrix elements in parallel.
Declaration
public void ForEachAsVec3f(MatForeachFunctionVec3f operation)
Parameters
Type | Name | Description |
---|---|---|
MatForeachFunctionVec3f | operation |
ForEachAsVec3i(MatForeachFunctionVec3i)
Runs the given functor over all matrix elements in parallel.
Declaration
public void ForEachAsVec3i(MatForeachFunctionVec3i operation)
Parameters
Type | Name | Description |
---|---|---|
MatForeachFunctionVec3i | operation |
ForEachAsVec3s(MatForeachFunctionVec3s)
Runs the given functor over all matrix elements in parallel.
Declaration
public void ForEachAsVec3s(MatForeachFunctionVec3s operation)
Parameters
Type | Name | Description |
---|---|---|
MatForeachFunctionVec3s | operation |
ForEachAsVec4b(MatForeachFunctionVec4b)
Runs the given functor over all matrix elements in parallel.
Declaration
public void ForEachAsVec4b(MatForeachFunctionVec4b operation)
Parameters
Type | Name | Description |
---|---|---|
MatForeachFunctionVec4b | operation |
ForEachAsVec4d(MatForeachFunctionVec4d)
Runs the given functor over all matrix elements in parallel.
Declaration
public void ForEachAsVec4d(MatForeachFunctionVec4d operation)
Parameters
Type | Name | Description |
---|---|---|
MatForeachFunctionVec4d | operation |
ForEachAsVec4f(MatForeachFunctionVec4f)
Runs the given functor over all matrix elements in parallel.
Declaration
public void ForEachAsVec4f(MatForeachFunctionVec4f operation)
Parameters
Type | Name | Description |
---|---|---|
MatForeachFunctionVec4f | operation |
ForEachAsVec4i(MatForeachFunctionVec4i)
Runs the given functor over all matrix elements in parallel.
Declaration
public void ForEachAsVec4i(MatForeachFunctionVec4i operation)
Parameters
Type | Name | Description |
---|---|---|
MatForeachFunctionVec4i | operation |
ForEachAsVec4s(MatForeachFunctionVec4s)
Runs the given functor over all matrix elements in parallel.
Declaration
public void ForEachAsVec4s(MatForeachFunctionVec4s operation)
Parameters
Type | Name | Description |
---|---|---|
MatForeachFunctionVec4s | operation |
ForEachAsVec6b(MatForeachFunctionVec6b)
Runs the given functor over all matrix elements in parallel.
Declaration
public void ForEachAsVec6b(MatForeachFunctionVec6b operation)
Parameters
Type | Name | Description |
---|---|---|
MatForeachFunctionVec6b | operation |
ForEachAsVec6d(MatForeachFunctionVec6d)
Runs the given functor over all matrix elements in parallel.
Declaration
public void ForEachAsVec6d(MatForeachFunctionVec6d operation)
Parameters
Type | Name | Description |
---|---|---|
MatForeachFunctionVec6d | operation |
ForEachAsVec6f(MatForeachFunctionVec6f)
Runs the given functor over all matrix elements in parallel.
Declaration
public void ForEachAsVec6f(MatForeachFunctionVec6f operation)
Parameters
Type | Name | Description |
---|---|---|
MatForeachFunctionVec6f | operation |
ForEachAsVec6i(MatForeachFunctionVec6i)
Runs the given functor over all matrix elements in parallel.
Declaration
public void ForEachAsVec6i(MatForeachFunctionVec6i operation)
Parameters
Type | Name | Description |
---|---|---|
MatForeachFunctionVec6i | operation |
ForEachAsVec6s(MatForeachFunctionVec6s)
Runs the given functor over all matrix elements in parallel.
Declaration
public void ForEachAsVec6s(MatForeachFunctionVec6s operation)
Parameters
Type | Name | Description |
---|---|---|
MatForeachFunctionVec6s | operation |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 SourceGetDefaultNewCameraMatrix(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). |
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 |
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 SourceGetRectSubPix(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 . |
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 |
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 |
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. |
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. |
GreaterThan(Mat)
operator >
Declaration
public MatExpr GreaterThan(Mat m)
Parameters
Type | Name | Description |
---|---|---|
Mat | m |
Returns
Type | Description |
---|---|
MatExpr |
GreaterThan(Double)
operator >
Declaration
public MatExpr GreaterThan(double d)
Parameters
Type | Name | Description |
---|---|---|
System.Double | d |
Returns
Type | Description |
---|---|
MatExpr |
GreaterThanOrEqual(Mat)
operator >=
Declaration
public MatExpr GreaterThanOrEqual(Mat m)
Parameters
Type | Name | Description |
---|---|---|
Mat | m |
Returns
Type | Description |
---|---|
MatExpr |
GreaterThanOrEqual(Double)
operator >=
Declaration
public MatExpr GreaterThanOrEqual(double d)
Parameters
Type | Name | Description |
---|---|---|
System.Double | d |
Returns
Type | Description |
---|---|
MatExpr |
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) |
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 |
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) |
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 |
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 |
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 |
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 |
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[] |
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[] |
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 |
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 |
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 |
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 |
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 |
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 |
InvertAffineTransform()
Inverts an affine transformation.
Declaration
public Mat InvertAffineTransform()
Returns
Type | Description |
---|---|
Mat | Output reverse affine transformation. |
IsContinuous()
Reports whether the matrix is continuous or not.
Declaration
public bool IsContinuous()
Returns
Type | Description |
---|---|
System.Boolean |
IsContourConvex()
Returns true if the contour is convex. Does not support contours with self-intersection
Declaration
public bool IsContourConvex()
Returns
Type | Description |
---|---|
System.Boolean |
IsSubmatrix()
Returns whether this matrix is a part of other matrix or not.
Declaration
public bool IsSubmatrix()
Returns
Type | Description |
---|---|
System.Boolean |
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 |
LessThan(Mat)
operator <
Declaration
public MatExpr LessThan(Mat m)
Parameters
Type | Name | Description |
---|---|---|
Mat | m |
Returns
Type | Description |
---|---|
MatExpr |
LessThan(Double)
operator <
Declaration
public MatExpr LessThan(double d)
Parameters
Type | Name | Description |
---|---|---|
System.Double | d |
Returns
Type | Description |
---|---|
MatExpr |
LessThanOrEqual(Mat)
operator <=
Declaration
public MatExpr LessThanOrEqual(Mat m)
Parameters
Type | Name | Description |
---|---|---|
Mat | m |
Returns
Type | Description |
---|---|
MatExpr |
LessThanOrEqual(Double)
operator <=
Declaration
public MatExpr LessThanOrEqual(double d)
Parameters
Type | Name | Description |
---|---|---|
System.Double | d |
Returns
Type | Description |
---|---|
MatExpr |
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] |
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] |
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. |
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 |
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 |
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 |
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). |
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 |
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 |
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. |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
Multiply(Mat)
Declaration
public MatExpr Multiply(Mat m)
Parameters
Type | Name | Description |
---|---|---|
Mat | m |
Returns
Type | Description |
---|---|
MatExpr |
Multiply(Double)
Declaration
public MatExpr Multiply(double s)
Parameters
Type | Name | Description |
---|---|---|
System.Double | s |
Returns
Type | Description |
---|---|
MatExpr |
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 |
Negate()
Declaration
public MatExpr Negate()
Returns
Type | Description |
---|---|
MatExpr |
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 |
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 |
NotEquals(Mat)
operator !=
Declaration
public MatExpr NotEquals(Mat m)
Parameters
Type | Name | Description |
---|---|---|
Mat | m |
Returns
Type | Description |
---|---|
MatExpr |
NotEquals(Double)
operator !=
Declaration
public MatExpr NotEquals(double d)
Parameters
Type | Name | Description |
---|---|---|
System.Double | d |
Returns
Type | Description |
---|---|
MatExpr |
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 |
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 |
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 |
OnesComplement()
Declaration
public MatExpr OnesComplement()
Returns
Type | Description |
---|---|
MatExpr |
PatchNaNs(Double)
converts NaN's to the given number
Declaration
public void PatchNaNs(double val = 0)
Parameters
Type | Name | Description |
---|---|---|
System.Double | val |
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 |
Plus()
Declaration
public MatExpr Plus()
Returns
Type | Description |
---|---|
MatExpr |
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. |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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) |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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. |
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 |
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 |
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 |
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. |
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. |
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 |
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 |
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] |
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] |
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 |
Release()
Releases the resources
Declaration
public void Release()
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 |
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 |
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. |
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. |
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 |
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 |
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. |
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. |
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. |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
Size()
Returns a matrix size.
Declaration
public Size Size()
Returns
Type | Description |
---|---|
OpenCvSharp.Size |
Size(Int32)
Returns a matrix size.
Declaration
public int Size(int dim)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | dim |
Returns
Type | Description |
---|---|
System.Int32 |
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 |
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 |
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 |
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 |
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 |
Step()
Returns number of bytes each matrix row occupies.
Declaration
public long Step()
Returns
Type | Description |
---|---|
System.Int64 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
Subtract(Mat)
Declaration
public MatExpr Subtract(Mat m)
Parameters
Type | Name | Description |
---|---|---|
Mat | m |
Returns
Type | Description |
---|---|
MatExpr |
Subtract(Scalar)
Declaration
public MatExpr Subtract(Scalar s)
Parameters
Type | Name | Description |
---|---|---|
OpenCvSharp.Scalar | s |
Returns
Type | Description |
---|---|
MatExpr |
Sum()
computes sum of array elements
Declaration
public Scalar Sum()
Returns
Type | Description |
---|---|
OpenCvSharp.Scalar |
T()
Transposes a matrix.
Declaration
public MatExpr T()
Returns
Type | Description |
---|---|
MatExpr |
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. |
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[] |
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[] |
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 |
ToString()
Returns a string that represents this Mat.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
Total()
Returns the total number of array elements.
Declaration
public long Total()
Returns
Type | Description |
---|---|
System.Int64 |
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 |
Trace()
computes trace of a matrix
Declaration
public Scalar Trace()
Returns
Type | Description |
---|---|
OpenCvSharp.Scalar |
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 |
Transpose()
transposes the matrix
Declaration
public Mat Transpose()
Returns
Type | Description |
---|---|
Mat | The destination array of the same type as src |
Type()
Returns the type of a matrix element.
Declaration
public MatType Type()
Returns
Type | Description |
---|---|
OpenCvSharp.MatType |
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 . |
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. |
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. |
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. |
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. |
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 |
Xor(Mat)
Declaration
public MatExpr Xor(Mat m)
Parameters
Type | Name | Description |
---|---|---|
Mat | m |
Returns
Type | Description |
---|---|
MatExpr |
Xor(Double)
Declaration
public MatExpr Xor(double s)
Parameters
Type | Name | Description |
---|---|---|
System.Double | s |
Returns
Type | Description |
---|---|
MatExpr |
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 |
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 |
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 SourceAddition(Mat, Mat)
Declaration
public static MatExpr operator +(Mat a, Mat b)
Parameters
Type | Name | Description |
---|---|---|
Mat | a | |
Mat | b |
Returns
Type | Description |
---|---|
MatExpr |
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 |
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 |
BitwiseAnd(Mat, Mat)
Declaration
public static MatExpr operator &(Mat a, Mat b)
Parameters
Type | Name | Description |
---|---|---|
Mat | a | |
Mat | b |
Returns
Type | Description |
---|---|
MatExpr |
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 |
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 |
BitwiseOr(Mat, Mat)
Declaration
public static MatExpr operator |(Mat a, Mat b)
Parameters
Type | Name | Description |
---|---|---|
Mat | a | |
Mat | b |
Returns
Type | Description |
---|---|
MatExpr |
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 |
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 |
Division(Mat, Mat)
Declaration
public static MatExpr operator /(Mat a, Mat b)
Parameters
Type | Name | Description |
---|---|---|
Mat | a | |
Mat | b |
Returns
Type | Description |
---|---|
MatExpr |
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 |
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 |
ExclusiveOr(Mat, Mat)
Declaration
public static MatExpr operator ^(Mat a, Mat b)
Parameters
Type | Name | Description |
---|---|---|
Mat | a | |
Mat | b |
Returns
Type | Description |
---|---|
MatExpr |
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 |
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 |
Multiply(Mat, Mat)
Declaration
public static MatExpr operator *(Mat a, Mat b)
Parameters
Type | Name | Description |
---|---|---|
Mat | a | |
Mat | b |
Returns
Type | Description |
---|---|
MatExpr |
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 |
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 |
OnesComplement(Mat)
Declaration
public static MatExpr operator ~(Mat m)
Parameters
Type | Name | Description |
---|---|---|
Mat | m |
Returns
Type | Description |
---|---|
MatExpr |
Subtraction(Mat, Mat)
Declaration
public static MatExpr operator -(Mat a, Mat b)
Parameters
Type | Name | Description |
---|---|---|
Mat | a | |
Mat | b |
Returns
Type | Description |
---|---|
MatExpr |
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 |
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 |
UnaryNegation(Mat)
Declaration
public static MatExpr operator -(Mat mat)
Parameters
Type | Name | Description |
---|---|---|
Mat | mat |
Returns
Type | Description |
---|---|
MatExpr |
UnaryPlus(Mat)
Declaration
public static Mat operator +(Mat mat)
Parameters
Type | Name | Description |
---|---|---|
Mat | mat |
Returns
Type | Description |
---|---|
Mat |