convertScaleAbs
import { convertScaleAbs } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Scales, calculates absolute values, and converts the result to 8-bit.
On each element of the input array, the function convertScaleAbs performs three operations sequentially: scaling, taking an absolute value, conversion to an unsigned 8-bit type:
\texttt{dst} (I)= \texttt{saturate\_cast<uchar>} (| \texttt{src} (I)* \texttt{alpha} + \texttt{beta} |)
In case of multi-channel arrays, the function processes each channel independently. When the output is not 8-bit, the operation can be emulated by calling the Mat::convertTo method (or by using matrix expressions) and then by calculating an absolute value of the result. For example:
Mat_<float> A(30,30);
randu(A, Scalar(-100), Scalar(100));
Mat_<float> B = A*5 + 3;
B = abs(B);
// Mat_<float> B = abs(A*5+3) will also do the job,
// but it will allocate a temporary matrix
See: Mat::convertTo, cv::abs(const Mat&)
convertScaleAbs(src: Mat, dst: Mat, alpha: number, beta: number): void;3 available overloads
convertScaleAbs(src: Mat, dst: Mat): void;convertScaleAbs(src: Mat, dst: Mat, alpha: number): void;convertScaleAbs(src: Mat, dst: Mat, alpha: number, beta: number): void;srcinput array.
dstOutput destination, filled by the native operation. output array.
alphaoptional scale factor.
betaoptional delta added to the scaled values.
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.