Bird
0
0

How can you rotate an image by 45 degrees and zoom it by 0.5 times while keeping the output image the same shape as the original?

hard📝 Application Q9 of 15
SciPy - Image Processing (scipy.ndimage)
How can you rotate an image by 45 degrees and zoom it by 0.5 times while keeping the output image the same shape as the original?
ARotate with <code>reshape=True</code> and zoom normally
BRotate with <code>reshape=False</code> and then zoom with <code>output_shape</code> set to original shape
CZoom first then rotate with <code>reshape=True</code>
DUse <code>scipy.ndimage.zoom</code> with negative zoom factor
Step-by-Step Solution
Solution:
  1. Step 1: Use reshape=False in rotate

    This keeps the rotated image shape same as input.
  2. Step 2: Use zoom with output_shape

    Zooming with output_shape set to original shape ensures final image size matches input.
  3. Final Answer:

    Rotate with reshape=False and then zoom with output_shape set to original shape -> Option B
  4. Quick Check:

    reshape=False + zoom output_shape keeps shape [OK]
Quick Trick: Use reshape=False and output_shape to keep size [OK]
Common Mistakes:
  • Using reshape=True causing size change
  • Zooming with negative factor
  • Ignoring output_shape parameter

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SciPy Quizzes