In this programming assignment, you will apply a smoothing filter on the original image. In order to apply smoothing, you need to apply a convolution operation on the image. A convolution operation uses a kernel which is a fixed size small matrix. For this assignment, we will use a 3x3 blurring kernel. The convolution operation moves this kernel over the image, shifting it one pixel at a time and takes the dot product of matrix elements with the pixel values underneath (element-wise multiplication and addition operation - see below). The filter traverses the entire image this way producing a single pixel out of 9 adjacent pixels. 100120 110 100 120 110 pousons pocs 85 98 64 46 |99 64 46 * 0125 025 10125 150 80 70 1150/80/70 0.0025 0.25 Image patch Kernel (filter) Input Output 100%0.0625+120x0.125+110 0.0625+98 0.125+64 0.25+46 0.125-150-0.0625+80 0.125+700.0625 - 85.875 - 85 In this figure, each grid box represents a single pixel for simplicity. Note that similar to downscaling operation, this operation needs to be carried out separately for each color component of a pixel. That is, firstly, the kernel will be applied to color components of 9 adjacent pixels producing the R color component of the resulting pixel; then, it will be applied to G color components of the same 9 adjacent pixels producing the color component of the resulting pixel; and finally, it will be applied to B color components of the same 9 adjacent pixels producing the B color component of the resulting pixel. However, there is a problem. If we do not let the kernel move beyond the boundaries of the image, the resulting image will be smaller than the original image. For instance, a 3x3 kernel traversing a 90-pixel wide image left-to- right can only produce 90 - 2 convolutions without kernel exceeding image boundaries. Therefore, in this case, the resulting image would have a width of 88 pixels. In order to preserve the image size both horizontally and vertically, we apply padding to the input image by adding O valued pixels around the edges of the image. See below. 1 DIOLOTOVO () o 10 - 10 10 0 3x3 Kernel 011 10 110000 [[[ Input Image Output Image (has the same size as the input) In this programming assignment, you will apply a smoothing filter on the original image. In order to apply smoothing, you need to apply a convolution operation on the image. A convolution operation uses a kernel which is a fixed size small matrix. For this assignment, we will use a 3x3 blurring kernel. The convolution operation moves this kernel over the image, shifting it one pixel at a time and takes the dot product of matrix elements with the pixel values underneath (element-wise multiplication and addition operation - see below). The filter traverses the entire image this way producing a single pixel out of 9 adjacent pixels. 100120 110 100 120 110 pousons pocs 85 98 64 46 |99 64 46 * 0125 025 10125 150 80 70 1150/80/70 0.0025 0.25 Image patch Kernel (filter) Input Output 100%0.0625+120x0.125+110 0.0625+98 0.125+64 0.25+46 0.125-150-0.0625+80 0.125+700.0625 - 85.875 - 85 In this figure, each grid box represents a single pixel for simplicity. Note that similar to downscaling operation, this operation needs to be carried out separately for each color component of a pixel. That is, firstly, the kernel will be applied to color components of 9 adjacent pixels producing the R color component of the resulting pixel; then, it will be applied to G color components of the same 9 adjacent pixels producing the color component of the resulting pixel; and finally, it will be applied to B color components of the same 9 adjacent pixels producing the B color component of the resulting pixel. However, there is a problem. If we do not let the kernel move beyond the boundaries of the image, the resulting image will be smaller than the original image. For instance, a 3x3 kernel traversing a 90-pixel wide image left-to- right can only produce 90 - 2 convolutions without kernel exceeding image boundaries. Therefore, in this case, the resulting image would have a width of 88 pixels. In order to preserve the image size both horizontally and vertically, we apply padding to the input image by adding O valued pixels around the edges of the image. See below. 1 DIOLOTOVO () o 10 - 10 10 0 3x3 Kernel 011 10 110000 [[[ Input Image Output Image (has the same size as the input)