VOT 数据集 groundtruth 8个维度 转成 4个维度的方法

VOT数据集由于加入了带旋转角度的boundingbox,使得其groundtruth的维度达到了8个

如下:
在这里插入图片描述
8个维度就代表boundingbox的4个点,比如VOT16中,bag数据序列的groundtruth第一行:

334.02,128.36,438.19,188.78,396.39,260.83,292.23,200.41

代表框的4个角点:
(334.02,128.36),(438.19,188.78),(396.39,260.83),(292.23,200.41)

但是很多跟踪算法都是用的4个维度的groundtruth 即我们所熟知的(x,y,w,h),那么怎么转换呢?用下代码:

function [x, y, w, h] = getAxisAlignedBB1(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;
    x=cx-w/2;
    y=cy-h/2;
end
clear all
I = importdata('./wiper.txt'); %输入8维度框的txt文件
[h,w]=size(I);
for i=1:h
    [O(i,1),O(i,2),O(i,3),O(i,4)]=getAxisAlignedBB(I(i,:));
end

dlmwrite('wiper.txt', O); %输出4维度框的txt文件
  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 4
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值