如何使用OpenCV(Python/C ++)消除图像的模糊性 [英] How to remove blurriness from an image using opencv (python/c++)

查看:1363
本文介绍了如何使用OpenCV(Python/C ++)消除图像的模糊性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用opencv来检测实时视频供稿中的人物.我需要保存检测到的人的图像.但是这里的人没有站立并且一直在移动,因此当我要保存图像时,图像会以非常模糊的格式保存,就像下面的图像一样:

I am using opencv to detect person in live video feed. I need to save the image of the person detected. But here the person is not standing and is keeps moving due to which when I am about to save the image, it is saved in very blurry format, just like below image:

如您所见,图像不是很清晰,并且模糊很多.脸也不清楚.无论如何,我们可以消除图像的模糊性.谢谢

As you can see the image is not very clear and has a lot of blurriness into it. Face is also not clear. Is there anyway we can remove the blurriness from image. Thanks

推荐答案

您可以尝试使用

You can try sharpening the image using cv2.filter2D() and a generic sharpening kernel

这里还有其他锐化内核,您可以尝试

Here are other sharpening kernels you can experiment with

import cv2
import numpy as np

image = cv2.imread('1.jpg')
sharpen_kernel = np.array([[-1,-1,-1], [-1,9,-1], [-1,-1,-1]])
sharpen = cv2.filter2D(image, -1, sharpen_kernel)

cv2.imshow('sharpen', sharpen)
cv2.waitKey()

这篇关于如何使用OpenCV(Python/C ++)消除图像的模糊性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆