资源简介
目标跟踪
代码片段和文件信息
%% Copyright (c) 2007 Christopher Wellons
%%
%% Permission to use copy modify and distribute this software for any
%% purpose with or without fee is hereby granted provided that the
%% above copyright notice and this permission notice appear in all
%% copies.
%%
%% THE SOFTWARE IS PROVIDED “AS IS“ AND THE AUTHOR DISCLAIMS ALL
%% WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
%% WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
%% AUTHOR BE LIABLE FOR ANY SPECIAL DIRECT INDIRECT OR CONSEQUENTIAL
%% DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE DATA OR
%% PROFITS WHETHER IN AN ACTION OF CONTRACT NEGLIGENCE OR OTHER
%% TORTIOUS ACTION ARISING OUT OF OR IN CONNECTION WITH THE USE OR
%% PERFORMANCE OF THIS SOFTWARE.
function project3(folder alpha)
% Chris Wellons
% Ron Ledwich
% Ben Hvostal
% CSE 486 Project 3
% Set number of frames (images) based on folder entered
frames = length(dir(fullfile(folder ‘f*jpg‘)));
% Set alpha
if ~exist(‘alpha‘ ‘var‘)
alpha = .25;
end
% object tracking colors
color_list = [];
color_list = [color_list {[1 0 0]}]; % Red
color_list = [color_list {[0 1 0]}]; % Green
color_list = [color_list {[0 0 1]}]; % Blue
color_list = [color_list {[0 1 1]}]; % Cyan
color_list = [color_list {[1 0 1]}]; % Fuchsia (sp?)
color_list = [color_list {[1 1 1]}]; % White
color_list = [color_list {[1 .5 0]}]; % Orange
color_list = [color_list {[.914 .5882 .4784]}]; % Dark Salmon
color_list = [color_list {[0 1 .5]}]; % Spring green
color_list = [color_list {[.42 .557 .137]}]; % Olive drab
image_list = [{} {} {} {} {}];
% Initialize some variables and stuff
tic; figure;
boxes = [];
SE = strel(‘disk‘ 3);
outm = [];
impad = 5; % Padding around ncc box
ncc_thresh = 0.8; % Threshold for good ncc match
timeave = 0;
% Adaptive Background Subtraction
for i=1:frames
% Figure out time left
timeave = (toc+6*timeave)/7;
timeleft = timeave * (frames - i);
minutes = floor(timeleft/60);
seconds = floor(mod(timeleft60));
tic;
disp([‘Working on frame ‘ num2str(i) ‘ (‘ num2str(minutes) ‘:‘ num2str(seconds) ‘ left)‘]);
[I cI] = getimage(folder i);
% Initialize B
if ~exist(‘B‘ ‘var‘)
B = I;
end
% Get difference data
diff = abs(B - I) * 255;
M = threshold(diff 15);
% Prepare next B
B = alpha*I + (1-alpha)*B;
% Initalize current frame box data
curbox = [];
ncc_pass = 0;
ncc_fail = 0;
% Dilate the difference image
dim = imdilate(M SE);
% Find each object
for j = 1:size(dim 1)
for k = 1:size(dim 2)
if dim(jk) == 1
doit = 0;
% Trace out the object
T = bwtraceboundary(dim [jk] ‘E‘);
% Filter small objects
if length(T) > 100
doit = 1;
end
% Convert trace into a blob
T = full(spconvert([T ones(length(T) 1)]));
[x1 y1 x2 y2] = find_bounds(T);
T(y1:y2x1:x2) = ones(y2-y1+1x2-x1+1);
% Find original parts and draw a box
if doit
C = and(T
- 上一篇:wavelet.m
- 下一篇:Matlab仿真IEEE 802.11a系统.zip
相关资源
- ROC曲线 matlab实现
- matlab2019运动目标检测--数字图像处理
- 检索视频中运动的点并计算线速度角
- 目标检测的DPM模型在windows下的实现
- 基于adaboost算法的目标检测MATLAB代码
- 基于matlab的运动目标检测源代码
- 人脸目标检测的matlab实现论文
- 基于帧差法的运动目标检测程序matl
- 运动目标检测的混合高斯背景建模m
- DPM算法实现:voc-release5(Win7+matlab20
- 运动目标检测算法Matlab
- 梯形调制调频连续波目标解算流程
- matlab实现运动目标检测与最小外接矩
- MATLAB运动视频检测
- VOC2007目标检测ground truth制作
- MATLAB运动目标检测代码
- FasterRcnn2.m
- 用matlab读取视频文件中的图像,并对
- FCM目标检测代码
- 基于MATLAB的行人检测代码
- 基于MATLAB的vibe算法的运动目标检测代
- 自动驾驶多目标检测.7z
- GMM代码用于目标检测
- 运动目标检测的背景建模
- 基于MATLAB运动目标检测追踪
- 运动目标检测光流法
- 代码MATLAB基于形态学的目标检测一
- 视频移动目标检测
- 移动目标检测MATLAB版
- 目标检测matlab代码
评论
共有 条评论