/Harris-Corner-Detector

Harris Corner Detector and correspondence

Primary LanguagePython

Harris-Corner-Detector

Harris Corner Detector and correspondence

Description:

This project detects corners in a given image. Also, finds corresponding corners in two images based on Normalized Cross Correlation (NCC) and Sum of Squared Differences (SSD) scores

0. Build Haar filters for calculating derivatives in x and y direction. The size of the filter controls the amount of smoothing.
1. Compute derivatives in x and y direction
2. Build corner response matrix
3. Find locations where the corner response is greater than threshold
4. Apply local non maximum suppression to retain locations where corner response is a local maximum
5. In order to find corresponding corners, use NCC or SSD metrics

Dependencies

  • OpenCV
  • NumPy
  • SciPy

Scripts

python detect_harris_corners.py

Script to detect corners in an image. Also implements Non-Maximal Supression. The parameters "sigma" and

Edit the "images" variable to pass the path to the images whose corners need to be detected. Also, feel free to edit the "results_dir" variable to set the results directory path. Will add parser flags in future. It was just easier to test this way.

python correspondence_measures.py

Results

Inputs

1.jpg

Corners for various values of Smoothing

Sigma = 0.707 : Num of corners detected = 368
1.jpg


Sigma = 1.0 : Num of corners detected = 320
1.jpg


Sigma = 1.414 : Num of corners detected = 282
1.jpg


Sigma = 2 : Num of corners detected = 225
1.jpg

Correspondence

All corner points correspondence. Sigma = 2.0. Metric : Normalized Cross Correlation
1.jpg

Showing top 100 corner points correspondence. Sigma = 2.0. Metric : Normalized Cross Correlation
1.jpg


All corner points correspondence. Sigma = 2.0. Metric : Sum of Squared Differences
1.jpg

Showing top 100 corner points correspondence. Sigma = 2.0. Metric : Sum of Squared Differences
1.jpg