# 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

• $det(M) = \lambda_1 \lambda_2$
• $trace(M) = \lambda_1 + \lambda_2$
• $\lambda_1$ and $\lambda_2$ are the eigen values of $M$

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

• When $|R|$ is small, which happens when $\lambda_1$ and $\lambda_2$ are small, the region is flat.
• When $R<0$, which happens when $\lambda_1>> \lambda_2$ or vice versa, the region is edge.
• When $R$ is large, which happens when $\lambda_1$ and $\lambda_2$ are large and $\lambda_1 \sim \lambda_2$, the region is a corner.

## OpenCV API

cornerHarris()

Parameters

• src Input single-channel 8-bit or floating-point image.
• dst Image to store the Harris detector responses.
• blockSize Neighborhood size.
• ksize Aperture parameter for the Sobel operator.
• k Harris detector free parameter.
• borderType Pixel extrapolation method.

# SIFT

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

TODO

TODO

TODO

# Feature Matching

• Brute-Force Matcher

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

• FLANN based Matcher

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