0
0
Computer Visionml~10 mins

Why responsible CV prevents misuse in Computer Vision - Test Your Understanding

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

Complete the code to load an image using OpenCV.

Computer Vision
import cv2
image = cv2.[1]('photo.jpg')
Drag options to blanks, or click blank then click option'
Aimshow
Bimread
Cimwrite
Dresize
Attempts:
3 left
💡 Hint
Common Mistakes
Using imshow instead of imread
Trying to write the image before loading it
2fill in blank
medium

Complete the code to convert the image to grayscale.

Computer Vision
gray_image = cv2.cvtColor(image, [1])
Drag options to blanks, or click blank then click option'
Acv2.COLOR_BGR2GRAY
Bcv2.COLOR_BGR2RGB
Ccv2.COLOR_RGB2BGR
Dcv2.COLOR_GRAY2BGR
Attempts:
3 left
💡 Hint
Common Mistakes
Using COLOR_BGR2RGB which changes color space but not to grayscale
Using COLOR_GRAY2BGR which is the opposite conversion
3fill in blank
hard

Fix the error in the code to display the image correctly.

Computer Vision
cv2.[1]('Image Window', gray_image)
cv2.waitKey(0)
cv2.destroyAllWindows()
Drag options to blanks, or click blank then click option'
Aimwrite
Bimread
Cimshow
Dresize
Attempts:
3 left
💡 Hint
Common Mistakes
Using imread instead of imshow
Trying to write the image instead of displaying it
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps image names to their sizes if width is greater than 100.

Computer Vision
image_sizes = {name: image.shape[[1]] for name, image in images.items() if image.shape[[2]] > 100}
Drag options to blanks, or click blank then click option'
A1
B0
C2
D3
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing width and height indexes
Using the same index for both blanks
5fill in blank
hard

Fill all three blanks to filter images with more than 3 channels and create a new dictionary with their names and channel counts.

Computer Vision
filtered = {name: image.shape[[1]] for name, image in images.items() if image.shape[[2]] > [3]
Drag options to blanks, or click blank then click option'
A2
B1
C3
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using height or width index instead of channels
Checking for channels < 3 instead of > 3