一. 模糊图像评价基础知识

图像质量评价(IQA),根据参考图片(reference image),即原始图片的存在与否,可分为:

  • 全参考(full-reference)方法, 有原始图片的全部信息
  • 半参考(reduced-reference)方法, 只有原始图片的部分信息
  • 无参考(no-reference)方法,没有原始图片

模糊图片分类

  • defocus blur image 散焦模糊图像
  • motion blur image 运动模糊图像

图像模糊原因:

  • 确定性因素:包括成像系统调焦不当、目标物体相对运动等
  • 随机性因素:主要是图像在记录、传输过程中的污染,比如电子系统的高频性能不好造成图像高频分量的损失。

在频域,当一幅图像的高频部分被削弱时图像看起来会显得模糊。

在空域,图像的边界和细节部分不清晰时,图像看起来也会显得模糊。

二. 无参考图片算法实现(Python)

import cv2
import os
import timeclass Laplacian :def __init__(self, image_dir, recursion = False) :self.__image_dir = image_dirself.__image_paths = []for root_dir, sub_dirs, images in os.walk(image_dir, recursion) :for image in images :self.__image_paths.append(os.path.join(root_dir, image))def __read_image(self, image_path) :# In the case of color images, the decoded images will have the channels stored in **B G R** order.# When using IMREAD_GRAYSCALE, the codec's internal grayscale conversion will be used, if available.# Results may differ to the output of cvtColor()return cv2.imread(image_path, cv2.IMREAD_GRAYSCALE)def __pre_process_image(self, image_path, **kwargs) :image = self.__read_image(image_path)if kwargs.get('width') and kwargs.get('height') :image = cv2.resize(image, (kwargs.get('width'), kwargs.get('height')))return imagedef get_image_paths(self) :return self.__image_pathsdef blur_detect(self, image_path) :cv_image = self.__pre_process_image(image_path, width = 200, height = 200)return cv2.Laplacian(cv_image, cv2.CV_64F).var()def test_laplacian() :laplacian = Laplacian('dir of images that you want to detect with laplacian', False)image_paths = laplacian.get_image_paths()for path in image_paths :begin = time.time() * 1000score = laplacian.blur_detect(path)end = time.time() * 1000print("Laplacian detection {} value is {}, cost time {} ms".format(path, int(score), end - begin))if __name__ == "__main__" :test_laplacian()

代码核心是OpenCV提供的接口cv2.Laplacian

def Laplacian(src, ddepth, dst=None, ksize=None, scale=None, delta=None, borderType=None):
“”"
Laplacian(src, ddepth[, dst[, ksize[, scale[, delta[, borderType]]]]]) -> dst
. @brief Calculates the Laplacian of an image.
.
. The function calculates the Laplacian of the source image by adding up the second x and y
. derivatives calculated using the Sobel operator:
.
. \f[\texttt{dst} = \Delta \texttt{src} = \frac{\partial^2 \texttt{src}}{\partial x^2} + \frac{\partial^2 \texttt{src}}{\partial y^2}\f]
.
. This is done when ksize > 1. When ksize == 1, the Laplacian is computed by filtering the image
. with the following \fKaTeX parse error: Undefined control sequence: \f at position 11: 3 \times 3\̲f̲ aperture:
.
. \f[\vecthreethree {0}{1}{0}{1}{-4}{1}{0}{1}{0}\f]
.
. @param src Source image.
. @param dst Destination image of the same size and the same number of channels as src .
. @param ddepth Desired depth of the destination image.
. @param ksize Aperture size used to compute the second-derivative filters. See #getDerivKernels for
. details. The size must be positive and odd.
. @param scale Optional scale factor for the computed Laplacian values. By default, no scaling is
. applied. See #getDerivKernels for details.
. @param delta Optional delta value that is added to the results prior to storing them in dst .
. @param borderType Pixel extrapolation method, see #BorderTypes
. @sa Sobel, Scharr
“”"
pass

可以在__pre_process_image中进行图像的预处理,统一图像尺寸,类似于归一化的作用。

三. 算法评价

尝试用这个算法用于人脸识别的预处理步骤,判断人脸图片是否模糊。实际测试结果来看,单用拉普拉斯算子进行卷积运算,无法很好的评价人脸是否模糊。

目前从我测试的情况看,下面两篇参考文章提到的基于二次模糊的清晰度算法(ReBlur) 比较推荐使用。

  1. 面向无参考图像的清晰度评价方法研究
  2. The Blur Effect: Perception and Estimation with a New No-Reference Perceptual Blur Metric

基于拉普拉斯算子的模糊图像评价相关推荐

  1. OpenCV图像处理 空间域图像增强(图像锐化 1 基于拉普拉斯算子)

    http://ggicci.blog.163.com/blog/static/210364096201262123236955/ OpenCV OpenCV 图像锐化 拉普拉斯算子 ( Laplaci ...

  2. python 拉普拉斯锐化_OpenCV-python 实现基于拉普拉斯算子的图像锐化

    一.基础知识 积分运算的模板卷积可以平滑图像,微分运算的模板卷积可以锐化图像 拉普拉斯算子是一种各向同性的二阶微分算子,根据定义有: 说明:各向同性指图像的性质不会因为方向不同而变化. 将两个分别沿X ...

  3. 空间滤波_第三章 灰度变换与空间滤波-(六)锐化空间滤波器之拉普拉斯算子...

    我们知道的东西是有限的,我们不知道的东西则是无穷的.----拉普拉斯 普拉斯算子 既然我们知道了二阶微分是对图像锐化处理的一大利器,我们本节就来讨论二阶微分在数字图像领域的实际应用. 拉普拉斯在就为我 ...

  4. 拉普拉斯算子属于卷积方法吗_2020 年 GNN 开卷有益与再谈图卷积

    题记 2019 年,GNN 从来没有这样繁荣过.一方面,计算机视觉.自然语言处理等领域都忽如一夜春风来,反复"发现"了自身潜在的 Graph 结构,与 GNN 融合.另一方面,GN ...

  5. python 图像处理 拉普拉斯算子的实现和改进-LoG和DoG算子

    拉普拉斯算子 拉普拉斯算子是最简单的各向同性微分算子,它具有旋转不变性. 我们经常把它作为边缘检测之一,也是工程数学中常用的一种积分变换,也可以用于图像增强.角点检测等等. 这里只给出它的代码,原理可 ...

  6. python 拉普拉斯锐化_(二十四)用二阶微分(拉普拉斯算子)实现图像锐化

    时间为友,记录点滴. 我们已经了解过了梯度(一阶微分)的作用,那么为什么要引入二阶微分呢?二阶微分的作用是什么? 还是看图说话: 很明显,一阶微分已经可以把轮廓辨识出来,但是,对于变化较缓的地方,一阶 ...

  7. matlab拉普拉斯算子锐化,cv-拉普拉斯算子锐化浅析

    式(3.7.1)中的二维拉普拉斯数字实现可由这两个分量相加得到: 从而得到拉普拉斯算子 意思同上面的一阶微分算子相同. 这里解释一下微分算子的使用,很简单,如上面这个就是在处理每个像素点的RGB值时, ...

  8. matlab拉普拉斯算子边缘提取_(二十四)用二阶微分(拉普拉斯算子)实现图像锐化...

    时间为友,记录点滴. 我们已经了解过了梯度(一阶微分)的作用,那么为什么要引入二阶微分呢? 二阶微分的作用是什么? 还是看图说话: 很明显,一阶微分已经可以把轮廓辨识出来,但是,对于变化较缓的地方,一 ...

  9. OpenCV拉普拉斯算子使用

    拉普拉斯算子的计算在浮点数类型的图像上进行.要对结果做缩放处理才能使其正常显示.缩放基于拉普拉斯算子的最大绝对值,其中数值 0 对应灰度级 128.类中有一个方 法可获得下面的图像表示: // 获得拉 ...

最新文章

  1. CMB标量功率谱第二个谱指数跑动项n(2)跑动带来的影响
  2. 美轮美奂宇宙星空制作神器Spacescape
  3. (一)vue 数据更新 试图不更新 解决办法
  4. ftp改为sftp_浅谈 FTP、FTPS 与 SFTP
  5. Vue CLI 3 可以使用 TypeScript 生成新工程
  6. 区分 JSON 字符串与JSON对象
  7. vm磁盘映射 不能启动_软网推荐:网盘变身本地磁盘
  8. 【Interfacenavigation】按钮(29)
  9. ireport 生成一维码 和 二维码 小记
  10. 用python打印心形_Python和Js打印心形
  11. ubuntu安装包常用下载地址
  12. android intent singletask,singleTask模式Activity二次start接收Intent失败?
  13. VLC支持的视频和音频文件扩展名
  14. Office 365系列之十三:Office 365管理员角色
  15. Photoshop通过抠图法给照片换背景-PS换背景教程
  16. OSChina 周三乱弹 —— 致力于做一名优秀的女程序员鼓励师
  17. verilog简单奇校验
  18. 通过OTA的方式在局域网分发iOS应用
  19. linux中永久别名 mac,mac 设置 ll 等alias 并永久生效
  20. js submit onsubmit区别

热门文章

  1. 转: 两款优秀的服务器网络流量监控工具:Ntopng和Munin-功能强大直观
  2. 【JAVA】将多个WAV或MP3文件合成一个文件
  3. three.js+shader 制作粒子飞线,小蝌蚪那种。
  4. html图片颜色加深,PS图层混合模式解析:变暗/正片叠底/颜色加深/线性加深/深色...
  5. doc文件乱码怎么恢复?
  6. openlayers加载超图发布的wfs服务
  7. Caldera安装及简单使用
  8. 手机SD卡读不出来怎么办(转自百度经验)
  9. linux镜像写入另一个硬盘,服务器DD命令将已有的硬盘镜像文件直接写到别的硬盘上...
  10. python爬取快手app视频(fiddler抓json包实现)