II – Special Masks and Edge Detection

Now that we’ve covered the basic of convolution masks, I’d like to cover a few special ones that have interesting uses in image processing. We’ll assume for now that we are simply using 3×3 spatial convolution masks. A highly recommended experiment is to not only test these masks yourself, but to try making larger masks (ie: 5×5, 7×7, etc) of the same type to see what effects it may have. I have included a reference image with the examples below so that you may compare the before/after effects of these masks.

  • Blurring/Averaging:
    • Mask: \left[\begin{array}{ccc}^1/_9&^1/_9&^1/_9\\ ^1/_9&^1/_9&^1/_9\\ ^1/_9&^1/_9&^1/_9\end{array}\right]
    • Example:
    • Notes: If you increase the size of the mask, the denominator in each mask element should be the total number of “pixels” in the mask (ie: for a 5×5 mask, each element should be ^1/_25, as this prevents saturation of the output image)
  • Motion Blurring (Diagonal):
    • Mask: \left[\begin{array}{ccc}0&0&1\\ 0&0&0\\ 1&0&0\end{array}\right]
    • Example:
    • Notes: none
  • Motion Blurring (Horizontal):
    • Mask: \left[\begin{array}{ccc}0&0&0\\ 1&0&1\\ 0&0&0\end{array}\right]
    • Example:
    • Notes: A vertical blur can be achieved by simply “rotating” the mask matrix
  • Edge Detection:
    • Mask: \left[\begin{array}{ccc}0&1&0\\ 1&-4&1\\ 0&1&0\end{array}\right]
    • Example:
    • Notes: The -4 in the centre can be replaced with a zero; There are many ways to accomplish edge detection, and this is just one of them.

Leave a Reply

Your email address will not be published. Required fields are marked *