图像卷积计算(单通道)

卷积计算通过卷积核进行图像效果处理,机器学习中用于特征提取。

下图一个32*32的黑白图片(单通道),每个像素值0~255,最左边是每个像素值,中级是放大的像素,最右边是原始图片。

使用3x3 {{selectedKernel}} 卷积核进行图像计算。

下面左侧图像中的每取一个3x3像素块,将每个像素乘以卷积内核,然后求和。该和成为右侧图像中的新像素。将鼠标悬停在任一图像上的像素上,以查看其值计算过程。

计算过程沿着图像边缘进行的处理。输入图像的左上角只有三个邻居。解决此问题的一种方法是在原始图像 中将边缘值扩展一倍,同时使新图像保持相同大小。在此演示中改为通过将其设为黑色来忽略这些值。 这是一个游乐场,您可以选择不同的内核矩阵,并查看它们如何影响原始图像或构建自己的内核。

The sharpen kernel emphasizes differences in adjacent pixel values. This makes the image look more vivid.

The blur kernel de-emphasizes differences in adjacent pixel values.

The emboss kernel (similar to the sobel kernel and sometimes referred to mean the same) givens the illusion of depth by emphasizing the differences of pixels in a given direction. In this case, in a direction along a line from the top left to the bottom right.

The indentity kernel leaves the image unchanged. How boring!

The custom kernel is whatever you make it.

sobel kernels are used to show only the differences in adjacent pixel values in a particular direction.

An outline kernel (also called an "edge" kernel) is used to highlight large differences in pixel values. A pixel next to neighbor pixels with close to the same intensity will appear black in the new image while one next to neighbor pixels that differ strongly will appear white.

参考来源:Explained Visually