通常的图像清晰度检测大都是计算sobel、拉普拉斯算子的方差,不过大多数时候,拉普拉斯算子方法需要进行大量的手动调整,才能定义图像是否被视为模糊。如果您可以控制照明条件,环境和图像捕获过程,则效果很好,否则不会得到理想的结果。
图像清晰度检测通常的目的是图像质量分级、自动丢弃模糊/低质量的图像、OCR应用于实时视频流(识别其中质量好的图片)等等。
在计算机视觉方面,我们经常将FFT视为代表两个域中的图像的图像处理工具:傅立叶(即频域)域、空间域,因此,FFT以实部和虚部表示图像。通过分析这些值,我们可以执行图像处理例程,例如模糊,边缘检测,阈值化,纹理分析,甚至可以进行模糊检测。
import matplotlib.pyplot as pltimport numpy as npimport argparseimport imutilsimport cv2def detect_blur_fft(image, size=60, thresh=10, vis=False):# grab the dimensions of the image and use the dimensions to# derive the center (x, y)-coordinates(h, w) = image.shape(cX, cY) = (int(w / 2.0), int(h / 2.0))# compute the FFT to find the frequency transform, then shift# the zero frequency component (i