Table of Contents

Class SparseMat

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

Sparse matrix (cv::SparseMat). This type-erased base exposes the structural and metadata operations that do not depend on the element type. For typed element access use SparseMat<T> (e.g. via As<T>()).

public class SparseMat : CvObject, IDisposable
Inheritance
SparseMat
Implements
Derived
Inherited Members

Constructors

SparseMat()

Creates an empty SparseMat.

SparseMat(Mat)

Converts a dense cv::Mat to a sparse matrix.

SparseMat(IEnumerable<int>, MatType)

Constructs an n-dimensional sparse matrix.

SparseMat(nint)

Creates from a native cv::SparseMat* pointer.

Methods

AddRef()

Manually increments the reference counter to the header.

As<T>()

Returns a typed view of this sparse matrix. The element type must match this matrix's type. The returned matrix shares the data with this one (O(1)).

AssignFrom(Mat)

Assignment from a dense matrix (equivalent to the corresponding constructor).

AssignFrom(SparseMat)

Assignment operator. This is an O(1) operation that shares the data.

AssignTo(SparseMat, MatType?)
Channels()

Returns the number of sparse matrix channels.

Clear()

Sets all the matrix elements to 0, which means clearing the hash table.

Clone()

Creates a full copy of the matrix.

ConvertTo(Mat, MatType, double, double)

Converts sparse matrix to dense matrix.

ConvertTo(SparseMat, MatType, double)

Multiplies all the matrix elements by the specified scale factor.

CopyTo(Mat)

Converts the sparse matrix to a dense matrix.

CopyTo(SparseMat)

Copies all the data to another sparse matrix.

Create(MatType, params int[])

Reallocates the sparse matrix.

Depth()

Returns the depth of sparse matrix element.

Dims()

Returns the matrix dimensionality.

ElemSize()

Returns the size of each element in bytes.

ElemSize1()

Returns the size of each element channel in bytes.

FromMat(Mat)

Creates a sparse matrix from a dense cv::Mat.

NzCount()

Returns the number of non-zero elements (the number of hash table nodes).

Release()

Releases the resources.

Size()

Returns the array of sizes, or null if the matrix is not allocated.

Size(int)

Returns the size of i-th matrix dimension (or 0).

ToMat()

Converts this sparse matrix to a new dense Mat of the same type.

ToString()

Returns a string that represents this SparseMat.

Type()

Returns the type of sparse matrix element.