Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to convert the image to grayscale before processing.
Computer Vision
gray = cv2.[1](img, cv2.COLOR_BGR2GRAY) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using resize instead of color conversion
Using GaussianBlur instead of color conversion
✗ Incorrect
We use cv2.cvtColor with cv2.COLOR_BGR2GRAY to convert the image to grayscale.
2fill in blank
mediumComplete the code to compute the Harris corner response.
Computer Vision
dst = cv2.cornerHarris(gray, [1], 3, 0.04)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 1 or 2 which is too small
Using 5 which is larger than typical
✗ Incorrect
The block size parameter is usually set to 3 for Harris corner detection.
3fill in blank
hardFix the error in thresholding the Harris response to mark corners.
Computer Vision
img[dst > [1] * dst.max()] = [0, 0, 255]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 1 which selects no corners
Using too small values like 0.001 which selects too many points
✗ Incorrect
Using 0.1 as the threshold factor helps select strong corners by comparing to the max response.
4fill in blank
hardFill both blanks to normalize and convert the Harris response for visualization.
Computer Vision
dst_norm = np.empty(dst.shape, dtype=np.float32) cv2.normalize(dst, dst_norm, [1], [2], cv2.NORM_MINMAX)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 255 as max which is for 8-bit images
Using negative values which are invalid here
✗ Incorrect
Normalization scales values between 0 and 1 for easier visualization.
5fill in blank
hardFill all three blanks to create a mask of corners and mark them on the image.
Computer Vision
mask = dst_norm > [1] img[mask] = [[2], [3], 0]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 as threshold selects all points
Using wrong color values for marking
✗ Incorrect
We threshold at 0.1, then mark corners with red color [255, 128, 0].