0
0
Computer Visionml~10 mins

Why edge deployment enables real-time CV 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 for real-time processing on an edge device.

Computer Vision
import cv2
image = cv2.imread([1])
Drag options to blanks, or click blank then click option'
A'image.jpg'
Bimage.jpg
Cload_image
Dcv2.image
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around the filename
Using a variable name without defining it
2fill in blank
medium

Complete the code to convert the image to grayscale for faster edge processing.

Computer Vision
gray_image = cv2.cvtColor(image, [1])
Drag options to blanks, or click blank then click option'
Acv2.COLOR_BGR2RGB
Bcv2.COLOR_BGR2GRAY
Ccv2.COLOR_RGB2GRAY
Dcv2.COLOR_GRAY2BGR
Attempts:
3 left
💡 Hint
Common Mistakes
Using COLOR_BGR2RGB instead of grayscale
Using COLOR_GRAY2BGR which is reverse
3fill in blank
hard

Fix the error in the code to perform edge detection using Canny on the grayscale image.

Computer Vision
edges = cv2.Canny([1], 100, 200)
Drag options to blanks, or click blank then click option'
Acv2
Bimage
Cedges
Dgray_image
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the original color image
Passing the output variable itself
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps each pixel coordinate to its edge value if the edge value is greater than zero.

Computer Vision
edge_points = {(x, y): [1][y, x] for y in range(edges.shape[0]) for x in range(edges.shape[1]) if [2][y, x] > 0}
Drag options to blanks, or click blank then click option'
Aedges
Bgray_image
Cimage
Dedge_points
Attempts:
3 left
💡 Hint
Common Mistakes
Using grayscale image instead of edges for values
Using wrong variable names
5fill in blank
hard

Fill all three blanks to create a function that runs edge detection on an input image and returns the edge points dictionary.

Computer Vision
def detect_edges([1]):
    gray = cv2.cvtColor([2], cv2.COLOR_BGR2GRAY)
    edges = cv2.Canny(gray, 50, 150)
    return {(x, y): edges[y, x] for y in range(edges.shape[0]) for x in range(edges.shape[1]) if edges[y, x] > [3]
Drag options to blanks, or click blank then click option'
Ainput_image
Bimage
C0
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names for input and processing
Checking for edges > 1 instead of 0