目标跟踪基于matlab卡尔曼滤波多目标跟踪含Matlab源码 1832期

Posted 紫极神光

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了目标跟踪基于matlab卡尔曼滤波多目标跟踪含Matlab源码 1832期相关的知识,希望对你有一定的参考价值。

一、Kalman简介

运动物体跟踪实际上就是对运动物体位置的测量和估计,和称小兔兔体重一样,我们也有两个渠道可以知道运动物体的位置,一个是我们观察到的,目标A在的某一帧图像的某个坐标点,另一个是我们根据前面几帧里目标的运动情况估计出来的,这个估计是假定目标运动是光滑的(当然也可以有其他模型),在这个根据以前运动做出的估计和我们测出来的目标点位置之间做个加权平均,就是现在的估计值,对下一帧做同样处理,加权平均的权值就是Kalman增益,根据Kalman提供的算法可由以往的误差大小和分布推出,这就是全部的用Kalman滤波做目标跟踪的概念。
Kalman滤波理论主要应用在现实世界中个,并不是理想环境。主要是来跟踪的某一个变量的值,跟踪的依据是首先根据系统的运动方程来对该值做预测,比如说我们知道一个物体的运动速度,那么下面时刻它的位置按照道理是可以预测出来的,不过该预测肯定有误差,只能作为跟踪的依据。另一个依据是可以用测量手段来测量那个变量的值,当然该测量也是有误差的,也只能作为依据,不过这2个依据的权重比例不同。最后kalman滤波就是利用这两个依据进行一些列迭代进行目标跟踪的。
在这个理论框架中,有2个公式一定要懂,即:


二、部分源代码

function varargout = MainTrack(varargin)
% MAINTRACK MATLAB code for MainTrack.fig
%      MAINTRACK, by itself, creates a new MAINTRACK or raises the existing
%      singleton*.
%
%      H = MAINTRACK returns the handle to a new MAINTRACK or the handle to
%      the existing singleton*.
%
%      MAINTRACK('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in MAINTRACK.M with the given input arguments.
%
%      MAINTRACK('Property','Value',...) creates a new MAINTRACK or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before MainTrack_OpeningFcn gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to MainTrack_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help MainTrack

% Last Modified by GUIDE v2.5 29-Mar-2022 23:32:54

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
    'gui_Singleton',  gui_Singleton, ...
    'gui_OpeningFcn', @MainTrack_OpeningFcn, ...
    'gui_OutputFcn',  @MainTrack_OutputFcn, ...
    'gui_LayoutFcn',  [] , ...
    'gui_Callback',   []);
if nargin && ischar(varargin1)
    gui_State.gui_Callback = str2func(varargin1);
end

if nargout
    [varargout1:nargout] = gui_mainfcn(gui_State, varargin:);
else
    gui_mainfcn(gui_State, varargin:);
end
% End initialization code - DO NOT EDIT


% --- Executes just before MainTrack is made visible.
function MainTrack_OpeningFcn(hObject, ~, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to MainTrack (see VARARGIN)

% Choose default command line output for MainTrack
handles.output = hObject;


% Update handles structure
guidata(hObject, handles);

% UIWAIT makes MainTrack wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = MainTrack_OutputFcn(~, ~, handles)
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout1 = handles.output;


% 最核心的函数,检测按钮
function mainB_Callback(~, ~, handles)



%数据的前期准备
set(handles.numText,'string',0);%计数框清零
set(handles.endTime,'string',0);%结束时间清零
set(handles.startTime,'string',datestr(datetime('now')));
set(handles.infoP,'Visible','on');

%视频获取途径的选择
camSwitch=get(handles.radioCam,'value');%获取值
position=handles.position;
areaSwitch=handles.areaSwitch;
if areaSwitch>0;
    BW = handles.BW;%传递二进制图
end

三、运行结果

四、matlab版本及参考文献

1 matlab版本
2014a

2 参考文献
[1] 蔡利梅.MATLAB图像处理——理论、算法与实例分析[M].清华大学出版社,2020.
[2]杨丹,赵海滨,龙哲.MATLAB图像处理实例详解[M].清华大学出版社,2013.
[3]周品.MATLAB图像处理与图形用户界面设计[M].清华大学出版社,2013.
[4]刘成龙.精通MATLAB图像处理[M].清华大学出版社,2015.

以上是关于目标跟踪基于matlab卡尔曼滤波多目标跟踪含Matlab源码 1832期的主要内容,如果未能解决你的问题,请参考以下文章

目标跟踪基于matlab帧差法结合卡尔曼滤波行人姿态识别含Matlab源码 1127期

轨迹跟踪基于matlab拓展卡尔曼滤波时序四旋翼无人机状态跟踪含Matlab源码 2246期

滤波跟踪基于matlab北方苍鹰和粒子群算法优化粒子滤波器目标滤波跟踪含Matlab源码 2260期

目标跟踪基于扩展卡尔曼滤波实现目标群跟踪matlab源码

目标跟踪基于扩展卡尔曼滤波实现目标群跟踪matlab源码

基于扩展卡尔曼滤波的目标跟踪仿真