setIdentity
import { setIdentity } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
ARGUMENTSmtx, s
FUNCTIONsetIdentity
RETURN TYPEvoid
Initializes a scaled identity matrix.
The function cv::setIdentity initializes a scaled identity matrix:
\texttt{mtx} (i,j)= \fork{\texttt{value}}{ if \(i=j\)}{0}{otherwise}
The function can also be emulated using the matrix initializers and the matrix expressions:
Mat A = Mat::eye(4, 3, CV_32F)*5;
// A will be set to [[5, 0, 0], [0, 5, 0], [0, 0, 5], [0, 0, 0]]
See: Mat::zeros, Mat::ones, Mat::setTo, Mat::operator=
setIdentity(mtx: Mat, s: Scalar): void;mtxInput/output value, modified by the native operation. matrix to initialize (not necessarily square).
svalue to assign to diagonal elements.
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.