Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
function save_txt_2_mat(sequence, densematch_dir)
% convert the deepmatching txt to mat file
img_list = {sequence.image};
% assume the images from the same sequence has the same size
img_size = size(imread(img_list{1})); % assume all the image have the same size
% load dense matching
densematch_list = dir([densematch_dir '*DM*.txt']);
densematch = cell(length(img_list));
for i = 1:length(img_list)-1
fprintf(' parsing dense matching for frame %g out of %d \n', i,length(img_list));
im_1 = img_list{i}; [~,name_1,~] = fileparts(im_1);
im_2 = img_list{i+1}; [~,name_2,~] = fileparts(im_2);
densematch_file = [densematch_dir name_1 '-DM-' name_2 '.txt'];
% read and convert sub 2 ind
sub = load(densematch_file);
sub(sub(:,3)==0,3) = 1;sub(sub(:,4)==0,4) = 1;
ind_1 = sub2ind(img_size(1:2), sub(:,2), sub(:,1));
ind_2 = sub2ind(img_size(1:2), sub(:,4), sub(:,3));
densematch{i,i+1} = [ind_1,ind_2];
end
save([densematch_dir 'densematch.mat'],'densematch','-v7.3');
end