can some one help to figure out what is wrong with my code and so far help me to find the mouth detection , yawning detection and also the head rotation. please

1 view (last 30 days)
clc;
clear all;
close all;
[vid_name,vid_folder]= uigetfile('*.*','select video');
vid_path=[vid_folder,vid_name];
faceDetector1 = vision.CascadeObjectDetector('EyePairSmall');
faceDetector2 = vision.CascadeObjectDetector('Mouth');
faceDetector3 = vision.CascadeObjectDetector;
videoFileReader = vision.VideoFileReader(vid_path);
while~isDone(videoFileReader)
videoframe=step(videoFileReader); %¶ÁÈ¡ÊÓƵÖеÄͼÏñ
cord_face= step(faceDetector3,videoframe);%¶¨Î»Á³²¿
[x,y]=size(cord_face);
k=1;
for i=2:x
if (cord_face(i,3)>=350) k=i;end;
end
IFaces = insertObjectAnnotation(videoframe, 'rectangle', cord_face(k,:), 'Face');
figure;
imshow(IFaces);%axis on;
Face=imcrop(IFaces,cord_face(k,:));
figure;
imshow(Face),axis on;
[x,y]=size(Face);
[x0,y0]=findeye(Face);
cord_eye=[0,x0,y,y0];
Face_eye=imcrop(Face,cord_eye);
cord_mouth=step(faceDetector2,Face); %¶¨Î»×ì°Í
if (~isempty(cord_mouth))
k=1;
[x0,y0]=size(cord_mouth);
for i=2:x0
if (cord_mouth(i,2)>=cord_mouth(k,2))
k=i;
end;
end
Face_mouth=insertObjectAnnotation(Face, 'rectangle', cord_mouth(k,:), 'Mouth');
figure;
imshow(Face_mouth);
mouth=imcrop(Face,cord_mouth(k,:));
imshow(mouth);
end
pause(0.1);
end
  2 Comments
Dima Lisin
Dima Lisin on 8 Feb 2015
Can you please explain what kind of problems you are having? Do you get an error message? Does the output look wrong? Can you post the output?
Diallo Alhousseny
Diallo Alhousseny on 10 Feb 2015
now I have seen the problem and I found the mouth , now I want to find the yawning and the head heard rotation. I need some advices and so far help me to figure out.

Sign in to comment.

Answers (0)

Categories

Find more on Image Processing and Computer Vision in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!