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. image_width, image_height)' which computes and returns the median filtered image using a filter kernel of size 5x3, i.e. the Write a Python3 function 'computeMedian5x3ZeroPadding(pixel_array, kernel has 5 columns and 3 rows. Return the result image in our list of lists representation. Resulting pixels are again 8 bit integer values. Border handling: Note that when applying the 5x3 filter kernel, the filtering procedure has to access pixels that are outside the input image. For this function assume that all the values outside of the image are 0, i.e. assume the case BorderZeroPadding. 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. For example: Test Result image_width = 6 0 2 2 2 0 0 2 3 4 4 4 1 image_height = 5 pixel_array = [ [6, 3, 2, 6, 4, 7], 2 5 6 6 3 1 [5, 3, 2, 7, 0, 6], 2 2 5 3 2 1 [6, 2, 7, 7, 1, 7], 0 2 2 2 1 0 [7, 6, 6, 2, 7, 3], [2, 2, 2, 5, 1, 2]] printPixelArray (computeMedian5x3ZeroPadding(pixel_array, image_width, image_height)) image_width = 7 image_height = 6 pixel_array = [ [244, 126, 101, 174, 168, 75, 62], [155, 145, 15, 149, 116, 163, 238], [63, 138, 132, 207, 74, 227, 163], [25, 9, 85, 172, 202, 108, 193], [85, 123, 49, 53, 106, 60, 197], [113, 196, 35, 19, 126, 130, 48] ] printPixelArray (computeMedian5x3ZeroPadding(pixel_array, image_width, image_height)) 15 116 101 75 62 0 63 132 138 138 149 149 74 15 85 132 138 163 163 108 25 63 85 108 132 108 74 25 49 85 106 106 106 60 0 19 49 49 48 19 0