Detecting frames for which a face appears in a video...

1 view (last 30 days)
I need to detect the number of frames for which a face is appearing in a video. I looked into the sample code using CAMShift algorithm (<http://www.mathworks.in/help/vision/examples/face-detection-and-tracking-using-camshift.html)>. Is there a way to get true and false values from the step function (bbox = step(faceDetector, videoFrame);) in order to know if a face appears in a particular frame? I'm new to MatLab. I'm assuming inbuilt functions (the step function seems pretty confusing) return some default value in case a condition fails. Is there a possible solution?
I am not concerned about the computational burden - although a faster approach for the same would be appreciated.

Answers (1)

Dima Lisin
Dima Lisin on 15 Jul 2014
If a face is not detected in a frame, bbox will be empty. So you can simply check
if isempty(bbox) ...
to handle the case when a face is not detected.
Generally, you probably want to track the face, because vision.CascadeObject detector is not likely to detect a face, which is tilted or turned. Please see this example of tracking a face using the KLT algorithm, and this example of tracking multiple faces .

Categories

Find more on Computer Vision Toolbox 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!