Given is a greyscale 8 bit input image in the form of a pixel array (a list of pixel rows, with each row represented aga
Posted: Thu May 26, 2022 9:06 am
Given is a greyscale 8 bit input image in the form of a pixel array (a list of pixel rows, with each row represented again as a list). Every pixel contains an integer value between 0 and 255. Write a Python3 function 'computeGaussianAveraging3x3 RepeatBorder (pixel_array, image_width, image_height)' which computes and returns a Gaussian filtered image of the same size as the input image. The filter response image has to use the 3x3 Gaussian filter kernel which is defined as follows: 1/162 The resulting image has to contain float values. It is necessary that you implement a correct border handling, where the image boundary is repeated at the border (BorderBoundaryPadding). This means that at the four edges of the image as well as at the four corner locations, the pixel intensities are extended (copied) to the outside of the image. Note: You may assume that the Python3 function 'createInitialized Greyscale PixelArray(image_width, image_height)' is available, which creates an empty greyscale array (values 0) as a list of lists of integers. See the skeleton code of the assignment for the implementation details of this function. For example: Test Result image_width = 6 image_height = 5 pixel_array = [ [6, 3, 2, 6, 4, 7], 5.06 3.44 3.31 4.38 4.75 5.81 4.81 3.56 4.00 4.50 3.94 5.19 5.31 4.50 5.00 4.81 4.00 4.88 5.12 4.69 4.62 4.31 3.94 3.81 3.19 3.06 3.31 3.50 2.88 2.31 [5, 3, 2, 7, 0, 6], [6, 2, 7, 7, 1, 7], [7, 6, 6, 2, 7, 3], [2, 2, 2, 5, 1, 2] ] printPixelArray (computeGaussianAveraging3x3 RepeatBorder (pixel_array, image_width, image_height)) image_width = 6 image_height = 5 pixel_array = [ [76, 88, 132, 208, 49, 199], 108.25 108.38 138.44 156.19 140.06 147.19 152.12 120.44 111.56 140.00 159.44 146.69 140.69 116.69 95.81 101.50 144.50 183.56 130.19 127.12 128.75 114.38 141.81 213.25 172.75 145.62 142.19 156.19 189.69 231.56 [223, 115, 129, 162, 255, 54], [146, 112, 9, 25, 168, 233], [92, 91, 253, 91, 27, 253], [223, 130, 118, 163, 235, 246] ] printPixelArray (computeGaussianAveraging3x3 Repeat Border (pixel_array, image_width, image_height)) image_width = 1 127.00 image_height = 1 pixel_array = [[127] ] printPixelArray (computeGaussianAveraging3x3 RepeatBorder (pixel_array, image_width, image_height))