1,PSNR

PSNR is most easily defined via the mean squared error (MSE). Given a noise-free m×n monochrome image I and its noisy approximation KMSE is defined as:

The PSNR (in dB) is defined as:

Here, MAXI is the maximum possible pixel value of the image. When the pixels are represented using 8 bits per sample, this is 255. More generally, when samples are represented using linear PCM with B bits per sample, MAXI is 2^B−1.

In the formula for PSNR, the value of R is decided by the format of the image. If the image is an 8 bit image, R = 255. If the image is expressed using floating point numbers, R = 1.

PSNR 和 MSE 就是基于这种简单直接的思路确定的指标,MSE(Mean Squared Error),顾名思义,定义略。PSNR(Peak Signal to Noise Ratio),峰值信噪比,即峰值信号的能量与噪声的平均能量之比,通常表示的时候取 log 变成分贝(dB),由于 MSE 为真实图像与含噪图像之差的能量均值,而两者的差即为噪声,因此 PSNR 即峰值信号能量与 MSE 之比.

MSE = ∑ ∑ ( [n1[i]-n2[i]] ) ^ 2  / m * n
///n1 is the original image, n2 the comparable image, m and n are the image size
PSNR = 10 log₁₀ ( MAX ^ 2 / MSE )
///MAX is the maximum possible pixel value of the image
///For 3D signals (colored image), your MSE needs to sum all the means for each plane (ie: RGB, YUV and etc) and then divide by 3 (or 3 * MAX ^ 2).

图像质量评估指标 SSIM / PSNR / MSE:https://blog.csdn.net/edogawachia/article/details/78756680 

峰值信噪比公式_关于 PSNR (Peak Signal-to-Noise Ratio) 峰值信噪比的个人理解https://blog.csdn.net/weixin_32027491/article/details/114017210 

2,信噪比SNR

关于信噪比SNR:http://blog.sina.com.cn/s/blog_4bd91d540100l5yn.html

Application in color images

For color images with three RGB values per pixel, the definition of PSNR is the same except the MSE is the sum over all squared value differences (now for each color, i.e. three times as many differences as in a monochrome image) divided by image size and by three. Alternately, for color images the image is converted to a different color space and PSNR is reported against each channel of that color space, e.g., YCbCr or HSL.

For colour images, the MSE is taken over all pixels values of each individual channel and is averaged with the number of colour channels.  Another option may be to simply perform the PSNR over a converted luminance or grayscale channel as the eye is generally four times more susceptible to luminance changes as opposed to changes in chrominance.  This approximation is left up to the experimenter.

close all;
clear all;
clc;
%PSNR的计算
old=imread('carrier.bmp');
%old=rgb2gray(old);
new=imread('compute.bmp');
%new=rgb2gray(new);
[h,w]=size(old);
img=double(old);
imgn=double(new);

B=8;                %编码一个像素用多少二进制位
MAX=2.^B-1;          %图像有多少灰度级
MES=sum(sum((img-imgn).^2))/(h*w);     %均方差
averageMES=sum(MES(:))/3;
PSNR=20*log10(MAX/sqrt(averageMES));           %峰值信噪比

Motivation for Use as an Image Quality Metric

The mean squared error (MSE) for our practical purposes allows us to compare the “true” pixel values of our original image to our degraded image.   The MSE represents the average of the squares of the "errors" between our actual image and our noisy image. The error is the amount by which the values of the original image differ from the degraded image.

The proposal is that the higher the PSNR, the better degraded image has been reconstructed to match the original image and the better the reconstructive algorithm.  This would occur because we wish to minimize the MSE between images with respect the maximum signal value of the image.

When you try to compute the MSE between two identical images, the value will be zero and hence the PSNR will be undefined (division by zero).  The main limitation of this metric is that it relies strictly on numeric comparison and does not actually take into account any level of biological factors of the human vision system such as the structural similarity index. (SSIM)

#calculate_psnr.py
import numpy as np
def calculate_psnr(img1, img2, max_value=255):
    """"Calculating peak signal-to-noise ratio (PSNR) between two images."""
    mse = np.mean((np.array(img1, dtype=np.float32) - np.array(img2, dtype=np.float32)) ** 2)
    if mse == 0:
        return 100
    return 20 * np.log10(max_value / (np.sqrt(mse)))

#############################第2种代码
import numpy 
import math
import cv2
original = cv2.imread("original.png")
contrast = cv2.imread("photoshopped.png",1)
def psnr(img1, img2):
    mse = numpy.mean( (img1 - img2) ** 2 )
    if mse == 0:
    return 100
    PIXEL_MAX = 255.0
    return 20 * math.log10(PIXEL_MAX / math.sqrt(mse))

d=psnr(original,contrast)
#d= cv2.PSNR(original,contrast)
print(d)

########################################第三种
from math import log10, sqrt 
import cv2 
import numpy as np 

def PSNR(original, compressed): 
	mse = np.mean((original - compressed) ** 2) 
	if(mse == 0): # MSE is zero means no noise is present in the signal . 
				# Therefore PSNR have no importance. 
		return 100
	max_pixel = 255.0
	psnr = 20 * log10(max_pixel / sqrt(mse)) 
	return psnr 

def main(): 
	original = cv2.imread("original_image.png") 
	compressed = cv2.imread("compressed_image.png", 1) 
	value = PSNR(original, compressed) 
	print(f"PSNR value is {value} dB") 
	
if __name__ == "__main__": 
	main() 

3,视频编解码质量评价---BDBR与BD-PSNR

https://blog.csdn.net/sinat_33718563/article/details/78387190

参考:

https://en.wikipedia.org/wiki/Peak_signal-to-noise_ratio

https://blog.csdn.net/u012193330/article/details/42426271

Python 计算彩色图像信噪比https://blog.csdn.net/u013185349/article/details/85122008

4,视频编解码质量评价---SSIM

SSIM(structural similarity index)结构相似性算法原理及python实现https://blog.csdn.net/qq_17457331/article/details/88044462

两种常用的全参考图像质量评价指标--PSNR和SSIMhttps://blog.csdn.net/zjyruobing/article/details/49908979

图像处理PSNR及其计算(OpenCV和matlab实现):https://blog.csdn.net/laoxuan2011/article/details/51519062

PSNR与SNR概念:https://blog.csdn.net/slz0813/article/details/82971017

SNR、PSNR、MSE:https://blog.csdn.net/ueh286/article/details/101202617

PSNR的计算https://blog.csdn.net/xiaohaijiejie/article/details/44730891 

评价图像质量SNR和PSNR,以及计算信息熵的代码https://blog.csdn.net/math_new_photo/article/details/109251507

 

5,亮度,照度,光通量

光是一种肉眼可以看见的电磁波是由一种称为光子的基本粒子组成。

光强度: 是指光源在给定方向上的发光强度,它的单位是坎德拉cd(candela)。

光通量: 光源在单位时间内向各个角度所发射出的光量称为光源的发光通量,按大家能理解的语言来解释就是一个光源发出了多少光子。光通量的单位是流明(lm).  下图灯泡四周的黄线.

亮度:指的是人在看光源时,眼睛感觉到的光亮度,亮度是指发光体表面的发光强弱。亮度高低决定于光源的色温高低和光源的光通量,光源的光通量多少是决定性因素。光源的光通量多,亮度就高。亮度是指发光体表面的发光强弱。亮度是人对光的强度的感受,是一个主观的量。因此在物理学中并不常用。亮度和反射率有关的,手心手背的反射率不一样,从而导致了亮度的明暗之别.

照度:指的是光源照射到周围空间或地面上,单位被照射面积上的光通量。单位被照射面积上的光通量多,照度就高。按大家能理解的语言来解释,就是被照物体上有多少光子。

6,Image Quality Assessment(综述) 

https://blog.csdn.net/lxlhexl/article/details/107424457

Quality Assessment Paper List(研二):https://blog.csdn.net/lxlhexl/article/details/90312462

Logo

DAMO开发者矩阵,由阿里巴巴达摩院和中国互联网协会联合发起,致力于探讨最前沿的技术趋势与应用成果,搭建高质量的交流与分享平台,推动技术创新与产业应用链接,围绕“人工智能与新型计算”构建开放共享的开发者生态。

更多推荐