资源简介
通过KLT Algorithm可以实现对视频中人脸的定位与追踪,效果良好
代码片段和文件信息
%% 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
- 上一篇:UML网上购物系统 实体类图
- 下一篇:量子遗传算法matlab代码.zip
相关资源
- easi algorithm for blind source separation
- 神经网络中hopfield算法的Matlab的实现
- KLT_MATLAB
- LMS和RLS算法
- KLTransform
- lm算法的matlab实现
- Chicken Swarm Optimization鸡群优化算法和
- 2014年最新提出的仿生群智能优化算法
-
matlab开发-mssamultiob
jectivesalpswarmalg - Connected Component algorithm
- The MATLAB Genetic Algorithm Toolbox
- SIMPLE算法Matlab代码
- MAP algorithm Matlab
- NSP algorithm 彭思龙教授提出的零空间追
- Water flooding Algorithm 认知无线电中的注
- pso algorithms 粒子群算法
- Trigger Algorithm 算法
- intelligent algorithm 智能算法
- 人工蜂群算法优化无刷直流电机PID控
- matlab实现遗传算法 (Matlab Genetic Al
- matlab仿真的图像序列的柱面全景拼接
- Particle Swarm Optimization(PSO) Algorithm
- 人工蜂群算法 优化算法 Matlab 附测试
- 磷虾群优化算法 (Krill herd optimizati
- 非线性算法合集(nonlinear algorithm)
- 混沌算法(Chaos Algorithm)入门和代码
- ksvd algorithm and psnr ksvd字典学习算法
- TURBO均衡算法(Turboequlization_algorithm)
- 布谷鸟搜索算法 Cuckoo Optimization Algo
- GPS-Acquisition-Algorithm GPS信号的捕获算法
评论
共有 条评论