Filters on color images

Of course, our filter technique is not only limited to black-and-white images. In this section we're going to have a look at color images.

The majority of color images consist of three layers or channels, and this is commonly referred to as RGB, the initialism for the three layers. They are made up of one red channel, one blue channel, and one green channel. When these three channels are laid on top of each other, they add up to create the traditional color image that we know.

Taking that concept, an image is therefore not flat, but actually a cube, a three-dimensional matrix. Combining this idea with our objective, we want to apply a filter to the image, and apply it to all three channels at once. We will, therefore, perform an element-wise multiplication between two three-dimensional cubes.

Our 3x3 filter now has a depth of three and thus nine parameters, plus the bias:

Filters on color images

An example of a filter cube or convolutional kernel

This cube, which is referred to as a convolutional kernel, gets slid over the image just like the two-dimensional matrix did before. The element-wise products then again get summed up, the bias is added, and the outcome represents a pixel in the next layer.

Filters always capture the whole depth of the previous layer. The filters are moved over the width and height of the image. Likewise, filters are not moved across the depth, that is, the different channels, of an image. In technical terms, weights, the numbers that make up the filters, are shared over width and height, but not over different channels.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset