3

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/

Dima
  • 38,860
  • 14
  • 75
  • 115
  • in the link you send, the say its fast, but not live. it takes 4 seconds per frame! – Ander Biguri Dec 02 '15 at 12:52
  • I know, the example is to illustrate what I want as output for live video, I'm certainly sure that there is a way to do it faster or a least as fast as possible to make it visible on a live video within the while loop. –  Dec 02 '15 at 12:57
  • I dont think youd be able to do it live. but good luck. – Ander Biguri Dec 02 '15 at 12:58
  • If it is possible to do it on the video which is based on frames why would it be not possible to do it on live video which is also based on frames. In footbal matches they record players process it and give output to commentators to give precise information of who the player is. In worst case scenario the live video would be recorder for frames capture processed with active contours and output as video while it is still recording, it would not be as much of "Live video" but it will do the job of being fast enough. Can you help me with that at least. –  Dec 02 '15 at 13:03
  • Did you run `profile` on your code to identify which methods are taking the longest? – Juderb Dec 02 '15 at 13:34
  • No i never heard of this. I'm new to MatLab. I cant find any other method that would work I can only do this on images it is giving me difficulty even on videos because I do not know how to initialize segmentation. If someone can help me with the video in general like it is on the example it would be very beneficial. In the example they have a lot of files which I find hard to identify I only need simple code to see the outcome so then I can work on the performance. –  Dec 02 '15 at 13:41
  • capturing and displaying device takes the longest (not sure if that is what you mean but I used run and time function) –  Dec 02 '15 at 13:49
  • How do I do segmentation for active contours in the video? –  Dec 02 '15 at 16:31
  • Perhaps I need to apply snakes algorithm to each frame this will do the segmentation but IDK. –  Dec 02 '15 at 17:23

0 Answers0