边缘检测后去除噪点_对图像进行去模糊以执行边缘检测

I have this image:

I am trying to put the background into focus in order to perform edge-detection on the image. What would be the methods available to me (either on

space/frequency filed)?

What I tried is the following:

kernel = np.array([[-1,-1,-1], [-1,9,-1], [-1,-1,-1]])

im = cv2.filter2D(equ, -1, kernel)

This outputs this image:

I also played around with the centre value but with no positive result.

I also tried this:

psf = np.ones((5, 5)) / 25

equ = convolve2d(equ, psf, 'same')

deconvolved = restoration.wiener(equ, psf, 1, clip=False)

plt.imshow(deconvolved, cmap='gray')

With no appreciable changes to the image.

Any help on the matter is greatly appreciated!

EDIT:

Here is the code that I took from here:

psf = np.ones((5, 5)) / 25

equ = convolve2d(equ, psf, 'same')

deconvolved, _ = restoration.unsupervised_wiener(equ, psf)

plt.imshow(deconvolved, cmap='gray')

and here is the output:

解决方案

Deblurring images is (unfortunately) quite difficult, the reason for this is that blurring removes noise, so there are several (noisy) images that will yield the same image when you blur it. This means that there is no simple way for the computer to "choose" which of the noisy images when you deblur it. Because of this, deblurring will often yield noisy images.

Now then, you might ask how photographers do this in reality. Well, they do not actually deblur images, they sharpen them (which is slightly different). When you sharpen an image, you increase the contrast near borders to emphasise them (this is why you sometimes see a halo around borders on images that have been too heavily sharpened).

In you case, you want to deblur it (and there is no convolution kernel that will allow you to do this). To do it in a good way, you need to know what process blurred the image in the first place (that is if you don't want to spend thousands of dollars on special software or don't have a masters in mathematics or astronomy).

If you still want to do this, I'd recommend searching for deconvolution, and if you don't know the blurring process, blind deconvolution. There are some (crude) functions for it in skimage, which might be of help (http://scikit-image.org/docs/stable/auto_examples/filters/plot_restoration.html#sphx-glr-auto-examples-filters-plot-restoration-py).

Finally, the final link in Jax Briggs seem helpful, but I would not cross my fingers for magical results.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值