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

 채택된 답변

Walter Roberson
Walter Roberson 2017년 2월 1일
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

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(:);

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Detect, Extract, and Match Features에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by