[][src]Function opencv::core::psnr

pub fn psnr(
    src1: &dyn ToInputArray,
    src2: &dyn ToInputArray,
    r: f64
) -> Result<f64>

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:

block formula

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.

Parameters

  • src1: first input array.
  • src2: second input array of the same size as src1.
  • R: the maximum pixel value (255 by default)

C++ default parameters

  • r: 255.