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

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 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 aga

Post by answerhappygod »

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 1
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 1 (63.89 KiB) Viewed 13 times
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 'computeStandard DeviationImage3x3(pixel_array, image_width, image_height)' which computes and returns an image that contains the standard deviation of pixels in a 3x3 neighbourhood of the input pixel. The resulting image has to contain float values. Border handling: Note that when applying the 3x3 mean kernel, the filtering procedure has to access pixels that are outside the input image. For this function simply ignore the 1 pixel boundary of the input image. We referred to this case as Borderlgnore in the lecture. We set the output pixels at the outer boundary to zero. You may assume that the Python3 function 'createInitialized Greyscale PixelArray(image_width, image_height, initValue)' is available, which creates an empty greyscale array (zero values) as a list of lists of integers (if initValue is 0) or a list of lists of floats (if initValue is 0.0). The Python library 'math' is available, and we compute the standard deviation by dividing the number of pixels in the neighbourhood (biased estimate, see also Wikipedia page "standard deviation"). For example: Test Result image_width = 6 image_height = 5 pixel_array = [[30, 70, 20, 30, 20, 30], 0.000 0.000 0.000 0.000 0.000 0.000 0.000 21.315 20.608 15.635 11.967 0.000 0.000 20.245 19.876 17.498 15.235 0.000 0.000 17.638 18.856 19.876 19.500 0.000 0.000 0.000 0.000 0.000 0.000 0.000 [0, 40, 60, 10, 40, 40], [30, 10, 20, 50, 20, 20], [10, 60, 30, 10, 50, 20], [40, 40, 60, 50, 0, 0] ] smoothed_image = computeStandardDeviation Image3x3 (pixel_array, image_width, image_height) printPixelArray (smoothed_image )
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply