Using SVM with a real image.

1 vue (au cours des 30 derniers jours)
Clk Ltr
Clk Ltr le 28 Mai 2014
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!

Réponses (0)

Catégories

En savoir plus sur Image Data Workflows dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by