资源简介
matlab编写的camshift 目标跟踪源代码
代码片段和文件信息
% Adam Kukucka
% Zach Clay
% Marcelo Molina
% CSE 486 Project 3
function [ trackmov probmov centers ] = camshift
% ******************************************************************
% initialize vari ables
% ******************************************************************
rmin = 0; %min row value for search window
rmax = 0; %max row value for search window
cmin = 0; %min col value for search window
cmax = 0; %max col value for search window
numofframes = 0; %number of frames in the avi
threshold = 1; %threshold for convergence
centerold = [0 0]; %for convergence... previous center of window
centernew = [0 0]; %for convergence... new center of window
% ******************************************************************
% Pre code... load movie and select initial frame
% ******************************************************************
% prompt user for avi file name
user_entry = input(‘Please enter an avi filename: ‘‘s‘);
% load the avi file... handle is M
M = aviread(user_entry);
% get number of frames
[dontneed numberofframes] = size(M);
% initialize matrix to hold center coordinates
imagecenters = zeros(numberofframes 2);
% extract the first frame from the avi
frame1 = M(11);
Image1 = frame2im(frame1);
%%% ********** images(: : numberofframes) = G(::);
% get search window for first frame
[ cmin cmax rmin rmax ] = select( Image1 );
cmin = round(cmin);
cmax = round(cmax);
rmin = round(rmin);
rmax = round(rmax);
wsize(1) = abs(rmax - rmin);
wsize(2) = abs(cmax - cmin);
% create histogram
% translate to hsv
hsvimage = rgb2hsv(Image1);
% pull out the h
huenorm = hsvimage(::1);
% scale to 0 to 255
hue = huenorm*255;
% set unit type
hue=uint8(hue);
% Getting Histogram of Image:
histogram = zeros(256);
for i=rmin:rmax
for j=cmin:cmax
index = uint8(hue(ij)+1);
%count number of each pixel
histogram(index) = histogram(index) + 1;
end
end
% ******************************************************************
% Algorithm from pdf
% ******************************************************************
aviobj1 = avifile(‘example3.avi‘);
aviobj2 = avifile(‘example4.avi‘);
% for each frame
for i = 1:200
disp(‘Processing frame‘);
disp(i);
frame = M(1 i);
I = frame2im(frame);
% translate to hsv
hsvimage = rgb2hsv(I);
% pull out the h
huenorm = hsvimage(::1);
% scale to 0 to 255
hue = huenorm*255;
% set unit type
hue=uint8(hue);
[rows cols] = size(hue);
% choose initial search window
% the search window is (cmin rmin) to (cmax rmax)
% create a probability map
probmap = zeros(rows cols);
for r=1:rows
for c=1:cols
if(hue(rc) ~= 0)
probmap(rc)= histogram(hue(rc));
end
end
end
probmap = probmap/max(max(probmap));
probmap = probmap*255;
count = 0;
rowcenter = 0; % any number just so it runs throug
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 5424 2005-11-10 15:18 genzong\camshift.m
文件 1272 2005-11-09 16:43 genzong\meanshift.m
文件 649 2005-11-09 16:43 genzong\select.m
目录 0 2005-11-29 13:28 genzong
----------- --------- ---------- ----- ----
7345 4
- 上一篇:MSK通信系统仿真搭建
- 下一篇:给予MATLAB的DSB调制解调代码
相关资源
- Camshift跟踪 Matlab实现
- tracking.m
- Camshift目标跟踪matlab实现
- camshift跟踪算法MATLAB源代码注释.txt
- camshift方法的目标跟踪
- 移动机器人轨迹跟踪迭代学习控制 (
- 用matlab仿真多目标跟踪中的航迹关联
- 最新的基于核的相关滤波跟踪法(C
- 卡尔曼滤波目标轨迹跟踪预测 (kal
- 人脸定位跟踪程序(face tracking)
- 弱小目标检测与跟踪 (Small Target De
- KLT-Tracking-algorithm KLT跟踪算法
- Tracking 实现gps卫星的跟踪功能。载波
- GA-pareto 遗传算法的多目标优化算例
-
ob
ject-tracking-ba sed-on-TOD 基于纹理和 -
multiple_ob
ject_tracking(3D) 多目标跟 - multi-target-tracking 多目标跟踪的主程序
- BDStracking 北斗二代接收机中的跟踪程
- tracking GPS信号跟踪的仿真程序
- paticle_filter_tracking
- kalman-tracking 卡尔曼滤波的一个视频跟
- trackinger 目标跟踪程序
- mean-shift-tracking meanshift算法的车辆跟踪
- strong-tracking-filter 清华大学周东华教授
- matlab开发-TrackingToolsOptitrack
- 3D_Tracking的matlab程序
- 利用ftont-tracking 方法在matlab中模拟水
评论
共有 条评论