这里是使用'VIOLA AND JOHNES算法'和'CAMShift'开发的人脸检测模型。它使用边框来跟踪和检测脸部。我想添加活动轮廓/动态活动轮廓,以获取实况视频中脸部的确切形状。它应该只抓住脸部的轮廓而不是它的特征。如何在matlab中的实时视频中添加活动轮廓?如何在活动视频中为活动轮廓添加活动轮廓
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');
figure('menubar','none','tag','webcam');
while (true)
frame=step(obj);
bbox=step(faceDetector,frame);
boxInserter = insertObjectAnnotation(frame,'rectangle',bbox, 'Face Detected');
imshow(boxInserter,'border','tight');
f=findobj('tag','webcam');
if (isempty(f));
[hueChannel,~,~] = rgb2hsv(frame);
% Display the Hue Channel data and draw the bounding box around the face.
figure, imshow(hueChannel), title('Hue channel data');
rectangle('Position',bbox,'EdgeColor','r','LineWidth',1, 'Face Detected')
hold off
noseDetector = vision.CascadeObjectDetector('Nose');
faceImage = imcrop(frame,bbox);
imshow(faceImage)
noseBBox = step(noseDetector,faceImage);
noseBBox(1:1) = noseBBox(1:1) + bbox(1:1);
videoInfo = info(obj);
ROI=get(obj,'ROI');
VideoSize = [ROI(3) ROI(4)];
videoPlayer = vision.VideoPlayer('Position',[300 300 VideoSize+30]);
tracker = vision.HistogramBasedTracker;
initializeObject(tracker, hueChannel, bbox);
while (1)
% Extract the next video frame
frame = step(obj);
% RGB -> HSV
[hueChannel,~,~] = rgb2hsv(frame);
% Track using the Hue channel data
bbox = step(tracker, hueChannel);
% Insert a bounding box around the object being tracked
%Insert text coordinates
% Display the annotated video frame using the video player object
step(videoPlayer);
pause (.2)
end
% Release resources
release(obj);
release(videoPlayer);
close(gcf)
break
end
pause(0.05)
end
release(obj)
对不起,如果我问错了论坛,也许我应该问'元堆栈溢出'?只要告诉我,如果需要,我不会'投下'我,我会在那里提出这个问题。 – UZIERSKI
我认为你的问题属于这里;相当有趣! –
Meta SO上的编程问题应该如何处理?这个问题本身是有效的,虽然它可能需要编辑,因为添加轮廓完全独立于您实际显示的内容(脸部,方形,其他)。所以需要提供一个更好的例子。 – Trilarion