Face Detection

We implemented the first four steps of the flowchart:

We used the VideoReader and read functions in matlab to read a video and extract every frame of the video.
We used the inbuilt functions in Matlab for face detection based on the Viola Jones algorithm - https://in.mathworks.com/help/vision/ref/vision.cascadeobjectdetector-class.html

CODE:

clc;
blink = VideoReader('blinky2.mp4');
for img = 290:291; 
    b = read(blink, img);
    FDetect = vision.CascadeObjectDetector;
    I = b;
    BoundBox = step(FDetect,I);
    figure,
    imshow(I); hold on
    for i = 1:size(BoundBox,1)
        rectangle('Position',BoundBox(i,:),'LineWidth',5,'LineStyle','-','EdgeColor','r');
    end
    for i = 1:size(BoundBox,1)
        J= imcrop(I,BoundBox(i,:));
        hold off;
        imshow(J);hold on
    end
end








Comments

Popular posts from this blog

Eye Detection

Yawn Detection

Training a Classifier