这是面部检测的模型。边界框用于跟踪和检测面部。需要添加活动轮廓以获得面部的精确形状而不是其特征。为此,我们需要继续对视频中的帧进行分段。我在图像上应用了分割,但是在图像上你可以选择你想要初始化分割的图像,因为它是一个静止图像,然而它需要动态和更快,同时它需要循环生动没有存储在任何地方的图像。我想要边界框和活动轮廓可以任何人指导我如何实现这一点?这是迄今为止的代码:
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/