Bug fix in opening video sequences revealed by a demo script.
This commit is contained in:
parent
488cd4d92f
commit
7e16619529
3 changed files with 47 additions and 49 deletions
|
@ -110,19 +110,25 @@ int main (int argc, char **argv)
|
|||
{
|
||||
|
||||
// The sequence reader chooses what to open based on command line arguments provided
|
||||
if(!sequence_reader.Open(arguments) && sequence_reader.no_input_specified)
|
||||
if(!sequence_reader.Open(arguments))
|
||||
{
|
||||
// If that fails, revert to webcam
|
||||
INFO_STREAM("No input specified, attempting to open a webcam 0");
|
||||
if (!sequence_reader.OpenWebcam(0))
|
||||
ERROR_STREAM("Failed to open the webcam");
|
||||
// If failed to open because no input files specified, attempt to open a webcam
|
||||
if (sequence_reader.no_input_specified)
|
||||
{
|
||||
// If that fails, revert to webcam
|
||||
INFO_STREAM("No input specified, attempting to open a webcam 0");
|
||||
if (!sequence_reader.OpenWebcam(0))
|
||||
{
|
||||
ERROR_STREAM("Failed to open the webcam");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_STREAM("Failed to open a sequence");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_STREAM("Failed to open a sequence");
|
||||
break;
|
||||
}
|
||||
|
||||
INFO_STREAM("Device or file opened");
|
||||
|
||||
cv::Mat captured_image = sequence_reader.GetNextFrame();
|
||||
|
|
|
@ -156,19 +156,25 @@ int main (int argc, char **argv)
|
|||
{
|
||||
|
||||
// The sequence reader chooses what to open based on command line arguments provided
|
||||
if (!sequence_reader.Open(arguments) && sequence_reader.no_input_specified)
|
||||
if (!sequence_reader.Open(arguments))
|
||||
{
|
||||
// If that fails, revert to webcam
|
||||
INFO_STREAM("No input specified, attempting to open a webcam 0");
|
||||
if (!sequence_reader.OpenWebcam(0))
|
||||
ERROR_STREAM("Failed to open the webcam");
|
||||
// If failed to open because no input files specified, attempt to open a webcam
|
||||
if (sequence_reader.no_input_specified)
|
||||
{
|
||||
// If that fails, revert to webcam
|
||||
INFO_STREAM("No input specified, attempting to open a webcam 0");
|
||||
if (!sequence_reader.OpenWebcam(0))
|
||||
{
|
||||
ERROR_STREAM("Failed to open the webcam");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_STREAM("Failed to open a sequence");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ERROR_STREAM("Failed to open a sequence");
|
||||
break;
|
||||
}
|
||||
|
||||
INFO_STREAM("Device or file opened");
|
||||
|
||||
cv::Mat captured_image = sequence_reader.GetNextFrame();
|
||||
|
|
|
@ -6,45 +6,31 @@ else
|
|||
executable = '"../../x64/Release/FaceLandmarkVid.exe"';
|
||||
end
|
||||
|
||||
output = './demo_vid/';
|
||||
|
||||
if(~exist(output, 'file'))
|
||||
mkdir(output)
|
||||
end
|
||||
output = './demo_vids/';
|
||||
|
||||
in_files = dir('../../samples/*.wmv');
|
||||
in_files = cat(1, in_files, dir('../../samples/*.avi'));
|
||||
% some parameters
|
||||
verbose = true;
|
||||
|
||||
% Trained on in the wild and multi-pie data (less accurate SVR/CLM model)
|
||||
%model = 'model/main_clm_general.txt';
|
||||
% Trained on in-the-wild
|
||||
%model = 'model/main_clm_wild.txt';
|
||||
model = 'model/main_clnf_general.txt'; % Trained on in the wild and multi-pie data (a CLNF model)
|
||||
|
||||
% Trained on in the wild and multi-pie data (more accurate CLNF model)
|
||||
model = 'model/main_clnf_general.txt';
|
||||
% Trained on in-the-wild
|
||||
%model = 'model/main_clnf_wild.txt';
|
||||
% Uncomment the below models if you want to try them
|
||||
%model = 'model/main_clnf_wild.txt'; % Trained on in-the-wild data only
|
||||
|
||||
%model = 'model/main_clm_general.txt'; % Trained on in the wild and multi-pie data (less accurate SVR/CLM model)
|
||||
%model = 'model/main_clm_wild.txt'; % Trained on in-the-wild
|
||||
|
||||
% Create a command that will run the tracker on set of videos,
|
||||
% and visualize the output (-verbose)
|
||||
command = sprintf('%s -mloc "%s" -verbose', executable, model);
|
||||
|
||||
command = executable;
|
||||
command = cat(2, command, [' -mloc "', model, '"']);
|
||||
% add all videos to single argument list (so as not to load the model anew
|
||||
% for every video)
|
||||
for i=1:numel(in_files)
|
||||
|
||||
inputFile = ['../../samples/', in_files(i).name];
|
||||
[~, name, ~] = fileparts(inputFile);
|
||||
|
||||
command = cat(2, command, [' -f "' inputFile '" ']);
|
||||
|
||||
if(verbose)
|
||||
outputVideo = ['"' output name '.avi' '"'];
|
||||
command = cat(2, command, [' -ov ' outputVideo]);
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
% Call the executable
|
||||
if(isunix)
|
||||
unix(command);
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue