Here is model for face detection. Bounding box is to track and detect face. Active contours need to be added to get exact shape of the face not its features. To do this we need to proceed with segmentation of the frames within the video. I applied segmentation that is done on the image however on the image you can choose where you want to initialize segmentation as it is a still image, with the video however it needs to be dynamic and faster in the same time as it will loop trought live images which are not stored anywhere. I want both the bounding box and active contours can anyone guide me how to achieve this? Here is the code so far:
tic;
clear all
close all
clc
%Create the face detector object.
faceDetector = vision.CascadeObjectDetector();
%Get the input device using image acquisition toolbox,resolution = 640x480 to improve performance
obj =imaq.VideoDevice('winvideo', 1, 'YUY2_320x240','ROI', [1 1 320 240]);
set(obj,'ReturnedColorSpace', 'rgb'); % Set obejct to RGB colours
figure('menubar','none','tag','webcam');
%preview (obj)
while (true)
frame=step(obj);
%----IT IS TO DO WITH THIS PART OF CODE
%m = zeros(size(frame,1),size(frame,2)); %-- create initial mask
%m(20:222,20:250) = 1; %show the specific image with the give parameters
%m = imresize(m,.5); % for fast compution
%seg = region_seg(frame, m, 300); %-- run segmentation
bbox=step(faceDetector,frame);
boxInserter = insertObjectAnnotation(frame,'rectangle',bbox,'Face Detected');
imshow(boxInserter,'border','tight');
f=findobj('tag','webcam');
if (isempty(f));
close(gcf)
break
end
pause(0.05)
end
release(obj)
toc;
Some example of what I want to do: http://groups.inf.ed.ac.uk/calvin/FastVideoSegmentation/