0
0
Computer Visionml~10 mins

Corner detection (Harris) in Computer Vision - Interactive Code Practice

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

Complete 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'
AcvtColor
Bresize
CGaussianBlur
Dthreshold
Attempts:
3 left
💡 Hint
Common Mistakes
Using resize instead of color conversion
Using GaussianBlur instead of color conversion
2fill in blank
medium

Complete 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'
A1
B3
C5
D2
Attempts:
3 left
💡 Hint
Common Mistakes
Using 1 or 2 which is too small
Using 5 which is larger than typical
3fill in blank
hard

Fix 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'
A0.01
B0.001
C0.1
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using 1 which selects no corners
Using too small values like 0.001 which selects too many points
4fill in blank
hard

Fill 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'
A0
B255
C1
D-1
Attempts:
3 left
💡 Hint
Common Mistakes
Using 255 as max which is for 8-bit images
Using negative values which are invalid here
5fill in blank
hard

Fill 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'
A0.1
B0
C255
D128
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 as threshold selects all points
Using wrong color values for marking