Demo script for showing how to use and verifying output aligned image sizes.

This commit is contained in:
Tadas Baltrusaitis 2017-11-24 08:44:02 +00:00
parent a224c10775
commit 39c206e44d
2 changed files with 28 additions and 20 deletions

View file

@ -161,7 +161,7 @@ RecorderOpenFace::RecorderOpenFace(const std::string in_filename, RecorderOpenFa
} }
else else
{ {
this->media_filename = (path(record_root) / path(filename).replace_extension(".bmp")).string(); this->media_filename = (path(record_root) / path(filename).replace_extension(".jpg")).string();
metadata_file << "Output image:" << this->media_filename << endl; metadata_file << "Output image:" << this->media_filename << endl;
} }
} }

View file

@ -1,5 +1,5 @@
% A demo script that demonstrates how to process a single video file using % A demo script that demonstrates how to extract aligned faces from a sequence,
% OpenFace and extract and visualize all of the features % also shows how to extract different sized aligned faces
clear clear
@ -18,22 +18,30 @@ output_dir = './processed_features/';
img_sizes = [64, 112, 224]; img_sizes = [64, 112, 224];
% This will take file after -f and output all the features to directory for s=1:numel(img_sizes)
% after -out_dir % This will take file after -f and output all the features to directory
command = sprintf('%s -f "%s" -out_dir "%s" -verbose -simalign', executable, in_file, output_dir); % after -out_dir, with name after -of
command = sprintf('%s -f "%s" -out_dir "%s" -simalign -simsize %d -of sample_%d', executable, in_file, output_dir, img_sizes(s), img_sizes(s) );
if(isunix)
unix(command);
else
dos(command);
end
%% Output aligned images if(isunix)
output_aligned_dir = sprintf('%s/%s_aligned/', output_dir, name); unix(command);
img_files = dir([output_aligned_dir, '/*.bmp']); else
imgs = cell(numel(img_files, 1)); dos(command);
for i=1:numel(img_files) end
imgs{i} = imread([ output_aligned_dir, '/', img_files(i).name]);
imshow(imgs{i}) %% Output aligned images
drawnow output_aligned_dir = sprintf('%s/sample_%d_aligned/', output_dir, img_sizes(s));
img_files = dir([output_aligned_dir, '/*.bmp']);
imgs = cell(numel(img_files), 1);
assert(numel(imgs) > 0);
for i=1:numel(img_files)
imgs{i} = imread([ output_aligned_dir, '/', img_files(i).name]);
assert(size(imgs{i},1) == img_sizes(s) && size(imgs{i},2) == img_sizes(s));
imshow(imgs{i})
drawnow
end
end end