The SNR and peak signal-to-noise ratio are usually used to evaluate the quality of an image after compression compared with the original image. Of course, after compression, the image quality will be worse than that of the original image, therefore, such an evaluation indicator is used to set standards. The higher the SNR, the smaller the distortion after compression. Here we mainly define two values: one is the mean variance MSE and the other is the peak SNR. The formula is as follows:
The Max here is usually the gray level of the image, which is generally 255.
No compression is needed here.AlgorithmAnd then zoom in the image. below isCode:
Close all; clear all; clc; IMG = Imread ( ' Lena.jpg ' ); [H w] = Size (IMG); imgn = Imresize (IMG, [floor (H/ 2 ) Floor (W/ 2 )]); Imgn = Imresize (imgn, [H w]); IMG = Double (IMG); imgn = Double (imgn); B = 8 ; % Encode the maximum number of binary bits for a pixel Max = 2 ^ B- 1 ; % Number of gray-scale mes Images = Sum (IMG-imgn). ^ 2)/(h * W); % mean variance SNR = 20 * Log10 (max/SQRT (MES); % Peak Signal-to-Noise Ratio
Source image
The image width and height are reduced by 1/2 and then to the source image. The SNR is 30.2db.
The image width and height are reduced by 1/5 and then to the source image. The SNR is 24.5db.
The higher the SNR, the closer the image to the source image. Of course, this is all objective indicators, and there are still subjective indicators for actual evaluation. However, subjective things are vague and everyone feels different.
One of my colleagues came to me twice for the sake of SNR because they didn't perform image compression and transmission, so they didn't help me at the time. But later I got familiar with this part. Maybe he will be able to help me when he comes.
Reference: 1. http://zh.wikipedia.org/wiki/%E5%B3%B0%E5%80%BC%E4%BF%A1%E5%99%AA%E6%AF%94