Review#1:Feature Detection

Sep 23 2019 ComputerVision

Intro

Feature Detection is to find some specific points (mostly corner) which can uniquely represent their location in the image. So these points are feature points, and we can describe them using descriptor.

There are several common algorithms in Feature Detection.

  1. Harris Corner Detection
  2. SIFT (Scale-invariant Feature Transform)
  3. SURF (Speeded-up Robust Feature)
  4. ORB
  5. new: Neural Network Feature Detector

Harris Corner Detection

Harris Corner Detection help detect corner points in a certain image.

Basic Idea

For each pixel $(x, y)$, it calculates a $2\times2$ gradient covariance matrix $M^{(x,y)}$ over a $blockSize\times blockSize$ neighborhood. Then, it computes the following characteristic:

where

So the values of these eigen values decide whether a region is corner, edge or flat.

OpenCV API

cornerHarris()

Parameters

Sample Code

1
2
3
4
5
6
7
8
9
10
img = cv2.imread(filename)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
gray = np.float32(gray)
dst = cv2.cornerHarris(gray,2,3,0.04)

#result is dilated for marking the corners, not important
dst = cv2.dilate(dst,None)

# Threshold for an optimal value, it may vary depending on the image.
img[dst>0.01*dst.max()]=[0,0,255]

SIFT

Harris’s method is rotation-invariant, but not scale-invariant. So now we have SIFT.

TODO


SURF

TODO


ORB

TODO


Feature Matching

This is the simplest one. It just do a certain distance calculation between one and others. And the closest one is returned.

FLANN stands for Fast Library for Approximate Nearest Neighbors. It works more faster than BFMatcher for large datasets.


Reference

  1. SIFT Paper from UBC: https://www.cs.ubc.ca/~lowe/keypoints/
  2. opencv-python-tutorials