Page 215 - Ai_C10_Flipbook
P. 215

Today,  we  commonly  use  various  image  editing  tools  like
                 Photoshop, along with apps such as Instagram and Snapchat,
                 to enhance images by applying filters. These filters work by
                 uniformly modifying the pixel values across the entire image,
                 resulting in visual transformations.
                                                                                Normal           1977            Aden
                 But  how  do  these  filters  achieve  such  effects?  This  is
                 accomplished  using  a  mathematical  process  called
                 convolution,  which  involves  a  convolution  operator  to
                 manipulate pixel values and create the desired changes.
                 Convolution  is  not  only  essential  for  applying  filters  but
                 also  plays  a  significant  role  in  image  processing  tasks  like   Brannan  Brooklyn     Calrendon
                 sharpening,  blurring,  and  edge  detection.  By  altering  pixel
                 values  systematically  through  convolution,  we  can  enhance
                 image  quality,  add  creative  effects,  or  even  extract  critical
                 features for advanced applications like Computer Vision.
                 In simple terms, convolution is passing a "kernel" matrix over
                 the whole "image" matrix to give the convoluted matrix i.e.,   Earlybird      Gingham          Hudson
                 the filtered image.
                 Technically, convolution is defined as a simple Mathematical operation that multiplies two numeric arrays of the
                 same dimensions but different sizes to produce a third numeric array of the same dimensions. For example:
                               1   1   1  0   0   0   1

                               1   0   1  0   1   0   0                               4   5   3  2   2
                                           x1  x1  x0
                               1   1   0  1   1   0   1                               2   4   3  4   2
                                           x0  x1  x1
                                                                  1   1   0
                               0   1   0  1   0   1   0                               4   4   3  5   3
                                           x1  x0  x1                           =
                               0   1   1  1   0   1   1     *     0   1   1           4   5   3  4   4
                                                                  1   0   1
                               1   1   0  1   1   1   0                               4   3   6  4   3
                               1   0   1  0   1   1   0
                                      Image Matrix               Kernel Matrix   Convoluted Matrix/Desired image
                                          A                           B                       C
                 The resulting pixel is calculated as:
                 (0×1) + (1×1) + (0×0) + (1×0) + (1×1) + (0×1) + (1×1) + (0×0) + (1×1) = 4

                 Kernel

                 Kernel is also known as a Convolution Matrix or mask (typically a 3x3 or 5x5 matrix) will help you in image
                 processing by creating a wide range of effects like sharp, blur, masking etc. The kernel is slid across the image
                 and multiplied with the input image matrix to generate an output image with an enhanced desired effect.
                 In the process of doing it, along the edges of the input image, the top left corner has only three neighbours so the
                 output image becomes smaller. If we want the output image to be of exact size of the input image then during the
                 process of overlapping the centers of the input image and the kernel, extend the edge values out by one in the
                 input image. The pixel value is 0 when edges are extended.

                 For example, if 3X3 kernel is used to calculate each pixel, the Kernel filter is multiplied with the current overlapping
                 pixel value and the other 8 surrounding pixels. Then the result of the multiplication is added up to generate the
                 value of the current pixel.



                                                                                             Computer Vision    213
   210   211   212   213   214   215   216   217   218   219   220