PSNR
import { PSNR } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Computes the Peak Signal-to-Noise Ratio (PSNR) image quality metric.
This function calculates the Peak Signal-to-Noise Ratio (PSNR) image quality metric in decibels (dB), between two input arrays src1 and src2. The arrays must have the same type.
The PSNR is calculated as follows:
\texttt{PSNR} = 10 \cdot \log_{10}{\left( \frac{R^2}{MSE} \right) }
where R is the maximum integer value of depth (e.g. 255 in the case of CV_8U data) and MSE is the mean squared error between the two arrays.
PSNR(src1: Mat, src2: Mat, R: number): number;2 available overloads
PSNR(src1: Mat, src2: Mat): number;PSNR(src1: Mat, src2: Mat, R: number): number;src1first input array.
src2second input array of the same size as src1.
Rthe maximum pixel value (255 by default)
The number 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.