Table of Contents

Method GetValueRef

Namespace
OpenCvSharp
Assembly
OpenCvSharp.dll

GetValueRef(ReadOnlySpan<int>)

Returns a reference to the element at the given index, creating it (zero-initialized) if it does not exist. Useful for in-place updates such as accumulation (sm.GetValueRef(i, j)++), which performs a single hash lookup.

public ref T GetValueRef(ReadOnlySpan<int> index)

Parameters

index ReadOnlySpan<int>

Returns

T

Remarks

The reference points into native storage and is only valid until the next structural change to the matrix (an insertion that triggers a rehash, Clear(), disposal, etc.). Do not retain it across such operations.