-
Notifications
You must be signed in to change notification settings - Fork 20
/
PSR.m
30 lines (25 loc) · 838 Bytes
/
PSR.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
%
% Reliable Patch Trackers: Robust Visual Tracking by Exploiting Reliable Patches
%
% Yang Li, 2015
% http://ihpdep.github.io
%
% This is the research code of our RPT tracker. You can check the
% details in our CVPR paper.
function [ psr ] = PSR( response, rate )
%PSR Summary of this function goes here
% Detailed explanation goes here
maxresponse = max(response(:));
%calculate the PSR
range = ceil(sqrt(numel(response))*rate);
response=fftshift(response);
[xx, yy] = find(response == maxresponse, 1);
idx = xx-range:xx+range;
idy = yy-range:yy+range;
idy(idy<1)=1;idx(idx<1)=1;
idy(idy>size(response,2))=size(response,2);idx(idx>size(response,1))=size(response,1);
response(idx,idy)=0;
m = sum(response(:))/numel(response);
d=sqrt(size(response(:),1)*var(response(:))/numel(response));
psr =(maxresponse - m)/d ;
end