| 394 | } |
| 395 | |
| 396 | bool initializeSceneRigidPose( |
| 397 | const std::string& scene_name_, |
| 398 | std::string& ground_truth_pose_path_, |
| 399 | std::string& points_path_, |
| 400 | std::string& inlier_image_points_path_, |
| 401 | const std::string root_directory_) |
| 402 | { |
| 403 | // The directory to which the results will be saved |
| 404 | std::string results_dir = root_directory_ + "results"; |
| 405 | |
| 406 | // Create the task directory if it doesn't exist |
| 407 | if (stat(results_dir.c_str(), &info) != 0) // Check if exists |
| 408 | { |
| 409 | #ifdef _WIN32 // Create a directory on Windows |
| 410 | if (_mkdir(results_dir.c_str()) != 0) // Create it, if not |
| 411 | { |
| 412 | fprintf(stderr, "Error while creating folder 'results'\n"); |
| 413 | return false; |
| 414 | } |
| 415 | #else // Create a directory on Linux |
| 416 | if (mkdir(results_dir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) == -1) |
| 417 | { |
| 418 | fprintf(stderr, "Error while creating a new folder in 'results'\n"); |
| 419 | return false; |
| 420 | } |
| 421 | #endif |
| 422 | } |
| 423 | |
| 424 | // The directory to which the results will be saved |
| 425 | std::string dir = root_directory_ + "results/" + scene_name_; |
| 426 | |
| 427 | // Create the task directory if it doesn't exist |
| 428 | if (stat(dir.c_str(), &info) != 0) // Check if exists |
| 429 | { |
| 430 | #ifdef _WIN32 // Create a directory on Windows |
| 431 | if (_mkdir(dir.c_str()) != 0) // Create it, if not |
| 432 | { |
| 433 | fprintf(stderr, "Error while creating a new folder in 'results'\n"); |
| 434 | return false; |
| 435 | } |
| 436 | #else // Create a directory on Linux |
| 437 | if (mkdir(dir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) == -1) |
| 438 | { |
| 439 | fprintf(stderr, "Error while creating a new folder in 'results'\n"); |
| 440 | return false; |
| 441 | } |
| 442 | #endif |
| 443 | } |
| 444 | |
| 445 | // The path where the ground truth pose can be found |
| 446 | ground_truth_pose_path_ = |
| 447 | root_directory_ + "data/" + scene_name_ + "/" + scene_name_ + "_gt.txt"; |
| 448 | // The path where the 3D point cloud can be found |
| 449 | points_path_ = |
| 450 | root_directory_ + "data/" + scene_name_ + "/" + scene_name_ + "_points.txt"; |
| 451 | // The path where the inliers of the estimated fundamental matrices will be saved |
| 452 | inlier_image_points_path_ = |
| 453 | root_directory_ + "results/" + scene_name_ + "/result_" + scene_name_ + ".txt"; |