3

这是人脸检测的模型。边界框是跟踪和检测人脸。需要添加活动轮廓以获得面部的精确形状而不是其特征。为此,我们需要对视频中的帧进行分割。我应用了在图像上完成的分割,但是在图像上,您可以选择要初始化分割的位置,因为它是静止图像,但是视频需要动态且更快,因为它将实时循环播放没有存储在任何地方的图像。我想要边界框和活动轮廓,谁能指导我如何实现这一目标?这是到目前为止的代码:

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;

我想做的一些例子:http ://groups.inf.ed.ac.uk/calvin/FastVideoSegmentation/

4

0 回答 0