Using SVM with a real image.
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Data Workflows에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!