Bird
0
0

Given the code below, what is the shape of zoomed_img?

medium📝 Predict Output Q13 of 15
SciPy - Image Processing (scipy.ndimage)
Given the code below, what is the shape of zoomed_img?
import numpy as np
from scipy.ndimage import zoom
img = np.zeros((10, 10))
zoomed_img = zoom(img, zoom=1.5, order=3)
A(15, 10)
B(10, 10)
C(20, 20)
D(15, 15)
Step-by-Step Solution
Solution:
  1. Step 1: Understand zoom factor effect on shape

    The zoom factor 1.5 multiplies each dimension by 1.5. Original shape is (10, 10).
  2. Step 2: Calculate new shape

    10 * 1.5 = 15 for both height and width, so new shape is (15, 15).
  3. Final Answer:

    (15, 15) -> Option D
  4. Quick Check:

    Shape scaled by 1.5 = (15, 15) [OK]
Quick Trick: Multiply each dimension by zoom factor for new shape [OK]
Common Mistakes:
  • Assuming shape stays same after zoom
  • Rounding incorrectly to 20 instead of 15
  • Mixing up dimensions and zoom factor

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SciPy Quizzes