Complete the code to import the gaussian_filter function from scipy.ndimage.
from scipy.ndimage import [1]
The gaussian_filter function is imported from scipy.ndimage to apply Gaussian blur to images.
Complete the code to apply a Gaussian filter with sigma=2 to the image array named 'img'.
blurred_img = gaussian_filter(img, sigma=[1])The sigma parameter controls the amount of blur. Here, sigma=2 applies a moderate blur.
Fix the error in the code to correctly apply gaussian_filter to 'image' with sigma=1.5.
filtered = gaussian_filter([1], sigma=1.5)
The variable holding the image data is named image. Using the correct variable name avoids errors.
Fill both blanks to create a dictionary comprehension that maps each pixel value to its square if the value is greater than 100.
{pixel: pixel[1]2 for pixel in pixels if pixel [2] 100}Use ** to square the pixel value and > to filter pixels greater than 100.
Fill all three blanks to create a dictionary comprehension that maps each pixel's string representation to its value if the value is less than 50.
{str([1]): [2] for [3] in pixels if [2] < 50}Use the same variable name pixel for key conversion, value, and iteration variable to keep the comprehension consistent.