Table of Contents

Method GetIndexer

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

GetIndexer()

Gets a type-specific indexer for fast repeated element access. The indexer captures the data pointer once, so it is faster than this[row, col] for tight loops.

public MatIndexer<TElem> GetIndexer()

Returns

MatIndexer<TElem>

Remarks

The indexer keeps this matrix alive, but it caches the data pointer at creation time. Do not keep using an indexer after an operation that may reallocate the matrix data (e.g. Create(int, int, MatType)); obtain a fresh one instead. For occasional access prefer the this[row, col] indexer, which resolves the pointer each time.