Filter löschen
Filter löschen

Need help with my eye tracking code.

5 Ansichten (letzte 30 Tage)
HARSHITH H N
HARSHITH H N am 21 Feb. 2018
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

Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by