【发布时间】:2020-08-22 06:06:59
【问题描述】:
我们需要检测可调镜头产生的图像是否模糊。
我们希望找到模糊度的代理度量。
我目前的想法是首先沿 x 方向应用 Sobel,因为跳跃或条纹大多沿此方向。然后计算x方向的边际均值,最后计算出这些边际均值的标准差。
我们希望这个标准清晰的图像更大,模糊的图像更小,因为清晰的图像应该具有较大的强度或更大的像素值跳跃。
但我们得到相反的结果。我们如何改进这种模糊度测量?
def sobel_image_central_std(PATH):
# use the blue channel
img = cv2.imread(PATH)[:,:,0]
# extract the central part of the image
hh, ww = img.shape
hh2 = hh // 2
ww2 = ww// 2
hh4 = hh // 4
ww4 = hh //4
img_center = img[hh4:(hh2+hh4), ww4:(ww2+ww4)]
# Sobel operator
sobelx = cv2.Sobel(img_center, cv2.CV_64F, 1, 0, ksize=3)
x_marginal = sobelx.mean(axis = 0)
plt.plot(x_marginal)
return(x_marginal.std())
模糊 #1
模糊 #2
清除#1
清除#2
【问题讨论】: