Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help in Python. I need help on writing a function for the following task

ID: 3889584 • Letter: P

Question

Please help in Python. I need help on writing a function for the following task in Python 3.6. Please help. Thank You!

The 9 images can be download from this link and are in a zip folder called pesky_tourist: https://expirebox.com/download/0bc535cc2f10dc5aa621fc5e7c4a71d2.html

Background Analyzing a series of images of the (exact) same location at different times is known as temporal processing. (This is opposed to spatial processing which analyzes one image and focuses on each pixel's neighbors.) One example of temporal filter is a median filter. Given several images, a temporal me- dian filter takes a list of pixel channel values at each coordinate and calculates the median This removes outliers and can act to subtract unwanted elements from an image. In general, to calculate the median of a list of numbers of odd length, you sort the list, calculate the middle location, and return the value at that middle location. If we have a list of length n, where n is odd, the location of the middle value is at: For example, if we have the numbers 2, 4, 6, 237, 1, we sort the numbers to get 1, 2, 4, 6, 237. The list is of length 5, so the middle value is located in the third position, which is the number 4. (Note: Given that Python lists are indexed at e, we need to substract one from the calculated middle location in our program.)

Explanation / Answer

from PIL import Image as im # Converting image to objects import numpy as np # For mathematical median for taking median of image image_objs = [] for image in range(1, 10): image_objs.append(im.open(str(image) + ".png")) #making objects and storing them into list. size = (np.array(image_objs[0])).shape elements = size[0] * size[1] image_arr = [] for image in image_objs: image_arr.append(np.ndarray.flatten(np.array(image))) #Converting Images into arrays so median can be applied median = np.median(image_arr, axis=0) #Applying median image = median.reshape(size[0], size[1], 3) #Reshaping array into 3D matrix for display final_image = im.fromarray(image.astype('uint8')) #Converting to image final_image.show() #showing final_image.save("out.png") #Saving

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote