【目标追踪】基于核相关滤波器实现目标跟踪含matlab源码

简介: 【目标追踪】基于核相关滤波器实现目标跟踪含matlab源码

1 简介

目标跟踪技术在智能交通、安全监控、人机交互和运动分析等领域有着广泛的应用。近些年,目标跟踪技术取得了飞速的发展,涌现出许多优秀的目标跟踪算法,解决了很多棘手的目标跟踪问题。但是,目标跟踪技术仍然面临着很多的挑战,由于现实环境较为复杂,目前的跟踪算法在实时性、精确性等方面还不能满足实际应用。本文对KCF目标跟踪算法进行优化,KCF跟踪算法利用循环矩阵进行密集采样提取图像的HOG特征,使用正则化最小二乘分类器进行训练提高了运行速度。KCF跟踪算法的优势为目标跟踪速度快,在Benmark视频序列集OTB50的平均速度为172fps,平均精度为73.2%。

2 部分代码

function [img_files, pos, target_sz, ground_truth, video_path] = load_video_info(base_path, video)%LOAD_VIDEO_INFO%   Loads all the relevant information for the video in the given path:%   the list of image files (cell array of strings), initial position%   (1x2), target size (1x2), the ground truth information for precision%   calculations (Nx2, for N frames), and the path where the images are%   located. The ordering of coordinates and sizes is always [y, x].%在给定路径中加载视频的所有相关信息:图像文件列表(字符串单元数组)、初始位置(1x2)、%目标大小(1x2)、用于精确计算的ground truth信息(N帧的Nx2)以及图像所在的路径。%坐标和大小的顺序总是[y, x]。%%   Joao F. Henriques, 2014%   http://www.isr.uc.pt/~henriques/  %see if there's a suffix, specifying one of multiple targets, for  %example the dot and number in 'Jogging.1' or 'Jogging.2'.  %{    if numel(video) >= 2 && video(end-1) == '.' && ~isnan(str2double(video(end))),    suffix = video(end-1:end);  %remember the suffix    video = video(1:end-2);  %remove it from the video name  else    suffix = '';  end  %full path to the video's files  if base_path(end) ~= '/' && base_path(end) ~= '\',    base_path(end+1) = '/';  end    %}  %video_path = [base_path video '/'];    %video_path = [base_path video];%     video_path = choose_video(base_path);%大概因为这句,所以我需要选择两次视频    video_path = video;        %try to load ground truth from text file (Benchmark'sformat)    %尝试从文本文件(基准测试的格式)加载ground truth  %{    filename = [video_path 'Basketball_gt' suffix '.txt'];  f = fopen(filename);  assert(f ~= -1, ['No initial position or ground truth to load ("' filename '").'])    %the format is [x, y, width, height]  try    ground_truth = textscan(f, '%f,%f,%f,%f', 'ReturnOnError',false);    catch  %#ok, try different format (no commas)    frewind(f);    ground_truth = textscan(f, '%f %f %f %f');    end    %}        text_files = dir([video_path '*_gt.txt']);  assert(~isempty(text_files), 'No initial position and ground truth (*_gt.txt) to load.')  f = fopen([video_path text_files(1).name]);  ground_truth = textscan(f, '%f,%f,%f,%f');%已经将car4数据进行修改      ground_truth = cat(2, ground_truth{:});  fclose(f);    %set initial position and size      target_sz = [ground_truth(1,4), ground_truth(1,3)];  pos = [ground_truth(1,2), ground_truth(1,1)] + floor(target_sz/2);         if size(ground_truth,1) == 1,    %we have ground truth for the first frame only (initial position)    ground_truth = [];  else    %store positions instead of boxes    ground_truth = ground_truth(:,[2,1]) + ground_truth(:,[4,3]) / 2;  end      %from now on, work in the subfolder where all the images are  video_path = [video_path 'imgs/'];    %f or these sequences, we must limit ourselves to a range of frames.  %for all others, we just load all png/jpg files in the folder.   frames = {'David', 300, 770;        'Football1', 1, 74;        'Freeman3', 1, 460;              'Freeman4', 1, 283};    idx = find(strcmpi(video, frames(:,1)));    if isempty(idx),    %general case, just list all images    img_files = dir([video_path '*.png']);    if isempty(img_files),      img_files = dir([video_path '*.jpg']);      assert(~isempty(img_files), 'No image files to load.')    end    img_files = sort({img_files.name});  else    %list specified frames. try png first, then jpg.    if exist(sprintf('%s%04i.png', video_path, frames{idx,2}), 'file'),      img_files = num2str((frames{idx,2} : frames{idx,3})', '%04i.png');          elseif exist(sprintf('%s%04i.jpg', video_path, frames{idx,2}), 'file'),      img_files = num2str((frames{idx,2} : frames{idx,3})', '%04i.jpg');          else      error('No image files to load.')    end        img_files = cellstr(img_files);  end  end

3 仿真结果

4 参考文献

[1] J. F. Henriques, R. Caseiro, P. Martins, J. Batista, "High-Speed Tracking with

Kernelized Correlation Filters", TPAMI 2014 (to be published).


[2] J. F. Henriques, R. Caseiro, P. Martins, J. Batista, "Exploiting the Circulant

Structure of Tracking-by-detection with Kernels", ECCV 2012.


[3] Y. Wu, J. Lim, M.-H. Yang, "Online Object Tracking: A Benchmark", CVPR 2013.

Website: http://visual-tracking.net/


[4] P. Dollar, "Piotr's Image and Video Matlab Toolbox (PMT)".

Website: http://vision.ucsd.edu/~pdollar/toolbox/doc/index.html


[5] P. Dollar, S. Belongie, P. Perona, "The Fastest Pedestrian Detector in the

West", BMVC 2010.

博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。

部分理论引用网络文献,若有侵权联系博主删除。

相关文章
|
28天前
|
存储 编解码 算法
【多光谱滤波器阵列设计的最优球体填充】使用MSFA设计方法进行各种重建算法时,图像质量可以提高至多2 dB,并在光谱相似性方面实现了显著提升(Matlab代码实现)
【多光谱滤波器阵列设计的最优球体填充】使用MSFA设计方法进行各种重建算法时,图像质量可以提高至多2 dB,并在光谱相似性方面实现了显著提升(Matlab代码实现)
|
29天前
|
机器学习/深度学习 编解码 并行计算
【改进引导滤波器】各向异性引导滤波器,利用加权平均来实现最大扩散,同时保持图像中的强边缘,实现强各向异性滤波,同时保持原始引导滤波器的低低计算成本(Matlab代码实现)
【改进引导滤波器】各向异性引导滤波器,利用加权平均来实现最大扩散,同时保持图像中的强边缘,实现强各向异性滤波,同时保持原始引导滤波器的低低计算成本(Matlab代码实现)
141 8
|
1月前
|
机器学习/深度学习 算法 安全
【无人机三维路径规划】基于非支配排序的鲸鱼优化算法NSWOA与多目标螳螂搜索算法MOMSA求解无人机三维路径规划研究(Matlab代码实现)
【无人机三维路径规划】基于非支配排序的鲸鱼优化算法NSWOA与多目标螳螂搜索算法MOMSA求解无人机三维路径规划研究(Matlab代码实现)
|
1月前
|
传感器 机器学习/深度学习 算法
【使用 DSP 滤波器加速速度和位移】使用信号处理算法过滤加速度数据并将其转换为速度和位移研究(Matlab代码实现)
【使用 DSP 滤波器加速速度和位移】使用信号处理算法过滤加速度数据并将其转换为速度和位移研究(Matlab代码实现)
119 1
|
1月前
|
机器学习/深度学习 算法 调度
基于NSGA-III算法求解微电网多目标优化调度研究(Matlab代码实现)
基于NSGA-III算法求解微电网多目标优化调度研究(Matlab代码实现)
|
1月前
|
机器学习/深度学习 算法 安全
【无人机三维路径规划】多目标螳螂搜索算法MOMSA与非支配排序的鲸鱼优化算法NSWOA求解无人机三维路径规划研究(Matlab代码实现)
【无人机三维路径规划】多目标螳螂搜索算法MOMSA与非支配排序的鲸鱼优化算法NSWOA求解无人机三维路径规划研究(Matlab代码实现)
|
28天前
|
存储 算法 安全
【多目标工程应用】基于MOGWO的地铁隧道上方基坑工程优化设计研究(Matlab代码实现)
【多目标工程应用】基于MOGWO的地铁隧道上方基坑工程优化设计研究(Matlab代码实现)
|
28天前
|
机器学习/深度学习 运维 算法
【微电网多目标优化调度】多目标学习者行为优化算法MOLPB求解微电网多目标优化调度研究(Matlab代码实现)
【微电网多目标优化调度】多目标学习者行为优化算法MOLPB求解微电网多目标优化调度研究(Matlab代码实现)
118 1
|
1月前
|
机器学习/深度学习 运维 算法
【储能选址定容】基于多目标粒子群算法的配电网储能选址定容(Matlab代码实现)
【储能选址定容】基于多目标粒子群算法的配电网储能选址定容(Matlab代码实现)
138 4
|
1月前
|
算法 安全 定位技术
基于改进拥挤距离的多模态多目标优化差分进化(MMODE-ICD)求解无人机三维路径规划研究(Matlab代码实现)
基于改进拥挤距离的多模态多目标优化差分进化(MMODE-ICD)求解无人机三维路径规划研究(Matlab代码实现)

热门文章

最新文章