Eye Tracking using Viola jones algorithm

조회 수: 15 (최근 30일)
Deepa Reddy
Deepa Reddy 2020년 9월 24일
can any one help me in this code i'm anable to track eye moment
%% IRIS movement
clear all;
close all;
clc;
info = imaqhwinfo('winvideo',1);
celldisp(info.SupportedFormats);
vid=videoinput('winvideo',1,'YUY2_176x144');
count=1000;
loop=1;
while ~isequal(count,loop)
nFrames = 600;
alpha = 0.05;
fmt = '.png';
disp(['Processing frame: ' num2str(loop)]);
set(vid,'ReturnedColorSpace','rgb');
a1 = getsnapshot(vid);
I = rgb2gray(a1);
%% EYE Dtection Process
EyeDetect = vision.CascadeObjectDetector('EyePairBig');
righteye = vision.CascadeObjectDetector('RightEye');
BB=step(EyeDetect,I);
BB1=step(righteye,I);
figure(1);
if length(BB)<4
imshow(I);
hold on
else
if size(BB,1)>2
BB=BB(1:2,:);
end
end
for i = 1:size(BB,1)
imshow(I);
rectangle('Position',BB(i,:),'LineWidth',4,'LineStyle','-','EdgeColor','r');
rectangle('Position',BB1(i,:),'LineWidth',4,'LineStyle','-','EdgeColor','g');
hold on
wa = imcrop(I,[BB(i,1) BB(i,2) BB(i,3) BB(i,4)]);
ra = imcrop(I,[BB1(i,1) BB1(i,2) BB1(i,3) BB1(i,4)]);
end
title('Eyes Detection');
I = double(I);
cd ..
figure(2);
subplot(121);
imshow(wa);
subplot(122);
imshow(ra);
hold on
arows=size(ra,1);
acols=size(ra,2);
ath=zeros(arows,acols);
for i =1:arows
for j=1:acols
if ra(i,j)>80
ath(i,j)=255;
end
end
end
loop = loop + 1
end

답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Mobile Fundamentals에 대해 자세히 알아보기

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by