Need help with my eye tracking code.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Eye Tracking finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!