Hi Monika,
You can use inbuillt functions from MATLAB's "Computer Vision Toolbox" to extract and match features.
- "detectSURFFeatures" and "detectSIFTFeatures" functions can be used to detect SURF and SIFT features respectively.
- "extractFeatures" function can be used to extract feature descriptors.
- "matchFeatures" function can be used to find matching features.
Here's a reference code to extract and match features using the SURF algorithm. Feel free to tweak it as per your need.
% Read the input images
image1 = imread('scene_left.png');
image2=imread('scene_right.png');
% Convert images to grayscale
grayImage1 = rgb2gray(image1);
grayImage2 = rgb2gray(image2);
% Detect SURF features
points1 = detectSURFFeatures(grayImage1);
points2 = detectSURFFeatures(grayImage2);
% Extract SURF features
[features1, validPoints1] = extractFeatures(grayImage1, points1);
[features2, validPoints2] = extractFeatures(grayImage2, points2);
% Display the number of features extracted
numFeatures1 = size(features1, 1);
numFeatures2 = size(features2, 1);
disp(['Number of features extracted from image 1: ', num2str(numFeatures1)]);
disp(['Number of features extracted from image 2: ', num2str(numFeatures2)]);
% Match features between the images
indexPairs = matchFeatures(features1, features2);
% Display the number of features matched
numMatches = size(indexPairs, 1);
disp(['Number of features matched: ', num2str(numMatches)]);
To know more, you can refer to the following documentation links:
- https://www.mathworks.com/help/vision/ref/detectsurffeatures.html
- https://www.mathworks.com/help/vision/ref/detectsiftfeatures.html
- https://www.mathworks.com/help/vision/ref/extractfeatures.html
- https://www.mathworks.com/help/vision/ref/matchfeatures.html