目录
图像评价方法:
图像评价方法分为主观评价和客观评价
非参考指标来评估水下图像:
主观评价
FE: 由于不正确的色彩校正算法,具有明显的红色偏色。
RB: 可以增强水下图像质量,同时生成一些暗淡的图像。
UDCP: 加剧了蓝绿色效果。
CycleGAN: 对图像的积极作用有限,因为图像到图像的转换不适用于水下图像增强。
WSCT: 在某些水下图像中引入了绿色调,部分原因是缺乏稳定GAN训练的技术。 如WSCT的第一个图像中,背景引入了绿色偏差。
客观评价:
水下彩色图像质量评估(UCIQE)和水下图像质量度量(UIQM)本篇文章主要讲这俩种非参考评价方法
①水下彩色图像质量评估(UCIQE): 利用色度、饱和度和对比度的线性组合进行定量评估,分别量化不均匀的偏色、模糊和低对比度。
UCIQE = 0.4680*delta + 0.2745*conl + 0.2575*mu
python-opencv代码如下:
import cv2
import math
import numpy as np
image = cv2.imread("an3.jpg")#图片路径
hsv = cv2.cvtColor(image, cv2.COLOR_RGB2HSV) # RGB转为HSV
H, S, V = cv2.split(hsv)
delta = np.std(H) /180 #色度的标准差
mu = np.mean(S) /255 #饱和度的平均值
n, m = np.shape(V)
number = math.floor(n*m/100) #所需像素的个数
Maxsum, Minsum = 0, 0
V1, V2 = V /255, V/255
for i in range(1, number+1):
Maxvalue = np.amax(np.amax(V1))
x, y = np.where(V1 == Maxvalue)
Maxsum = Maxsum + V1[x[0],y[0]]
V1[x[0],y[0]] = 0
top = Maxsum/number
for i in range(1, number+1):
Minvalue = np.amin(np.amin(V2))
X, Y = np.where(V2 == Minvalue)
Minsum = Minsum + V2[X[0],Y[0]]
V2[X[0],Y[0]] = 1
bottom = Minsum/number
conl = top-bottom
###对比度
uciqe = 0.4680*delta + 0.2745*conl + 0.2575*mu
print(delta, conl, mu)
print(uciqe)
②水下图像质量度量(UIQM): 包含水下图像的三个属性,如水下图像色彩度测量(UICM)水下图像清晰度度量(UISM)和水下图像对比度度量(UIConM)。
UIQM=c1*UICM+c2*UISM+c3*UIConM
UCIQE和UIQM的值越高,表示图像质量越好。
python-opencv代码如下:
import cv2
import math
import numpy as np
def uicm(img):
b, r, g = cv2.split(img)
RG = r - g
YB = (r + g)/2 - b
m, n, o = np.shape(img) #img为三维 rbg为二维
K = m*n
alpha_L = 0.1
alpha_R = 0.1 ##参数α 可调
T_alpha_L = math.ceil(alpha_L*K) #向上取整
T_alpha_R = math.floor(alpha_R*K) #向下取整
RG_list = RG.flatten()
RG_list = sorted(RG_list)
sum_RG = 0
for i in range(T_alpha_L+1, K-T_alpha_R ):
sum_RG = sum_RG + RG_list[i]
U_RG = sum_RG/(K - T_alpha_R - T_alpha_L)
squ_RG = 0
for i in range(K):
squ_RG = squ_RG + np.square(RG_list[i] - U_RG)
sigma2_RG = squ_RG/K
YB_list = YB.flatten()
YB_list = sorted(YB_list)
sum_YB = 0
for i in range(T_alpha_L+1, K-T_alpha_R ):
sum_YB = sum_YB + YB_list[i]
U_YB = sum_YB/(K - T_alpha_R - T_alpha_L)
squ_YB = 0
for i in range(K):
squ_YB = squ_YB + np.square(YB_list[i] - U_YB)
sigma2_YB = squ_YB/K
Uicm = -0.0268*np.sqrt(np.square(U_RG) + np.square(U_YB)) + 0.1586*np.sqrt(sigma2_RG + sigma2_YB)
return Uicm
def EME(rbg, L):
m, n = np.shape(rbg) #横向为n列 纵向为m行
number_m = math.floor(m/L)
number_n = math.floor(n/L)
#A1 = np.zeros((L, L))
m1 = 0
E = 0
for i in range(number_m):
n1 = 0
for t in range(number_n):
A1 = rbg[m1:m1+L, n1:n1+L]
rbg_min = np.amin(np.amin(A1))
rbg_max = np.amax(np.amax(A1))
if rbg_min > 0 :
rbg_ratio = rbg_max/rbg_min
else :
rbg_ratio = rbg_max ###
E = E + np.log(rbg_ratio + 1e-5)
n1 = n1 + L
m1 = m1 + L
E_sum = 2*E/(number_m*number_n)
return E_sum
def UICONM(rbg, L): #wrong
m, n, o = np.shape(rbg) #横向为n列 纵向为m行
number_m = math.floor(m/L)
number_n = math.floor(n/L)
A1 = np.zeros((L, L)) #全0矩阵
m1 = 0
logAMEE = 0
for i in range(number_m):
n1 = 0
for t in range(number_n):
A1 = rbg[m1:m1+L, n1:n1+L]
rbg_min = int(np.amin(np.amin(A1)))
rbg_max = int(np.amax(np.amax(A1)))
plip_add = rbg_max+rbg_min-rbg_max*rbg_min/1026
if 1026-rbg_min > 0:
plip_del = 1026*(rbg_max-rbg_min)/(1026-rbg_min)
if plip_del > 0 and plip_add > 0:
local_a = plip_del/plip_add
local_b = math.log(plip_del/plip_add)
phi = local_a * local_b
logAMEE = logAMEE + phi
n1 = n1 + L
m1 = m1 + L
logAMEE = 1026-1026*((1-logAMEE/1026)**(1/(number_n*number_m)))
return logAMEE
if __name__ == '__main__':
img = cv2.imread('u=3138476632,3557028501&fm=26&gp=0.jpg')
r, b, g = cv2.split(img)
Uicm = uicm(img)
EME_r = EME(r, 8)
EME_b = EME(b, 8)
EME_g = EME(g, 8)
Uism = 0.299*EME_r + 0.144*EME_b + 0.557*EME_g
Uiconm = UICONM(img, 8)
uiqm = 0.0282*Uicm + 0.2953*Uism + 0.6765*Uiconm
print(uiqm)