%% Just read the matlab detections and convert them to plain text

clear all;close all;clc


root = '/usr/local/share/Kitti/person';
trial = fullfile(root,'2011_09_28_drive_0053');
detections_path = fullfile(trial,'detections/data');
detections_text_path = fullfile(trial,'detections_text/data');

detections = dir(fullfile(detections_path,'*.mat'));

mkdir(detections_text_path);

for i=1:size(detections,1)
    load(fullfile(detections_path,detections(i).name));
    
    detections_text_name = [detections(i).name(1:end-4) '.txt'];
    
    if size(bbox,1)>0
        dlmwrite(fullfile(detections_text_path,detections_text_name),bbox(1,1:4),'delimiter',' ');
    end
    
end
