Bird
0
0

Given the code below, what will be the output array after applying the Gaussian filter?

medium📝 Predict Output Q13 of 15
SciPy - Image Processing (scipy.ndimage)
Given the code below, what will be the output array after applying the Gaussian filter?
import numpy as np
from scipy.ndimage import gaussian_filter

image = np.array([[0, 0, 0],
                  [0, 10, 0],
                  [0, 0, 0]])
filtered = gaussian_filter(image, sigma=1)
print(np.round(filtered, 2))
A[[0.46 1.23 0.46] [1.23 2.99 1.23] [0.46 1.23 0.46]]
B[[0 0 0] [0 10 0] [0 0 0]]
C[[2.5 2.5 2.5] [2.5 2.5 2.5] [2.5 2.5 2.5]]
D[[0.1 0.1 0.1] [0.1 10 0.1] [0.1 0.1 0.1]]
Step-by-Step Solution
Solution:
  1. Step 1: Understand Gaussian filter effect on sparse image

    The single bright pixel (10) will blur into neighbors, spreading intensity smoothly.
  2. Step 2: Calculate approximate blurred values

    Using sigma=1, the center pixel reduces from 10 to about 3, neighbors get values around 1.2 to 0.46.
  3. Final Answer:

    [[0.46 1.23 0.46] [1.23 2.99 1.23] [0.46 1.23 0.46]] -> Option A
  4. Quick Check:

    Blur spreads intensity smoothly = [[0.46 1.23 0.46] [1.23 2.99 1.23] [0.46 1.23 0.46]] [OK]
Quick Trick: Gaussian blur spreads bright pixels softly to neighbors [OK]
Common Mistakes:
  • Expecting no change in array
  • Assuming uniform average instead of weighted blur
  • Misreading sigma effect as sharpening

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SciPy Quizzes