-
Notifications
You must be signed in to change notification settings - Fork 1
/
myMainScript.m
37 lines (30 loc) · 1.07 KB
/
myMainScript.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
clear all; close all; clc;
%% Add packages to path
% dirPath = fullfile(pwd,'/extPkg/');
% allSearchPaths = genpath(dirPath);
% addpath(allSearchPaths);
%% Get the video
[videoFileName, videoFilePath] ...
= uigetfile({'*.mp4','MP4 Video (*.mp4)'; ...
'*.avi;','Avi Video (*.avi)'; ...
'*.*', 'All Files (*.*)'}, ...
'Select a video file for object tracking', ...
'MultiSelect', 'off');
if isequal(videoFileName,0)
error('[ ERROR ] User did not select any video');
else
fprintf(1, 'User selected %s\n', videoFileName);
end
[videoMatrix] = myImportMovie(videoFilePath, videoFileName, 0, -1);
myPlayMovie(videoMatrix, 0, -1);
if(ndims(videoMatrix)==4)
firstImage = videoMatrix(:, :, :, 1);
elseif(ndims(videoMatrix)==3)
firstImage = videoMatrix(:, :, 1);
end
[selectedPatch, rect] = mySelectPatch(videoMatrix);
kernelType = 'gaussian';
[kernel] = myKernel(kernelType, rect(1,3), rect(1,4), 1);
[newPatch, map, m] = myCalculateB(firstImage, selectedPatch);
[q] = myGetProbabilityDistribution(newPatch, kernel, m);
% myMainAlgorithm(videoMatrix, kernel, q, rect);