https://github.com/bertinetto/staple
Tip revision: 7b6b5b579a7cd25acae6bcabe93f8dfb78040215 authored by Luca Bertinetto on 25 April 2017, 16:35:58 UTC
added cfnet link
added cfnet link
Tip revision: 7b6b5b5
getAxisAlignedBB.m
function [cx, cy, w, h] = getAxisAlignedBB(region)
% GETAXISALIGNEDBB extracts an axis aligned bbox from the ground truth REGION with same area as the rotated one
cx = mean(region(1:2:end));
cy = mean(region(2:2:end));
x1 = min(region(1:2:end));
x2 = max(region(1:2:end));
y1 = min(region(2:2:end));
y2 = max(region(2:2:end));
A1 = norm(region(1:2) - region(3:4)) * norm(region(3:4) - region(5:6));
A2 = (x2 - x1) * (y2 - y1);
s = sqrt(A1/A2);
w = s * (x2 - x1) + 1;
h = s * (y2 - y1) + 1;
end