Using the feature points object in matlab(no feature matching)

4 views (last 30 days)
Hi,
with detectSURFFeatures or any other feature detection function of matlab we can get a featurePoints object, which is perfectly designed to be passed on to extractFeature and matchFeature function.
Except unfortunately that's not really what I want to do with the features. Rather than matching features with a specific reference image, i would like to look at the neighborhood of the pixel and using some specific features to filter out the one that is interesting.
As an example, I want to look at a very small window around every points and see the color(for rgb)/power(for black and white) distribution of the pixels the window. How can I best do this? The more I read into binary features of matlab, the less it appears to me that I can use them for it.
Many thanks in advance

Accepted Answer

Image Analyst
Image Analyst on 18 Jun 2021
Just use indexing to get the small sub-image you're interested in and then use histogram
subImage = bigImage(row1:row2, column1:column2, :);
[r, g, b] = imsplit(subImage); % For RGB image
histObjectR = histogram(r);
histObjectG = histogram(g);
histObjectB = histogram(b);
For grayscale
subImage = bigImage(row1:row2, column1:column2);
histObject = histogram(subImage);
% or
[counts, grayLevels] = imhist(subImage);
  2 Comments
Thai Duong Nguyen
Thai Duong Nguyen on 18 Jun 2021
what is then the best practice to iterate through the Object featurePoints? It has an location array as properties which gives us the coordinate to the detected corners and we can use them as the centers of our windows. But I want to avoid a for loop there. Is there anyway to do it?
Thanks a lot in advance!
Image Analyst
Image Analyst on 18 Jun 2021
Depends on what you want to do. Nothing wrong with a for loop for a few dozens of locations. It's not the for loop itself that's slow. A for loop will be fast. You can do a for loop with tens of millions of iterations in less than a second if there's nothing computationally intensive inside. You might be able to concatenate all the bounding boxes into a single double array with vertcat().

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!