Ask an expert. Trust the answer.

Your academic and career questions answered by verified experts

How to combine SURF and Harris points MATLAB

Date: 2022-11-30 13:33:13

As we know at Matlab, there is function to detect Harris or SURF feature individually. Then I need to combine these two list of features from both the Harris and SURF to make the matching more efficient.

the following is the default procedure that we know

points_image_Harris =detectHarrisFeatures(image );
[feature_image_Harris, validpoints_image_Harris] = extractFeatures(image,  points_image_Harris ); 
indexPairs_Harris = matchFeatures(feature_template_Harris,feature_image_Harris);

but I want to combine two list of points before make matching: something like this:

points_image_Harris =detectHarrisFeatures(image );
points_image_SURF =detectSURFFeatures(image );
Points = points_image_Harris  + points_image_SURF 

then use the Points list to make feature extraction and them matching. How to do this? if they are have two different types? cornerPoints and SURFPoints !

I need both features generated from both SURF and Harris, as the following output: 

As we know at Matlab, there is function to detect Harris or SURF feature individually. Then I need to combine these two list of features from both the Harris and SURF to make the matching more efficient.

the following is the default procedure that we know

points_image_Harris =detectHarrisFeatures(image );
[feature_image_Harris, validpoints_image_Harris] = extractFeatures(image,  points_image_Harris ); 
indexPairs_Harris = matchFeatures(feature_template_Harris,feature_image_Harris);

but I want to combine two list of points before make matching: something like this:

points_image_Harris =detectHarrisFeatures(image );
points_image_SURF =detectSURFFeatures(image );
Points = points_image_Harris  + points_image_SURF 

then use the Points list to make feature extraction and them matching. How to do this? if they are have two different types? cornerPoints and SURFPoints !

I need both features generated from both SURF and Harris, as the following output:

enter image description here

I don't know if the combination is possible or any idea to get both matching features from both.

Actually I want to detect these features, then I want to get the location of those pixels from the frames and then calculate difference between both X and Y position.

Also I don't Know how to get the features coordinates position from the SURF & Harris matching?? 

Answers: 

Using detectHarrisFeatures and detectSURFFeatures essentially returns a structure where each field contains relevant information about the interest points that are detected in the image. To give a reproducible example, let's use the cameraman.tif image that is part of the image processing toolbox. Let's also use both feature detection frameworks with the default parameters: 

 

>> im = imread('cameraman.tif'); >> harrisPoints = detectHarrisFeatures(im); >> surfPoints = detectSURFFeatures(im); 

When we display harrisPoints, this is what we get: 

 

harrisPoints = 184x1 cornerPoints array with properties: Location: [184x2 single] Metric: [184x1 single] Count: 184 

When we display surfPoints, this is what we get: 

 

surfPoints = 180x1 SURFPoints array with properties: Scale: [180x1 single] SignOfLaplacian: [180x1 int8] Orientation: [180x1 single] Location: [180x2 single] Metric: [180x1 single] Count: 180

Using detectHarrisFeatures and detectSURFFeatures essentially returns a structure where each field contains relevant information about the interest points that are detected in the image. To give a reproducible example, let's use the cameraman.tif image that is part of the image processing toolbox. Let's also use both feature detection frameworks with the default parameters:

>> im = imread('cameraman.tif');
>> harrisPoints = detectHarrisFeatures(im);
>> surfPoints = detectSURFFeatures(im);

When we display harrisPoints, this is what we get:

harrisPoints = 

  184x1 cornerPoints array with properties:

    Location: [184x2 single]
      Metric: [184x1 single]
       Count: 184

When we display surfPoints, this is what we get:

surfPoints = 

  180x1 SURFPoints array with properties:

              Scale: [180x1 single]
    SignOfLaplacian: [180x1 int8]
        Orientation: [180x1 single]
           Location: [180x2 single]
             Metric: [180x1 single]
              Count: 180

As such, both harrisPoints and surfPoints have a field called Location which contains the spatial coordinates of the features you want. This would be a N x 2 matrix where each row gives you the location of a feature point. The first column is the x or horizontal coordinate and the second column is the y or vertical coordinate. The origin is at the top left corner of the image, and the y coordinate is positive when moving downwards.

Therefore, if you want to combine both of the feature points together, access the Location field of both objects and concatenate them together into a single matrix:

>> Points = [harrisPoints.Location; surfPoints.Location];

Points should now contain a matrix where each row gives you a feature point.


I'd like to make a small note that the Harris corner detector is just an interest point detection algorithm. All that is given to you are the locations of interesting points in the image. SURF is both a detection and description framework, where not only do you get interest points, but you also get a good robust description of each interest point that you can use to perform matching between other interest points in other images. Therefore, if you wanted to combine both Harris and SURF together, that isn't possible because Harris does not support describing interest points. 

 


Why Matlabhelpers ?

Our Matlab assignment helpers for online MATLAB assignment help service take utmost care of your assignments by keeping the codes simple yet of high-quality. We offer the most reliable MATLAB solutions to students pursuing their Computer Science course from the Monash University, the University of Sydney, the University of New South Wales, the University of Melbourne; to name a few. Approach us today for best Matlab solutions online!

whatsApp order on matlabhelpers.com

telegram order on matlabsolutions.com