资源简介
camshift方法的目标跟踪,可直接运行,但是效果一般,可能改进一下
代码片段和文件信息
% Adam Kukucka
% Zach Clay
% Marcelo Molina
% CSE 486 Project 3
function [ trackmov probmov centers ] = camshift
% ******************************************************************
% initialize vari ables
% ******************************************************************
clc
clear
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(‘moving_car.avi‘);
% 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(14);
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);
huenorm
% 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
% ******************************************************************
% for each frame
for i = 1:numberofframes
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(probma
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2012-12-27 20:42 camshift\
文件 5752 2012-12-21 16:37 camshift\camshift.asv
文件 5802 2012-12-27 20:41 camshift\camshift.m
文件 5874 2012-12-27 20:41 camshift\camshift_new.m
文件 1330 2012-12-20 15:34 camshift\meanshift.m
文件 16461312 2007-06-14 01:27 camshift\moving_car.avi
文件 674 2012-12-25 15:01 camshift\select.m
相关资源
- 红外弱小目标的检测与跟踪
- 雷达对目标的跟踪
- 稀疏表示的目标跟踪
- CPHD的方法实现多目标跟踪
- 运动目标视频跟踪
- LSH 局部敏感直方图的目标跟踪算法
-
风电最大功率跟踪控制的simuli
nk仿真 - 多目标跟踪时的逻辑航迹起始算法
- 爬山法的风力发电最大功率点跟踪
- matlab编写运动视频检测
- 太阳能电池最大功率跟踪仿真(PVMP
- 移动机器人轨迹跟踪迭代学习控制 (
- 最大风能跟踪的双馈风力发电系统(
- matlab实现的利用backstepping算法设计的
- MATLAB作图验证系统在单位阶跃与单位
- 基于视频检测的多目标跟踪的完整m
- 行人跟踪视频目标跟踪
- kcf跟踪算法matlab
- matlab卡尔曼目标跟踪程序
- 用matlab仿真多目标跟踪中的航迹关联
- 运动目标检测与跟踪算法 Matlab
- 基于Meanshift的单目标跟踪算法
- meanshift目标跟踪MATLAB实现
- 基于MATLAB平台的机动目标跟踪程序
- 红外图像的弱小目标检测与跟踪
- 最新的基于核的相关滤波跟踪法(C
- PAMI2015 基于核的相关滤波跟踪方法
- 联合概率数据关联算法(JPDA)
- 卡尔曼滤波目标轨迹跟踪预测 (kal
- 人脸定位跟踪程序(face tracking)
评论
共有 条评论