Skip to content

The Harris Corner Detection algorithm identifies corner points in an image by analyzing the eigenvalues of the image’s gradient covariance matrix. It detects areas with significant changes in intensity in both directions, making them robust keypoints for image matching and recognition.

Notifications You must be signed in to change notification settings

saba-khan441/Haris-corner-detection-algorithm

Repository files navigation

Haris-corner-detection-algorithm

code 1

Harris Corner Detection in Images

This repository contains a Python implementation for applying Harris Corner Detection to images, detecting corners, and highlighting them with a visual effect. The project uses OpenCV for image processing and is intended to be run in a Python environment, such as Google Colab.

Features

Corner Detection: Detects corners in images using the Harris Corner Detection method.

Corner Highlighting: Highlights the detected corners by marking them in red on the original image.

Edge Detection Preprocessing: Applies Gaussian blur to reduce noise and enhance corner detection accuracy.

Corner Counting: Counts the number of corners detected in each image.

Visualization: Displays the images with the highlighted corners in Google Colab using matplotlib.

Flexible Image Input: Works with a list of images by providing file paths.

Usage

1 Clone the repository or copy the code.

2 Provide the paths to your images by replacing the image_paths list:

image_paths = '/path/to/image1.jpg', # Replace with your image file path '/path/to/image2.jpg', # Replace with your image file path '/path/to/image3.jpg' # Replace with your image file path

3 Run the code in your Python environment (e.g., Google Colab). 4 The script will output: 5 Displayed images with highlighted corners. 6 Printed number of corners detected in each image.

code 02

Features

Corner Detection:

1 Detects corners in images using the Harris Corner Detection method.

2 Enhances corner points by applying dilation.

Corner Matching:

1 Compares the detected corners between two images.

2 Computes a match score based on the intersection of detected corners.

3 Match Thresholding:

Allows setting a threshold to categorize images based on their match score.

4 Visualization:

Displays images with detected corners highlighted.

5 Console Output:

Prints the match score and determines whether images are good matches or not based on the threshold.

5 Edge Highlighting (Optional):

Enhances corner visibility by coloring the detected edges distinctly.

File Output:

Currently outputs match scores in the console.

Set the image paths:

Replace the paths in the script below with your image paths:

original_image_path = '/path/to/original/image.png' image_paths = '/path/to/rotated/image1.jpg', '/path/to/rotated/image2.jpg', '/path/to/another/image.jpg'

Requirements

Python 3.x

OpenCV

NumPy

Matplotlib

Google Colab (optional, but preferred for displaying images)

About

The Harris Corner Detection algorithm identifies corner points in an image by analyzing the eigenvalues of the image’s gradient covariance matrix. It detects areas with significant changes in intensity in both directions, making them robust keypoints for image matching and recognition.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published