0
0
Computer Visionml~20 mins

Corner detection (Harris) in Computer Vision - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Harris Corner Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What does the Harris corner detector primarily measure?
The Harris corner detector is used in computer vision to find corners in images. What is the main quantity it measures to detect corners?
AThe change in intensity in all directions around a pixel
BThe average color value of a pixel neighborhood
CThe distance between edges in the image
DThe brightness of the pixel compared to the image mean
Attempts:
2 left
💡 Hint
Think about what makes a corner different from an edge or flat area.
Predict Output
intermediate
2:00remaining
Output of Harris response matrix calculation
Given the following code snippet that computes the Harris response matrix R for a pixel, what is the value of R?
Computer Vision
import numpy as np
Ix = 2
Iy = 3
Ixx = Ix * Ix
Iyy = Iy * Iy
Ixy = Ix * Iy
k = 0.04
M = np.array([[Ixx, Ixy], [Ixy, Iyy]])
R = np.linalg.det(M) - k * (np.trace(M) ** 2)
print(round(R, 2))
A0.44
B1.44
C0.0
D-6.76
Attempts:
2 left
💡 Hint
Calculate determinant and trace carefully.
Model Choice
advanced
1:30remaining
Choosing parameters for Harris corner detection
Which parameter adjustment will increase the sensitivity of the Harris corner detector to detect more corners in an image?
AIncrease the threshold for corner response R
BIncrease the value of the Harris detector free parameter k
CDecrease the window size used for gradient summation
DUse a larger Gaussian smoothing before computing gradients
Attempts:
2 left
💡 Hint
Think about how window size affects local detail detection.
Metrics
advanced
1:30remaining
Evaluating Harris corner detection results
After running Harris corner detection, you get a set of corner points. Which metric best describes the quality of detected corners compared to ground truth corners?
ARecall (ratio of detected corners to total ground truth corners)
BPrecision (ratio of correctly detected corners to all detected corners)
CAccuracy (ratio of correct detections to total image pixels)
DMean squared error between detected corner coordinates and ground truth
Attempts:
2 left
💡 Hint
Consider how many detected corners are actually correct.
🔧 Debug
expert
2:30remaining
Debugging incorrect Harris corner detection output
You implemented Harris corner detection but the output shows no corners detected. Which of the following code mistakes would cause this issue?
Computer Vision
import cv2
import numpy as np
img = cv2.imread('image.jpg', 0)
Ix = cv2.Sobel(img, cv2.CV_64F, 1, 0, ksize=3)
Iy = cv2.Sobel(img, cv2.CV_64F, 0, 1, ksize=3)
Ixx = Ix * Ix
Iyy = Iy * Iy
Ixy = Ix * Iy
k = 0.04
window_size = 3
height, width = img.shape
R = np.zeros((height, width))
for y in range(window_size, height - window_size):
    for x in range(window_size, width - window_size):
        Sxx = np.sum(Ixx[y - window_size:y + window_size + 1, x - window_size:x + window_size + 1])
        Syy = np.sum(Iyy[y - window_size:y + window_size + 1, x - window_size:x + window_size + 1])
        Sxy = np.sum(Ixy[y - window_size:y + window_size + 1, x - window_size:x + window_size + 1])
        M = np.array([[Sxx, Sxy], [Sxy, Syy]])
        R[y, x] = np.linalg.det(M) - k * (np.trace(M) ** 2)
threshold = 0.01 * R.max()
corners = np.where(R > threshold)
print(len(corners[0]))
AThe threshold is set too high, filtering out all corners
BThe image is read in color mode instead of grayscale
CThe Sobel operator is applied with wrong kernel size
DThe window size is too large, causing sums to be zero
Attempts:
2 left
💡 Hint
Check the threshold relative to the maximum R value.