PSNR
Compute peak signaltonoise ratio (PSNR) between images
 Library:
Computer Vision Toolbox / Statistics
Description
The PSNR block computes the peak signaltonoise ratio, in decibels, between two images. This ratio is used as a quality measurement between the original and a compressed image. The higher the PSNR, the better the quality of the compressed, or reconstructed image.
The meansquare error (MSE) and the peak signaltonoise ratio (PSNR) are used to compare image compression quality. The MSE represents the cumulative squared error between the compressed and the original image, whereas PSNR represents a measure of the peak error. The lower the value of MSE, the lower the error.
To compute the PSNR, the block first calculates the meansquared error using the following equation:
$$MSE=\frac{{\displaystyle \sum _{M,N}{[{I}_{1}(m,n){I}_{2}(m,n)]}^{2}}}{M*N}$$
In the previous equation, M and N are the number of rows and columns in the input images. Then the block computes the PSNR using the following equation:
$$PSNR=10{\mathrm{log}}_{10}\left(\frac{{R}^{2}}{MSE}\right)$$
In the previous equation, R is the maximum fluctuation in the input image data type. For example, if the input image has a doubleprecision floatingpoint data type, then R is 1. If it has an 8bit unsigned integer data type, R is 255, etc.
Computing PSNR for Color Images
Different approaches exist for computing the PSNR of a color image. Because the human eye is most sensitive to luma information, you can compute the PSNR for color images by converting the image to a color space that separates the intensity (luma) channel, such as YCbCr. The Y (luma), in YCbCr represents a weighted average of R, G, and B. G is given the most weight, again because the human eye perceives it most easily. Compute the PSNR only on the luma channel.
Ports
Input
Output
Model Examples
Block Characteristics
Data Types 

Multidimensional Signals 

VariableSize Signals 
