0
0
Computer Visionml~10 mins

Resizing images in Computer Vision - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to resize the image to 100x100 pixels using OpenCV.

Computer Vision
resized_image = cv2.resize(image, ([1], [1]))
Drag options to blanks, or click blank then click option'
A200
B50
C100
D150
Attempts:
3 left
💡 Hint
Common Mistakes
Using a single integer instead of a tuple for size.
Swapping width and height values.
2fill in blank
medium

Complete the code to resize the image by half using the scale factors.

Computer Vision
resized_image = cv2.resize(image, None, fx=[1], fy=[1])
Drag options to blanks, or click blank then click option'
A0.5
B1.5
C0.25
D2.0
Attempts:
3 left
💡 Hint
Common Mistakes
Using scale factors greater than 1 to reduce size.
Confusing fx and fy values.
3fill in blank
hard

Fix the error in the code to resize the image to 300x300 pixels.

Computer Vision
resized_image = cv2.resize(image, [1])
Drag options to blanks, or click blank then click option'
A[300, 300]
B(300, 300)
C300, 300
D{300, 300}
Attempts:
3 left
💡 Hint
Common Mistakes
Using a list instead of a tuple for size.
Passing separate arguments instead of a tuple.
4fill in blank
hard

Fill both blanks to resize the image to double its size using scale factors.

Computer Vision
resized_image = cv2.resize(image, None, fx=[1], fy=[2])
Drag options to blanks, or click blank then click option'
A2.0
B0.5
C1.0
D3.0
Attempts:
3 left
💡 Hint
Common Mistakes
Using different scale factors for fx and fy causing distortion.
Using scale factors less than 1 to enlarge the image.
5fill in blank
hard

Fill all three blanks to create a resized image dictionary with keys as sizes and values as resized images.

Computer Vision
resized_images = [1](size: cv2.resize(image, size) for size in [2])
print(len(resized_images) == [3])
Drag options to blanks, or click blank then click option'
Adict
B[(50, 50), (100, 100), (150, 150)]
C3
Dlist
Attempts:
3 left
💡 Hint
Common Mistakes
Using list comprehension instead of dict comprehension.
Mismatching the number of sizes and dictionary length.