高斯模糊和卷积核 [英] Gaussian blur and convolution kernels

查看:160
本文介绍了高斯模糊和卷积核的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不明白卷积内核是什么以及如何将卷积矩阵应用于图像中的像素(我在谈论对图像进行高斯模糊操作)。

I do not understand what a convolution kernel is and how I would apply a convolution matrix to pixels in an image (I am talking about doing a Gaussian Blur operation on an image).

我还能得到关于如何为高斯模糊操作创建内核的解释吗?

Also could I get an explanation on how to create a kernel for a Gaussian Blur operation?

我正在读这篇文章但我似乎无法理解事情是如何完成的......

I am reading this article but I cannot seem to understand how things are done...

感谢任何花时间向我解释的人:),

Thanks to anyone who takes time to explain this to me :),

ExtremeCoder

ExtremeCoder

推荐答案

基本思想是图像的新像素是由靠近它的像素的加权平均值创建的(想象在像素周围画一个圆圈)。

The basic idea is that the new pixels of the image are created by an weighted average of the pixels close to it (imagine drawing a circle around the pixel).

对于图像中的每个像素,您将围绕像素创建一个小方块。让我们假设您将一个像素旁边的8个邻居(包括对角线,即使这里无关紧要),我们执行加权平均以获得中间像素。

For each pixel in the image you are going to create a little square around the pixel. Lets say you take the 8 neighbors next to a pixel (including diagonals even though do not matter here), and we perform a weighted average to get the middle pixel.

In高斯模糊情况下,它分解为两个一维操作。对于每个像素,仅在行方向上的像素旁边取一些像素。将像素值乘以从高斯分布计算的权重(或者如果您为了视觉效果而不是出于科学原因,权重可以是任何看起来很好的东西),并将它们相加。另一种看待它的方法是像素制作一个矢量,权重制作一个矢量,你正在采用点积。在列方向上重复此过程作为单独的过程。

In the Gaussian blur case it breaks down to two one dimensional operations. For each pixel take the some amount of pixels next to a pixel in the row direction only. Multiply the pixel values time the weights computed from the Gaussian distribution (or if you are doing this for an visual effect and not for a scientific reason, the weights can anything that looks good) and sum them up. Another way to look at it is the pixel make a vector and the weights make a vector and your are taking the dot product. Repeat this process in the column direction as a separate pass.

这篇关于高斯模糊和卷积核的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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