SVM classifier with sliding window

조회 수: 1 (최근 30일)
Ahmad Alhashil
Ahmad Alhashil 2021년 3월 4일
댓글: Shraddha Jain 2021년 3월 9일
Helloo!!
I am working on detecting eyes open or close by using SVM classifier with HOG feature and there is problem in running the sliding window and do not know what is the mistake.
as you see the code below , i have already trained SVM classifier.
can anyone help me! please
code:
load classifier
imdsTest = imageDatastore('TestImages');
testImg = readimage(imdsTest,1);
figure,
imshow(testImg)
title('Test Image');
%%
s = 5;
w = 100;
h = 40;
[r,c] = size(testImg);
H = zeros(r,c);
r = floor((r-h)/s)+1;
c = floor((c-w)/s)+1;
%%
r1 = 1;
c1 = 1;
for n=1:r
for m=1:c
img = testImg (c1:c1+39,r1:r1+99);
%imshow(img)
hog1 = extractHOGFeatures(img,'CellSize',[2,2]);
[pred,scores] = predict(classifier,hog1);
if (string(pred) == 'closedEye')
pause(1);
H(c1,r1) = - scores(2);
end
r1 = r1+s;
end
r1 = 1;
c1 = c1 +s;
end
[rw,c1]= find(H>0.75);
figure,
imshow(testImg)
title('closed eye Detection')
for d=1:length(rw)
pasue(1)
imrect(gca, [c1(d), rw(d),100,40]); %
end
  댓글 수: 1
Shraddha Jain
Shraddha Jain 2021년 3월 9일
Hi, it would be helpful if you could paste the error that you are seeing.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by