This is works, but i am not sure about my label t_label(1:21,1) is it same rows (From 1 to 21) in the matrix or not,
training_female = 'D:\DBs\jaffe\Train';filenames = dir(fullfile(training_female, '*.TIFF'));total_images = numel(filenames);featureMatrix = [];for n = 1:total_imagesfull_name= fullfile(training_female, filenames(n).name);training_images = imread(full_name);[featureVector, hogVisualization] = extractHOGFeatures(training_images);featureMatrix = [featureMatrix; featureVector];endxx=imread('YM.SA3.57.TIFF');[HOG_test, Visualization] = extractHOGFeatures(xx);t_label = zeros(size(151,1),1); t_label(1:21,1) = 1;% Angry;
t_label(22:41,1) = 2; %Disgusted;
t_label(42:63,1) = 3; %Fear;
t_label(64:85,1) = 4; %Happy;
t_label(86:106,1) = 5; %neutral;
t_label(107:128,1) = 6; %Sad;
t_label(129:151,1) = 7; %Surprised;
class=knnclassify(HOG_test,featureMatrix,t_label);
Best Answer