Bird
0
0

You want to resize a grayscale image stored as a 2D numpy array to half its size using cubic interpolation. Which code snippet correctly achieves this?

hard📝 Application Q8 of 15
SciPy - Image Processing (scipy.ndimage)
You want to resize a grayscale image stored as a 2D numpy array to half its size using cubic interpolation. Which code snippet correctly achieves this?
Azoomed_img = zoom(img, 2, order=3)
Bzoomed_img = zoom(img, 0.5, order=1)
Czoomed_img = zoom(img, 0.5, order=0)
Dzoomed_img = zoom(img, 0.5, order=3)
Step-by-Step Solution
Solution:
  1. Step 1: Determine zoom factor for half size

    To reduce size by half, zoom factor should be 0.5.
  2. Step 2: Select interpolation order for cubic

    Cubic interpolation corresponds to order=3.
  3. Final Answer:

    zoomed_img = zoom(img, 0.5, order=3) -> Option D
  4. Quick Check:

    Half size + cubic = zoom 0.5, order 3 [OK]
Quick Trick: Use zoom=0.5 and order=3 for half size cubic interpolation [OK]
Common Mistakes:
  • Using zoom=2 instead of 0.5 for shrinking
  • Using order=0 or order=1 instead of 3 for cubic
  • Confusing zoom factor direction

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SciPy Quizzes