Reputation: 51
I'm working on Content based image retrieval project using matlab
when I apply the function point=detectSURFFeatures(image)
I get 83*1
surf point that has the following information:
`Scale: [83x1 single]
SignOfLaplacian: [83x1 int8]
Orientation: [83x1 single]
Location: [83x2 single]
Metric: [83x1 single]
Count: 83`
I need to know how I can extract a (distinctive and Fixed) feature vector that represents each image in a database that contains thousands of images,any help please ?
Here is the samples of the database. (Wang database)
Upvotes: 1
Views: 2857
Reputation: 39389
First of all, detectSURFFeatures
only gives you the interest point locations, scales, and orientations. You also have to call extractFeatures
, which will give you the SURF descriptors, that are vectors describing the image patch around each interest point.
Now, you are trying to convert a set of patch descriptors representing an image into a single vector, and there are multiple ways to do that. A popular approach is called bag of features, aka bag of visual words.
Upvotes: 1
Reputation: 1960
Currently, I am using imread
to read the image as follows. Matlab's detectSURFFeatures
function only works on greyscale images.
I = rgb2gray( imread( '434.jpg' ) );
You can run this line to get the SURF features.
points = detectSURFFeatures( I );
You can plot the surf features using the following.
imshow( I );
hold on;
plot( point.selectStrongest(10) );
hold off;
Here is the visualization of the image I worked with.
This printing the points
object, you can get the following properties showing 41 features.
Scale: [41x1 single]
SignOfLaplacian: [41x1 int8]
Orientation: [41x1 single]
Location: [41x2 single]
Metric: [41x1 single]
Count: 41
If you have all the grayscale images stored in a cell object called cellimg
(one cell element for each image), you can run detectSURFFeatures
on each one as follows.
cellsurf = cellfun( @(I) detectSURFFeatures( I ), cellimg, 'UniformOutput', false );
Each element of cellsurf
will contain SURF points. Since you want a set of distinctive and fixed features that will identify each image, you can select the strongest points on each image in cellsurf
. You can either use the top n
number of features or set n = min( points )
. Calculate the min number of features using the following code.
n = min( cellfun( @(S) S.Count, cellsurf ) );
Then you can select the strongest points by running selectStrongest
on each cell in cellsurf
.
F = cellfun( @(S) S.selectStrongest( n ), cellsurf, 'UniformOutput', false);
The variable F
will contain a constant set of features. You can change n
accordingly to change the number of strongest features you want. To match two sets of features, you can use the builtin matchFeatures function.
Notes
detectSURFFeatures
function.detectBRISKFeatures
, detectFASTFeatures
, detectHarrisFeatures
, detectMinEigenFeatures
, detectMSERFeatures
Upvotes: 1