Exp 6 - Saw
Exp 6 - Saw
EXP 6
Theory:
Speeded-Up Robust Features (SURF) is an algorithm introduced by Herbert Bay in 2006. SURF builds on
the concepts of SIFT but aims to improve speed and efficiency while maintaining robustness.
● Integral Images: Use integral images to quickly compute the sum of image intensities over rectangular
regions, enhancing speed.
● Fast Hessian Matrix-Based Detector: Detect keypoints using the determinant of the Hessian matrix,
which provides a measure of local changes in the image.
● Keypoint Localization and Orientation: Similar to SIFT, keypoints are localized and an orientation is
assigned based on Haar wavelet responses within a circular region around the keypoint.
● Keypoint Descriptor: Construct a descriptor by considering the Haar wavelet responses in the horizontal
and vertical directions within a square region around the keypoint, resulting in a 64-dimensional vector.
Speed and Efficiency: SURF is designed to be faster than SIFT, making it more suitable for real-time
applications and large-scale image processing tasks.
Hessian Matrix: SURF leverages the Hessian matrix for keypoint detection, which simplifies computations
and speeds up the process compared to the DoG approach used in SIFT.
Descriptor Robustness: Although SURF descriptors are more compact, they may be less descriptive than
SIFT descriptors, potentially affecting performance in scenarios requiring high precision.
Algorithm:
1. Input Image:
o Read the grayscale image.
2. Integral Image Calculation: o Create an integral image to compute convolutions quickly.
3. Keypoint Detection: o Use box filters to approximate the Laplacian of Gaussian and
detect keypoints.
4. Keypoint Localization: o Filter out unstable keypoints based on their contrast and edge
response.
Alok Mevawala SAW ET21BTEC037
Code:
import cv2 import
numpy as np import
os
# Load the image (make sure to replace with the correct path)
image_path = 'tesla1 (1).jpg' # Change this to the correct path image
= cv2.imread(image_path)
if image is None:
print("Error: Image not found.")
else:
# Convert the image to grayscale
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
Output:
Alok Mevawala SAW ET21BTEC037
Conclusion:
SURF provides a faster alternative to SIFT while still offering robust performance in image matching and
object detection. It is particularly useful when speed is critical without a significant loss of accuracy.