Need help with my eye tracking code.

4 ビュー (過去 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 Center および File ExchangeEye Tracking についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by