Need help with my eye tracking code.

조회 수: 1 (최근 30일)
HARSHITH H N
HARSHITH H N 2018년 2월 21일
The below code tracks the eyes and convert it to gray scale for further process. But it only detects eyes when I am looking directly at webcam. If I look away, it stops tracking and won't start again, even if I start looking at the camera later. What modifications can be done to make it track eyes without stopping?
%clear
clc;
clear all;
close all;
%acquire video from webcam
cam = webcam('iBall Face2Face Webcam C8.0');
for idx = 1:1000
% acquire a single image
rgbImage = snapshot(cam);
%face detection
FDetect = vision.CascadeObjectDetector;
Fdetector.MergeThreshold = 100;
%show image
bbx = step(FDetect,rgbImage);
out = insertObjectAnnotation(rgbImage,'rectangle',bbx,'Face');
%eye detection
EyeDetect = vision.CascadeObjectDetector('EyePairBig');
Fdetector.MergeThreshold = 1000;
BBE = step(EyeDetect,out);
out = insertObjectAnnotation(out,'rectangle',BBE,'eye');
% rgb to gray
BBB = imcrop(out,BBE);
Eyes=rgb2gray(BBB);
level=0.3;
Ithresh=imbinarize(Eyes,level);
imshow(Ithresh);
%end
end

답변 (0개)

카테고리

Help CenterFile Exchange에서 Eye Tracking에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by