error :subscripted assignment dimension mismatch when use extractSURFFeature?

when i extract surf or fast feature , i have error but when i used extractHOGFeatures i do not have error
for i = 1:numel(trainingSet.Files)
I = readimage(trainingSet, i);
I=imresize(I,[1024 1024]);
I = rgb2gray(I);
train=detectSURFFeatures(I);
[trainfeatures(i,:), trainpoints(i,:)]= extractFeatures(I,train.selectStrongest(10));
end
Error: subscripted assignment dimension mismatch
how can i use extractSURFFeatures and detectBRISKFeatures instead of extractHOGFeatures

 Accepted Answer

For SURF:
"M-by-N matrix | binaryFeatures object
Feature vectors, returned as a binaryFeatures object or an M-by-N matrix of M feature vectors, also known as descriptors. Each descriptor is of length N."
For HOG:
"features = extractHOGFeatures(I) returns extracted HOG features from a truecolor or grayscale input image, I. The features are returned in a 1-by-N vector, where N is the HOG feature length"
Notice that HOG returns a vector, but SURF returns a 2D array.
You could assign the SURF features to a variable and reshape that to a vector for storing.

2 Comments

first, thanks for your help
second , i change the code to
[trainfeatures, trainpoints]= extractFeatures(I,train.selectStrongest(10));
trainfeatures=reshape(trainfeatures,1,[]);
trainfeatures(i,:)=trainfeatures;
but i asked if i can use better way to do this
please help me as i am new in matlab
[these_trainfeatures, these_trainpoints] = extractFeatures(I,train.selectStrongest(10));
trainfeatures(i,:) = these_trainfeatures(:);

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!