0
0
Computer Visionml~10 mins

Why processing prepares images for analysis 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 convert an image to grayscale.

Computer Vision
gray_image = cv2.[1](color_image, cv2.COLOR_BGR2GRAY)
Drag options to blanks, or click blank then click option'
AcvtColor
Bresize
Cthreshold
Dblur
Attempts:
3 left
💡 Hint
Common Mistakes
Using resize instead of color conversion
Using blur which smooths images
2fill in blank
medium

Complete the code to resize an image to 100x100 pixels.

Computer Vision
resized_image = cv2.[1](original_image, (100, 100))
Drag options to blanks, or click blank then click option'
Athreshold
BcvtColor
Cresize
Dblur
Attempts:
3 left
💡 Hint
Common Mistakes
Using cvtColor which changes color space
Using threshold which changes pixel values
3fill in blank
hard

Fix the error in the code to apply a binary threshold to a grayscale image.

Computer Vision
_, binary_image = cv2.[1](gray_image, 127, 255, cv2.THRESH_BINARY)
Drag options to blanks, or click blank then click option'
Aresize
Bthreshold
CcvtColor
Dblur
Attempts:
3 left
💡 Hint
Common Mistakes
Using resize which changes image size
Using cvtColor which changes color space
4fill in blank
hard

Fill in the blank 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[0]) for y in range(image.shape[1]) if image[x, y] [1] 100 }
Drag options to blanks, or click blank then click option'
A>
B==
C<
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' which selects darker pixels
Using '==' which selects pixels equal to 100
5fill in blank
hard

Fill all three blanks to create a dictionary of pixel intensities for pixels less than 50.

Computer Vision
pixel_dict = { ([1], [2]): image[[1], [2]] for [1] in range(image.shape[0]) for [2] in range(image.shape[1]) if image[[1], [2]] [3] 50 }
Drag options to blanks, or click blank then click option'
Ax
By
C<
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' which selects brighter pixels
Using wrong variable names causing errors