Fixes with -inroot and -outroot

This commit is contained in:
Tadas Baltrusaitis 2016-07-31 20:55:29 -04:00
parent 51ae195124
commit 3fc388cdeb
5 changed files with 56 additions and 16 deletions

View file

@ -65,6 +65,7 @@ script:
- cmake -D CMAKE_BUILD_TYPE=RELEASE .. - cmake -D CMAKE_BUILD_TYPE=RELEASE ..
- make -j2 - make -j2
- ../build/bin/FaceLandmarkImg -fdir "../videos/" -ofdir "./demo_img/" -oidir "./demo_img/" -wild -q - ../build/bin/FaceLandmarkImg -fdir "../videos/" -ofdir "./demo_img/" -oidir "./demo_img/" -wild -q
- ../build/bin/FaceLandmarkVidMulti -f ../videos/multi_face.avi -ov multi_face.avi -q - ../build/bin/FaceLandmarkImg -inroot ../videos -f obama.jpg -outroot data -of obama.txt -op obama.3d -oi obama.jpg -multi_view 1 -wild -q
- ../build/bin/FeatureExtraction -f "../videos/1815_01_008_tony_blair.avi" -ov blair.avi -of "output_features/1815_01_008_tony_blair.txt" -simalign output_features/aligned -ov feat_test.avi -hogalign hog_test.dat -q - ../build/bin/FaceLandmarkVidMulti -inroot ../videos -f multi_face.avi -outroot output -ov multi_face.avi -q
- ../build/bin/FaceLandmarkVid -f "../videos/1815_01_008_tony_blair.avi" -f "../videos/0188_03_021_al_pacino.avi" -f "../videos/0217_03_006_alanis_morissette.avi" -f "../videos/0244_03_004_anderson_cooper.avi" -q - ../build/bin/FeatureExtraction -f "../videos/1815_01_008_tony_blair.avi" -outroot output_features -ov blair.avi -of "1815_01_008_tony_blair.txt" -simalign aligned -ov feat_test.avi -hogalign hog_test.dat -q
- ../build/bin/FaceLandmarkVid -inroot ../videos -f 1815_01_008_tony_blair.avi -f 0188_03_021_al_pacino.avi -f 0217_03_006_alanis_morissette.avi -outroot output_data -ov 1.avi -ov 2.avi -ov 3.avi -q

View file

@ -22,6 +22,7 @@ test_script:
- cmd: if exist Release (cd Release) - cmd: if exist Release (cd Release)
- cmd: dir - cmd: dir
- cmd: if exist "../videos" (FaceLandmarkImg.exe -fdir "../videos/" -ofdir "./demo_img/" -oidir "./demo_img/" -wild -q) else (FaceLandmarkImg.exe -fdir "../../videos/" -ofdir "./demo_img/" -oidir "./demo_img/" -wild -q) - cmd: if exist "../videos" (FaceLandmarkImg.exe -fdir "../videos/" -ofdir "./demo_img/" -oidir "./demo_img/" -wild -q) else (FaceLandmarkImg.exe -fdir "../../videos/" -ofdir "./demo_img/" -oidir "./demo_img/" -wild -q)
- cmd: if exist "../videos" (FaceLandmarkVidMulti.exe -f ../videos/multi_face.avi -ov multi_face.avi -q) else (FaceLandmarkVidMulti.exe -f ../../videos/multi_face.avi -ov multi_face.avi -q) - cmd: if exist "../videos" (FaceLandmarkImg.exe -inroot ../videos -f obama.jpg -outroot out_data -of obama.pts -op obama.3d -oi obama.jpg -q) else (FaceLandmarkImg.exe -inroot ../../videos -f obama.jpg -outroot out_data -of obama.pts -op obama.3d -oi obama.jpg -q)
- cmd: if exist "../videos" (FeatureExtraction.exe -f "../videos/1815_01_008_tony_blair.avi" -of "output_features/1815_01_008_tony_blair.txt" -simalign output_features/aligned -ov feat_track.avi -hogalign hog_test.dat -q) else (FeatureExtraction.exe -f "../../videos/1815_01_008_tony_blair.avi" -of "output_features/1815_01_008_tony_blair.txt" -simalign output_features/aligned -ov feat_track.avi -hogalign hog_test.dat -q) - cmd: if exist "../videos" (FaceLandmarkVidMulti.exe -inroot ../videos -f multi_face.avi -ov multi_face.avi -q) else (FaceLandmarkVidMulti.exe -inroot ../../videos -f videos/multi_face.avi -ov multi_face.avi -q)
- cmd: if exist "../videos" (FeatureExtraction.exe -f "../videos/1815_01_008_tony_blair.avi" -outroot output_features -of "1815_01_008_tony_blair.txt" -simalign aligned -ov feat_track.avi -hogalign hog_test.dat -q) else (FeatureExtraction.exe -f "../../videos/1815_01_008_tony_blair.avi" -outroot output_features -of "1815_01_008_tony_blair.txt" -simalign aligned -ov feat_track.avi -hogalign hog_test.dat -q)
- cmd: if exist "../videos" (FaceLandmarkVid.exe -f "../videos/1815_01_008_tony_blair.avi" -ov track.avi -q) else (FaceLandmarkVid.exe -f "../../videos/1815_01_008_tony_blair.avi" -ov track.avi -q) - cmd: if exist "../videos" (FaceLandmarkVid.exe -f "../videos/1815_01_008_tony_blair.avi" -ov track.avi -q) else (FaceLandmarkVid.exe -f "../../videos/1815_01_008_tony_blair.avi" -ov track.avi -q)

View file

@ -402,6 +402,12 @@ int main (int argc, char **argv)
// Loading image // Loading image
cv::Mat read_image = cv::imread(file, -1); cv::Mat read_image = cv::imread(file, -1);
if (read_image.empty())
{
cout << "Could not read the input image" << endl;
return 1;
}
// Loading depth file if exists (optional) // Loading depth file if exists (optional)
cv::Mat_<float> depth_image; cv::Mat_<float> depth_image;

View file

@ -1039,17 +1039,19 @@ void get_output_feature_params(vector<string> &output_similarity_aligned, vector
// By default the model is dynamic // By default the model is dynamic
dynamic = true; dynamic = true;
string separator = string(1, boost::filesystem::path::preferred_separator);
// First check if there is a root argument (so that videos and outputs could be defined more easilly) // First check if there is a root argument (so that videos and outputs could be defined more easilly)
for (size_t i = 0; i < arguments.size(); ++i) for (size_t i = 0; i < arguments.size(); ++i)
{ {
if (arguments[i].compare("-root") == 0) if (arguments[i].compare("-root") == 0)
{ {
output_root = arguments[i + 1]; output_root = arguments[i + 1] + separator;
i++; i++;
} }
if (arguments[i].compare("-outroot") == 0) if (arguments[i].compare("-outroot") == 0)
{ {
output_root = arguments[i + 1]; output_root = arguments[i + 1] + separator;
i++; i++;
} }
} }

View file

@ -131,23 +131,27 @@ void get_video_input_output_params(vector<string> &input_video_files, vector<str
string input_root = ""; string input_root = "";
string output_root = ""; string output_root = "";
string separator = string(1, boost::filesystem::path::preferred_separator);
// First check if there is a root argument (so that videos and outputs could be defined more easilly) // First check if there is a root argument (so that videos and outputs could be defined more easilly)
for(size_t i = 0; i < arguments.size(); ++i) for(size_t i = 0; i < arguments.size(); ++i)
{ {
if (arguments[i].compare("-root") == 0) if (arguments[i].compare("-root") == 0)
{ {
input_root = arguments[i + 1]; input_root = arguments[i + 1] + separator;
output_root = arguments[i + 1]; output_root = arguments[i + 1] + separator;
// Add the / or \ to the directory
i++; i++;
} }
if (arguments[i].compare("-inroot") == 0) if (arguments[i].compare("-inroot") == 0)
{ {
input_root = arguments[i + 1]; input_root = arguments[i + 1] + separator;
i++; i++;
} }
if (arguments[i].compare("-outroot") == 0) if (arguments[i].compare("-outroot") == 0)
{ {
output_root = arguments[i + 1]; output_root = arguments[i + 1] + separator;
i++; i++;
} }
} }
@ -265,19 +269,45 @@ void get_image_input_output_params(vector<string> &input_image_files, vector<str
string out_pts_dir, out_pose_dir, out_img_dir; string out_pts_dir, out_pose_dir, out_img_dir;
string input_root = "";
string output_root = "";
string separator = string(1, boost::filesystem::path::preferred_separator);
// First check if there is a root argument (so that videos and outputs could be defined more easilly)
for (size_t i = 0; i < arguments.size(); ++i)
{
if (arguments[i].compare("-root") == 0)
{
input_root = arguments[i + 1] + separator;
output_root = arguments[i + 1] + separator;
i++;
}
if (arguments[i].compare("-inroot") == 0)
{
input_root = arguments[i + 1] + separator;
i++;
}
if (arguments[i].compare("-outroot") == 0)
{
output_root = arguments[i + 1] + separator;
i++;
}
}
for(size_t i = 0; i < arguments.size(); ++i) for(size_t i = 0; i < arguments.size(); ++i)
{ {
valid[i] = true; valid[i] = true;
if (arguments[i].compare("-f") == 0) if (arguments[i].compare("-f") == 0)
{ {
input_image_files.push_back(arguments[i + 1]); input_image_files.push_back(input_root + arguments[i + 1]);
valid[i] = false; valid[i] = false;
valid[i+1] = false; valid[i+1] = false;
i++; i++;
} }
else if (arguments[i].compare("-fd") == 0) else if (arguments[i].compare("-fd") == 0)
{ {
input_depth_files.push_back(arguments[i + 1]); input_depth_files.push_back(input_root + arguments[i + 1]);
valid[i] = false; valid[i] = false;
valid[i+1] = false; valid[i+1] = false;
i++; i++;
@ -367,21 +397,21 @@ void get_image_input_output_params(vector<string> &input_image_files, vector<str
} }
else if (arguments[i].compare("-op") == 0) else if (arguments[i].compare("-op") == 0)
{ {
output_pose_files.push_back(arguments[i + 1]); output_pose_files.push_back(output_root + arguments[i + 1]);
valid[i] = false; valid[i] = false;
valid[i + 1] = false; valid[i + 1] = false;
i++; i++;
} }
else if (arguments[i].compare("-of") == 0) else if (arguments[i].compare("-of") == 0)
{ {
output_feature_files.push_back(arguments[i + 1]); output_feature_files.push_back(output_root + arguments[i + 1]);
valid[i] = false; valid[i] = false;
valid[i+1] = false; valid[i+1] = false;
i++; i++;
} }
else if (arguments[i].compare("-oi") == 0) else if (arguments[i].compare("-oi") == 0)
{ {
output_image_files.push_back(arguments[i + 1]); output_image_files.push_back(output_root + arguments[i + 1]);
valid[i] = false; valid[i] = false;
valid[i+1] = false; valid[i+1] = false;
i++; i++;