0

I'm planning to transfer only a few feature descriptors which have been classified using SVM. I tried to put the selected descriptors in a matrix but I can't match them properly. Here's the code that I made in order to transfer the selected descriptors to another variable.

[nrows, ncolumns] = size(fdImage);
SVMResultFace = svmclassify(SVMStructFace, fdImage);
ClassifiedFace = [];
for row = 1:nrows
    if SVMResultFace(row,1) == 1
        ClassifiedFace = [ClassifiedFace; fdImage(row,:)];
    end
end

is there a more proper way to do this? Thanks!

Jessie
  • 363
  • 2
  • 6
  • 20

1 Answers1

0

The easiest way to eliminate those rows from fdImage is just to use logical indexing:

SVMResultFace = svmclassify(SVMStructFace, fdImage);
include_row = SVMResultFace(:,1) == 1;
ClassifiedFace = fdImage(include_row,:);
khonegger
  • 198
  • 8