Skip to content

trace

Core and matricesfunctionOpenCV 5.0.0
import { trace } from '@banou/opencv-wasm'

Use after await initOpenCV(). See the initialization and named imports guide.

ARGUMENTSmtx
FUNCTIONtrace
RETURN TYPEScalar
Call structure. A void return can still write to destination arguments. The parameter descriptions define inputs, outputs and ownership.

Returns the trace of a matrix.

The function cv::trace returns the sum of the diagonal elements of the matrix mtx .

\mathrm{tr} ( \texttt{mtx} ) =  \sum _i  \texttt{mtx} (i,i)
trace(mtx: Mat): Scalar;
mtx

input matrix.

Returns

The Scalar result.

These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.