O'Reilly logo

Visual Media Processing Using MATLAB Beginner's Guide by George Siogkas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – applying averaging filters in images

We will start off with an easy-to-follow example, so that all the theory described previously is demonstrated. For our purposes, we will be using one of the images from the previous chapters. In this example, we will also introduce some new MATLAB functions, to facilitate your understanding. Let's start:

  1. First, we load our image, which is holiday_image2.bmp:
    >> img = imread('holiday_image2.bmp');
  2. Then, we generate our convolution kernel, using function fspecial and then rotate it 180 degrees:
    >> kernel = fspecial('average',3);
    >> kernel = rot90(kernel,2)
  3. The output of the code will be as follows:
    kernel =
        0.1111    0.1111    0.1111
        0.1111    0.1111    0.1111
        0.1111    0.1111    0.1111
  4. Now, it is time to use the three ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required