Mat class

Inheritance
Available extensions

Constructors

Mat.create({int rows = 0, int cols = 0, int r = 0, int g = 0, int b = 0, MatType? type})
factory
Mat.empty()
factory
Mat.eye(int rows, int cols, MatType type)
Returns an identity matrix of the specified size and type.
factory
Mat.from2DList(Iterable<Iterable<num>> data, MatType type)
Create a Mat from a 2D list
factory
Mat.from3DList(Iterable<Iterable<Iterable<num>>> data, MatType type)
Create a Mat from a 3D list
factory
Mat.fromList(int rows, int cols, MatType type, List<num> data)
Create a Mat from a list of data
factory
Mat.fromNative(Mat mat)
factory
Mat.fromPointer(MatPtr mat, [bool attach = true])
This method is different from Mat.fromPtr, will construct from pointer directly
factory
Mat.fromPtr(Mat m, int rows, int cols, int type, int prows, int pcols)
this constructor is a wrapper of Mat (int rows, int cols, int type, void *data, size_t step=AUTO_STEP)
factory
Mat.fromRange(Mat mat, int rowStart, int rowEnd, {int colStart = 0, int? colEnd})
Create Mat from another Mat with range
factory
Mat.fromScalar(int rows, int cols, MatType type, Scalar s)
rows Number of rows in a 2D array.
factory
Mat.fromVec(Vec<Struct, dynamic> vec, {int? rows, int? cols, MatType? type})
Create Mat from a vector Vec
factory
Mat.ones(int rows, int cols, MatType type)
Returns an array of all 1's of the specified size and type.
factory
Mat.randn(int rows, int cols, MatType type, {Scalar? mean, Scalar? std})
factory
Mat.randu(int rows, int cols, MatType type, {Scalar? low, Scalar? high})
factory
Mat.zeros(int rows, int cols, MatType type)
Returns a zero array of the specified size and type.
factory

Properties

channels int
no setter
cols int
no setter
countNoneZero int
only for channels == 1
no setter
data Uint8List
Get a view of native data, and will be GCed when the Mat is GCed.
no setter
dataPtr Pointer<U8>
Get the data pointer of the Mat
no setter
dims int
no setter
elemSize int
no setter
elemSize1 int
no setter
flags int
no setter
hashCode int
The hash code for this object.
no setterinherited
height int
no setter
isContinus bool
no setter
isEmpty bool
no setter
isSubmatrix bool
no setter
props List<Object?>
no setterinherited
ptr Pointer<Mat>
getter/setter pairinherited
ref → Mat
no setteroverride
rows int
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
shape List<int>
(rows, cols, channels)
no setter
size VecI32
Mat.size
no setter
step → (int, int, int)
no setter
total int
no setter
type MatType
no setter
width int
no setter

Methods

add<T>(T val, {bool inplace = false}) Mat
add
addF32(double val, {bool inplace = false}) Mat
addF64(double val, {bool inplace = false}) Mat
addI16(int val, {bool inplace = false}) Mat
addI32(int val, {bool inplace = false}) Mat
addI8(int val, {bool inplace = false}) Mat
addMat(Mat other, {bool inplace = false}) Mat
addU16(int val, {bool inplace = false}) Mat
addU8(int val, {bool inplace = false}) Mat
adjustROI(int dtop, int dbottom, int dleft, int dright) Mat
Adjusts a submatrix size and position within the parent matrix.
at<T>(int i0, int i1, [int? i2]) → T
cv::Mat::at<T>(i0, i1, i2) of cv::Mat
atNum(int i0, int i1, [int? i2]) num
wrapper of cv::Mat::at()
atPixel(int row, int col) List<num>
Get pixel value via row, col, returns a view of native data
atVec<T>(int row, int col) → T
clone() Mat
col(int x) Mat
Creates a matrix header for the specified matrix column.
colRange(int start, int end) Mat
Creates a matrix header for the specified column span.
convertTo(MatType type, {bool inplace = false, double alpha = 1, double beta = 0}) Mat
Converts an array to another data type with optional scaling.
convertToFp16() Mat
copyTo(Mat dst, {Mat? mask}) → void
Copies the matrix to another one.
copyToWithMask(Mat dst, Mat mask) → void
dispose() → void
divide<T>(T val, {bool inplace = false}) Mat
divide
divideF32(double val, {bool inplace = false}) Mat
divideF64(double val, {bool inplace = false}) Mat
divideI16(int val, {bool inplace = false}) Mat
divideI32(int val, {bool inplace = false}) Mat
divideI8(int val, {bool inplace = false}) Mat
divideMat(Mat other, {bool inplace = false}) Mat
divideU16(int val, {bool inplace = false}) Mat
divideU8(int val, {bool inplace = false}) Mat
forEachPixel(void callback(int row, int col, List<num> pixel)) → void
Iterate over all pixels in the Mat.
forEachRow(void callback(int row, List<num> values)) → void
Iterate over all rows in the Mat.
isSubtype<S, T>() bool
locateROI() → (Size, Point)
Locates the matrix header within a parent matrix.
mean({Mat? mask}) Scalar
mul(Mat other, {bool inplace = false, double scale = 1.0}) Mat
Performs an element-wise multiplication or division of the two matrices.
multiply<T>(T val, {bool inplace = false}) Mat
Multiply
multiplyF32(double val, {bool inplace = false}) Mat
multiplyF64(double val, {bool inplace = false}) Mat
multiplyI16(int val, {bool inplace = false}) Mat
multiplyI32(int val, {bool inplace = false}) Mat
multiplyI8(int val, {bool inplace = false}) Mat
multiplyMat(Mat other, {bool inplace = false}) Mat
Matrix multiplication
multiplyU16(int val, {bool inplace = false}) Mat
multiplyU8(int val, {bool inplace = false}) Mat
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
patchNaNs({double val = 0}) → void
PatchNaNs converts NaN's to zeros.
ptrAt<T extends NativeType>(int i0, [int? i1, int? i2]) Pointer<T>
equivalent to Mat::ptr<T>(i0, i1, i2)
ptrAtF16(int i0, [int? i1, int? i2]) Float16P
region(Rect rect) Mat
https://docs.opencv.org/4.x/d3/d63/classcv_1_1Mat.html#aa7ec97373406215f2d4bc72cc1d27036
release() → void
reshape(int cn, [int rows = 0]) Mat
Changes the shape and/or the number of channels of a 2D matrix without copying the data.
reshapeTo(int cn, List<int> newshape) Mat
https://docs.opencv.org/4.x/d3/d63/classcv_1_1Mat.html#ab2e41a510891e548f744832cf9b8ab89
rotate(int rotationCode, {bool inplace = false}) Mat
row(int y) Mat
Creates a matrix header for the specified matrix row.
rowRange(int start, int end) Mat
Creates a matrix header for the specified row span.
set<T>(int i0, int i1, T val, [int? i2]) → void
equivalent to Mat::at<T>(i0, i1, i2) = val; where T might be int, double, or cv::Vec<> like cv::Vec3b
setNum(int i0, int i1, num val, [int? i2]) → void
setTo(Scalar value, {Mat? mask}) Mat
Sets all or some of the array elements to the specified value.
setVec<T extends CvVec<Struct>>(int row, int col, T val) → void
sqrt() Mat
Calculates a square root of array elements.
stdDev() Scalar
Calculates standard deviation, per channel.
subtract<T>(T val, {bool inplace = false}) Mat
subtract
subtractF32(double val, {bool inplace = false}) Mat
subtractF64(double val, {bool inplace = false}) Mat
subtractI16(int val, {bool inplace = false}) Mat
subtractI32(int val, {bool inplace = false}) Mat
subtractI8(int val, {bool inplace = false}) Mat
subtractMat(Mat other, {bool inplace = false}) Mat
subtractU16(int val, {bool inplace = false}) Mat
subtractU8(int val, {bool inplace = false}) Mat
sum() Scalar
Sum calculates the per-channel pixel sum of an image.
t() Mat
Transposes a matrix.
toFmtString({int fmtType = FMT_NUMPY, int f16Precision = 4, int f32Precision = 8, int f64Precision = 16, bool multiLine = true}) String
toList() List<List<num>>
This Method converts single-channel Mat to 2D List
toList3D() List<List<List<num>>>
Returns a 3D list of the mat, only for multi-channel mats. The list is ordered as colchannels.
toString() String
A string representation of this object.
override
transpose({bool inplace = false}) Mat
variance() Scalar
Similar to stdDev

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

finalizer NativeFinalizer
final

Constants

FMT_C → const int
FMT_CSV → const int
FMT_DEFAULT → const int
FMT_MATLAB → const int
FMT_NUMPY → const int
FMT_PYTHON → const int