MATLAB: Error :subscripted assignment dimension mismatch when use extractSURFFeature

detectsurffeatures detectbriskfeatures extracthogfeatures

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

Best 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.
Related Question