Bird
0
0

You have a color image as a 3D numpy array with shape (height, width, channels). How do you apply zoom to double the image size without distorting the color channels?

hard📝 Application Q9 of 15
SciPy - Image Processing (scipy.ndimage)
You have a color image as a 3D numpy array with shape (height, width, channels). How do you apply zoom to double the image size without distorting the color channels?
Azoom(img, (2, 2, 1), order=3)
Bzoom(img, 2, order=3)
Czoom(img, (2, 2, 2), order=3)
Dzoom(img, (1, 1, 2), order=3)
Step-by-Step Solution
Solution:
  1. Step 1: Understand zoom factors for each dimension

    Height and width should be doubled (factor 2), but channels should remain unchanged (factor 1).
  2. Step 2: Apply zoom with tuple for each axis

    Use zoom(img, (2, 2, 1), order=3) to scale spatial dimensions only.
  3. Final Answer:

    zoom(img, (2, 2, 1), order=3) -> Option A
  4. Quick Check:

    Channels unchanged = zoom factor 1 on last axis [OK]
Quick Trick: Use tuple zoom to keep channels unchanged [OK]
Common Mistakes:
  • Applying zoom factor 2 to channels causing distortion
  • Using single zoom factor for all axes
  • Using zoom factor 1 on spatial axes

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SciPy Quizzes