0
0
Computer Visionml~10 mins

Why computer vision teaches machines to see - 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]('image.jpg')
Drag options to blanks, or click blank then click option'
Aimread
Bimwrite
Cimshow
Dresize
Attempts:
3 left
💡 Hint
Common Mistakes
Using imshow instead of imread will display an image, not load 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_RGB2BGR
Ccv2.COLOR_GRAY2BGR
Dcv2.COLOR_BGR2RGB
Attempts:
3 left
💡 Hint
Common Mistakes
Using COLOR_BGR2RGB changes color format but not to grayscale.
3fill in blank
hard

Fix the error in the code to detect edges using Canny.

Computer Vision
edges = cv2.Canny(image, [1], 150)
Drag options to blanks, or click blank then click option'
A'50'
B50
CNone
Dimage
Attempts:
3 left
💡 Hint
Common Mistakes
Passing a string '50' causes a type error.
4fill in blank
hard

Fill both blanks to create a dictionary of pixel intensities for pixels greater than 100.

Computer Vision
pixel_dict = { (x, y): image[x, y] for x in range(image.shape[[1]]) for y in range(image.shape[[2]]) if image[x, y] > 100 }
Drag options to blanks, or click blank then click option'
A0
B1
C2
D3
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up width and height indices.
5fill in blank
hard

Fill all three blanks to create a dictionary of pixel intensities for pixels with intensity above 120 in grayscale image.

Computer Vision
bright_pixels = { ([1], [2]): gray_image[[1], [2]] for [1] in range(gray_image.shape[0]) for [2] in range(gray_image.shape[1]) if gray_image[[1], [2]] > 120 }
Drag options to blanks, or click blank then click option'
Ax
By
Cz
Di
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variables inconsistently causes errors.