0
0
SciPydata~30 mins

Image rotation and zoom in SciPy - Mini Project: Build & Apply

Choose your learning style9 modes available
Image rotation and zoom
📋 What You'll Learn
💡 Why This Matters
🌍 Real World
Rotating and zooming images is common in photo editing, medical imaging, and computer vision tasks.
💼 Career
Understanding image transformations is useful for data scientists working with image data, such as in AI, machine learning, and digital media.
Progress0 / 4 steps
1
Create a simple 2D image array
Create a 2D numpy array called image with these exact values: [[0, 0, 0, 0, 0], [0, 1, 1, 1, 0], [0, 1, 1, 1, 0], [0, 1, 1, 1, 0], [0, 0, 0, 0, 0]]
SciPy
Need a hint?

Use np.array to create the 2D array with the exact values.

2
Set the rotation angle
Create a variable called angle and set it to 45 to represent the rotation angle in degrees.
SciPy
Need a hint?

Just assign the number 45 to the variable angle.

3
Rotate the image
Import rotate from scipy.ndimage and create a variable called rotated_image by rotating image by angle degrees with reshape=False.
SciPy
Need a hint?

Use rotate(image, angle, reshape=False) to keep the image size same.

4
Zoom the rotated image and print
Import zoom from scipy.ndimage. Create a variable called zoomed_image by zooming rotated_image with a zoom factor of 1.5. Then print zoomed_image.
SciPy
Need a hint?

Use zoom(rotated_image, 1.5) and then print the result.