Using SVM with a real image.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello, guys!
I have an SVM. It's been trained with 20*40 images of eyes and non-eyes and verified on a test set of images of the same size. Now, in those parts all my images were in matrices of 20x40xN size, converted to 800xN matrices.
Normally, my SVM classifier 'says': it's either 1 for an eye or 0 for non-eye.
How can I use this SVM classifier now on a real image of any size? Probably with nlfilter? I just can't figure out, how to point nlfilter to that classifier and what would be the answer.
% prepare training set from all 20x40 images to nx800 vectors
for i = 1 : length(imageSet)
trainingSet(i,:) = reshape(imageSet(:,:,i),1,800);
% testSet(:,i) = reshape(imageSet(:,:,i),1,[]);
end
% prepare test set from half of eye and half of non-eye 20x40 images to nx800 vectors
for k = 424 : 1393
testSet(k-423,:) = reshape(imageSet(:,:,k),1,800);
end
options = optimset('maxiter',100000);
SVMnet = svmtrain(trainingSet, trainLabels,'options', options);
% classes = svmclassify(SVMnet,testSet);
classes = svmclassify(SVMnet,testSet);
figure;
plot (classes);
Thanks!
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Image Data Workflows finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!