MCPcopy Create free account
hub / github.com/danini/graph-cut-ransac / testEssentialMatrixFitting

Function testEssentialMatrixFitting

examples/cpp_example.cpp:1498–1683  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1496}
1497
1498void testEssentialMatrixFitting(
1499 const std::string& source_path_,
1500 const std::string& destination_path_,
1501 const std::string& source_intrinsics_path_,
1502 const std::string& destination_intrinsics_path_,
1503 const std::string& out_correspondence_path_,
1504 const std::string& in_correspondence_path_,
1505 const std::string& output_match_image_path_,
1506 const double confidence_,
1507 const double inlier_outlier_threshold_,
1508 const double spatial_coherence_weight_,
1509 const size_t cell_number_in_neighborhood_graph_,
1510 const int fps_,
1511 const double minimum_inlier_ratio_for_sprt_) // An assumption about the minimum inlier ratio used for the SPRT test
1512{
1513 // Read the images
1514 cv::Mat source_image = cv::imread(source_path_);
1515 cv::Mat destination_image = cv::imread(destination_path_);
1516
1517 if (source_image.empty()) // Check if the source image is loaded successfully
1518 {
1519 printf("An error occured while loading image '%s'\n",
1520 source_path_.c_str());
1521 return;
1522 }
1523
1524 if (destination_image.empty()) // Check if the destination image is loaded successfully
1525 {
1526 printf("An error occured while loading image '%s'\n",
1527 destination_path_.c_str());
1528 return;
1529 }
1530
1531 // Detect or load point correspondences using AKAZE
1532 cv::Mat points;
1533 utils::detectFeatures(
1534 in_correspondence_path_, // The path where the correspondences are read from or saved to.
1535 source_image, // The source image
1536 destination_image, // The destination image
1537 points); // The detected point correspondences. Each row is of format "x1 y1 x2 y2"
1538
1539 // Load the intrinsic camera matrices
1540 Eigen::Matrix3d intrinsics_src,
1541 intrinsics_dst;
1542
1543 if (!utils::loadMatrix<double, 3, 3>(source_intrinsics_path_,
1544 intrinsics_src))
1545 {
1546 printf("An error occured when loading the intrinsics camera matrix from '%s'\n",
1547 source_intrinsics_path_.c_str());
1548 return;
1549 }
1550
1551 if (!utils::loadMatrix<double, 3, 3>(destination_intrinsics_path_,
1552 intrinsics_dst))
1553 {
1554 printf("An error occured when loading the intrinsics camera matrix from '%s'\n",
1555 destination_intrinsics_path_.c_str());

Callers 1

mainFunction · 0.85

Calls 9

detectFeaturesFunction · 0.85
normalizeCorrespondencesFunction · 0.85
drawMatchesFunction · 0.85
savePointsToFileFunction · 0.85
showImageFunction · 0.85
setFPSMethod · 0.80
isInitializedMethod · 0.45
sampleSizeMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected