91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

通過KLT Algorithm可以實(shí)現(xiàn)對(duì)視頻中人臉的定位與追蹤,效果良好

資源截圖

代碼片段和文件信息

%%?Face?Detection?and?Tracking?Using?the?KLT?Algorithm
%?This?example?shows?how?to?automatically?detect?and?track?a?face?using
%?feature?points.?The?approach?in?this?example?keeps?track?of?the?face?even
%?when?the?person?tilts?his?or?her?head?or?moves?toward?or?away?from?the
%?camera.
%
%???Copyright?2013?The?MathWorks?Inc.

%%?Detect?a?Face
%?Create?a?cascade?detector?object.
faceDetector?=?vision.CascadeobjectDetector();

%?Open?a?video?file
videoFileReader?=?vision.VideoFileReader(‘tilted_face.avi‘);

%?Read?a?video?frame?and?run?the?face?detector.
videoframe??????=?step(videoFileReader);
bbox????????????=?step(faceDetector?videoframe);

%?Convert?the?box?to?a?polygon.?This?is?needed?to?be?able?to?visualize?the
%?rotation?of?the?object.
x?=?bbox(1);?y?=?bbox(2);?w?=?bbox(3);?h?=?bbox(4);
bboxPolygon?=?[x?y?x+w?y?x+w?y+h?x?y+h];

%?Draw?the?returned?bounding?box?around?the?detected?face.
shapeInserter??=?vision.ShapeInserter(‘Shape‘?‘Polygons‘?‘BorderColor‘‘Custom‘...
????‘CustomBorderColor‘[255?255?0]);
videoframe?=?step(shapeInserter?videoframe?bboxPolygon);
figure;?imshow(videoframe);?title(‘Detected?face‘);

%%?Identify?Facial?Features?To?Track
%?Crop?out?the?region?of?the?image?containing?the?face?and?detect?the
%?feature?points?inside?it.
cornerDetector?=?vision.CornerDetector(‘Method‘?...
????‘Minimum?eigenvalue?(Shi?&?Tomasi)‘);
points?=?step(cornerDetector?rgb2gray(imcrop(videoframe?bbox)));

%?The?coordinates?of?the?feature?points?are?with?respect?to?the?cropped?
%?region.?They?need?to?be?translated?back?into?the?original?image
%?coordinate?system.?
points?=?double(points);
points(:?1)?=?points(:?1)?+?double(bbox(1));
points(:?2)?=?points(:?2)?+?double(bbox(2));

%?Display?the?detected?points.
markerInserter?=?vision.MarkerInserter(‘Shape‘?‘Plus‘?...
????‘BorderColor‘?‘White‘);
videoframe?=?step(markerInserter?videoframe?points);
figure?imshow(videoframe)?title(‘Detected?features‘);

%%?Initialize?a?Tracker?to?Track?the?Points
%?Create?a?point?tracker?and?enable?the?bidirectional?error?constraint?to
%?make?it?more?robust?in?the?presence?of?noise?and?clutter.
pointTracker?=?vision.PointTracker(‘MaxBidirectionalError‘?2);

%?Initialize?the?tracker?with?the?initial?point?locations?and?the?initial
%?vide

評(píng)論

共有 條評(píng)論