0
0
Computer Visionml~20 mins

Feature matching between images in Computer Vision - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Feature Matching Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding Feature Matching

Which of the following best describes the purpose of feature matching between images in computer vision?

ATo find corresponding points between two images to understand their spatial relationship
BTo increase the resolution of an image by adding more pixels
CTo convert a color image into grayscale for easier processing
DTo segment an image into different objects based on color
Attempts:
2 left
💡 Hint

Think about why we want to find points that look similar in two different pictures.

Predict Output
intermediate
2:00remaining
Output of Feature Matching Code

What is the output of the following Python code snippet using OpenCV for feature matching?

Computer Vision
import cv2
img1 = cv2.imread('image1.jpg', 0)
img2 = cv2.imread('image2.jpg', 0)
sift = cv2.SIFT_create()
kp1, des1 = sift.detectAndCompute(img1, None)
kp2, des2 = sift.detectAndCompute(img2, None)
bf = cv2.BFMatcher()
matches = bf.knnMatch(des1, des2, k=2)
good = []
for m, n in matches:
    if m.distance < 0.75 * n.distance:
        good.append(m)
print(len(good))
AA boolean indicating if the images are identical
BA list of keypoints detected in the first image
CA tuple containing descriptors of both images
DAn integer representing the number of good matches found between the two images
Attempts:
2 left
💡 Hint

Look at what is printed at the end of the code.

Model Choice
advanced
1:30remaining
Choosing the Best Feature Detector

You want to match features between two images taken under different lighting conditions and slight rotations. Which feature detector is most suitable?

AHarris Corner Detector
BSIFT (Scale-Invariant Feature Transform)
CCanny Edge Detector
DHistogram of Oriented Gradients (HOG)
Attempts:
2 left
💡 Hint

Consider which detector is robust to scale, rotation, and lighting changes.

Metrics
advanced
1:30remaining
Evaluating Feature Matching Quality

Which metric is commonly used to evaluate the quality of feature matching between two images?

ANumber of inlier matches after applying RANSAC
BMean squared error between pixel intensities
CConfusion matrix of classification labels
DCross-entropy loss of a neural network
Attempts:
2 left
💡 Hint

Think about how to measure how many matches are geometrically consistent.

🔧 Debug
expert
2:00remaining
Debugging Feature Matching Code

Consider this code snippet for feature matching. What error will it raise when run?

Computer Vision
import cv2
img1 = cv2.imread('img1.jpg', 0)
img2 = cv2.imread('img2.jpg', 0)
sift = cv2.SIFT_create()
kp1, des1 = sift.detectAndCompute(img1, None)
kp2, des2 = sift.detectAndCompute(img2, None)
bf = cv2.BFMatcher()
matches = bf.match(des1, des2)
print(matches[0].queryIdx)
AIndexError because matches list is empty
BTypeError because BFMatcher.match expects descriptors as lists
CAttributeError because 'NoneType' object has no attribute 'shape'
DNo error, prints the query index of the first match
Attempts:
2 left
💡 Hint

Check what happens if images are not loaded properly.