CMOT中的det.txt=>.mat

2017-07-06  本文已影响60人  sunshine芝火

在CMOT中,

这是struct类型,有4个field,struct的用法可以参见matlab文档。

但是,detections的官方det是.txt文件。以2DMOT2015为例,有10列,其中为了与CMOT代码中的detections相一致,只需要官方det的3,4,5,6列,将其生成和CMOT中的detections的格式相匹配即可。

官方det格式:

关键代码:

下面是思考过程!~

% A = zeros(1000,10); % more than 1000

% %use col 3,4,5,6 => x,y,w,h

% %read useful results

% x = A(:,3);

% y = A(:,4);

% w = A(:,5);

% h = A(:,6);

% B = [x,y,w,h];

% rec = [1,2,3,4;5,6,7,8]

% rec2 = [[1,2,3,4];[5,6,7,8]]

% A = [465,241,31,76;240,232,50,120;322,240,77,186;1:4;5:8;9:12];

% x = A(:,1);

% y = A(:,2);

% w = A(:,3);

% h = A(:,4);

% B = [x,y,w,h];  %A==B

%

% x2 = [465,240,322];

%

% field1 = 'x';

% x = {};

% x{1} = [465;240;322];

% x{2} = [465;240;325];

% x{3} = [216;464;275;150;398;240;327;482];

% field2 = 'y';

% s = struct(field1,x,field2,x);

%%

clear;clc;

data = load('det.txt');

% X = data(:,[1,3:6]);

for i = 1:data(end,1)

ind = find(data(:,1) == i);

x{i} = data(ind,3);

y{i} = data(ind,4);

w{i} = data(ind,5);

h{i} = data(ind,6);

end

s = struct('x',x,'y',y,'w',w,'h',h);

哈嘿!主要思想完成!之后再save成.mat即可。

 

上一篇下一篇

猜你喜欢

热点阅读