Class MatExpr
- Namespace
- OpenCvSharp
- Assembly
- OpenCvSharp.dll
A purely managed, lazily-evaluated matrix expression — the result of Mat
arithmetic. This is the managed counterpart of OpenCV's cv::MatExpr (issue #1974).
public sealed class MatExpr
- Inheritance
-
MatExpr
- Inherited Members
Remarks
A Mat operator such as a + b returns a MatExpr without
creating any native object: it simply captures its operands in a deferred delegate. The native
cv::MatExpr chain is built only when the expression is materialized (ToMat()
or the implicit conversion to Mat), and every native intermediate is disposed
immediately during that evaluation. Nothing escapes to the finalizer, intermediates never
extend operand lifetimes, and no using dance is required: a chain such as
255 - mat * 0.8 is leak-free and can be received straight into a Mat.
Operators that OpenCV only defines on Mat (the comparisons, the bitwise operators,
min/max) are evaluated by materializing the operand subtrees to Mat
at that node and applying the Mat-level operation — exactly what OpenCV C++ does, since
those operators take Mat and implicitly evaluate any expression operands. The arithmetic
operators (+ - * /) and abs keep OpenCV's native cross-node expression fusion.
Methods
- Abs()
Computes an absolute value of each matrix element (cv::abs). Keeps native expression fusion.
- Col(int)
Creates a matrix header for the specified matrix column.
- Cross(Mat)
Computes a cross-product of two 3-element vectors. Materializes the expression.
- Diag(MatDiagType)
Extracts a diagonal from a matrix.
- Dot(Mat)
Computes a dot-product of two vectors. Materializes the expression.
- Equal(Mat)
operator ==
- Equal(MatExpr)
operator ==
- Equal(double)
operator ==
- GreaterThan(Mat)
operator >
- GreaterThan(MatExpr)
operator >
- GreaterThan(double)
operator >
- GreaterThanOrEqual(Mat)
operator >=
- GreaterThanOrEqual(MatExpr)
operator >=
- GreaterThanOrEqual(double)
operator >=
- Inv(DecompTypes)
Inversion (cv::MatExpr::inv).
- LessThan(Mat)
operator <
- LessThan(MatExpr)
operator <
- LessThan(double)
operator <
- LessThanOrEqual(Mat)
operator <=
- LessThanOrEqual(MatExpr)
operator <=
- LessThanOrEqual(double)
operator <=
- Max(Mat)
Per-element maximum (cv::max). Operands are materialized to Mat.
- Max(MatExpr)
Per-element maximum (cv::max). Operands are materialized to Mat.
- Max(double)
Per-element maximum against a scalar value (cv::max).
- Min(Mat)
Per-element minimum (cv::min). Operands are materialized to Mat.
- Min(MatExpr)
Per-element minimum (cv::min). Operands are materialized to Mat.
- Min(double)
Per-element minimum against a scalar value (cv::min).
- Mul(Mat, double)
Per-element multiplication (cv::MatExpr::mul).
- Mul(MatExpr, double)
Per-element multiplication (cv::MatExpr::mul).
- NotEqual(Mat)
operator !=
- NotEqual(MatExpr)
operator !=
- NotEqual(double)
operator !=
- Row(int)
Creates a matrix header for the specified matrix row.
- Size()
Returns the size of the matrix. Materializes the expression.
- SubMat(Range, Range)
Extracts a rectangular submatrix.
- SubMat(Rect)
Extracts a rectangular submatrix.
- SubMat(int, int, int, int)
Extracts a rectangular submatrix.
- T()
Transposition (cv::MatExpr::t).
- Type()
Returns the element type of the matrix. Materializes the expression.
Operators
- implicit operator Mat(MatExpr)
Materializes the expression into a new Mat.