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,9 +18,10 @@ output_dir = './processed_features/';
img_sizes = [64, 112, 224]; img_sizes = [64, 112, 224];
for s=1:numel(img_sizes)
% This will take file after -f and output all the features to directory % This will take file after -f and output all the features to directory
% after -out_dir % after -out_dir, with name after -of
command = sprintf('%s -f "%s" -out_dir "%s" -verbose -simalign', executable, in_file, output_dir); 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) if(isunix)
unix(command); unix(command);
@ -29,11 +30,18 @@ else
end end
%% Output aligned images %% Output aligned images
output_aligned_dir = sprintf('%s/%s_aligned/', output_dir, name); output_aligned_dir = sprintf('%s/sample_%d_aligned/', output_dir, img_sizes(s));
img_files = dir([output_aligned_dir, '/*.bmp']); img_files = dir([output_aligned_dir, '/*.bmp']);
imgs = cell(numel(img_files, 1)); imgs = cell(numel(img_files), 1);
assert(numel(imgs) > 0);
for i=1:numel(img_files) for i=1:numel(img_files)
imgs{i} = imread([ output_aligned_dir, '/', img_files(i).name]); 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}) imshow(imgs{i})
drawnow drawnow
end end
end