Commit 0ac742dd authored by patrikhuber's avatar patrikhuber

Added try/catch to landmark and model loading

Also removed a few trailing whitespaces
parent 9ea01877
...@@ -147,8 +147,22 @@ int main(int argc, char *argv[]) ...@@ -147,8 +147,22 @@ int main(int argc, char *argv[])
// Load the image, landmarks, LandmarkMapper and the Morphable Model: // Load the image, landmarks, LandmarkMapper and the Morphable Model:
Mat image = cv::imread(imagefile.string()); Mat image = cv::imread(imagefile.string());
auto landmarks = read_pts_landmarks(landmarksfile.string()); LandmarkCollection<cv::Vec2f> landmarks;
morphablemodel::MorphableModel morphable_model = morphablemodel::load_model(modelfile.string()); try {
landmarks = read_pts_landmarks(landmarksfile.string());
}
catch (const std::runtime_error& e) {
cout << "Error reading the landmarks: " << e.what() << endl;
return EXIT_FAILURE;
}
morphablemodel::MorphableModel morphable_model;
try {
morphable_model = morphablemodel::load_model(modelfile.string());
}
catch (const std::runtime_error& e) {
cout << "Error loading the Morphable Model: " << e.what() << endl;
return EXIT_FAILURE;
}
core::LandmarkMapper landmark_mapper = mappingsfile.empty() ? core::LandmarkMapper() : core::LandmarkMapper(mappingsfile); core::LandmarkMapper landmark_mapper = mappingsfile.empty() ? core::LandmarkMapper() : core::LandmarkMapper(mappingsfile);
// Draw the loaded landmarks: // Draw the loaded landmarks:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment