MCPcopy Create free account
hub / github.com/danini/magsac / main

Function main

examples/cpp_example.cpp:108–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106std::string dataset2str(Dataset dataset_);
107
108int main(int argc, char** argv)
109{
110 // Parsing the flags
111 gflags::ParseCommandLineFlags(&argc, &argv, true);
112
113 printf("If you want to see the details of the fitting, e.g., time or estimation quality, turn on logging by starting the application as './SampleProject'\n");
114 printf("Accepted flags:");
115 printf("\n\t--problem-type {0,1,2} - The example problem which should run. Values: (0) Homography estimation, (1) Fundamental matrix estimation, (2) Essential matrix estimation. Default: 0");
116 printf("\n\t--draw-results {0,1} - A flag determining if the results should be drawn and visualized. Default: 1");
117 fflush(stdout);
118
119 /*
120 This is an example showing how MAGSAC or MAGSAC++ is applied to homography or fundamental matrix estimation tasks.
121 This implementation is not the one used in the experiments of the paper.
122 If you use this method, please cite:
123 (1) Barath, Daniel, Jana Noskova, and Jiri Matas. "MAGSAC: marginalizing sample consensus.", Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. 2019.
124 (2) Barath, Daniel, Jana Noskova, Maksym Ivashechkin, and Jiri Matas. "MAGSAC++, a fast, reliable and accurate robust estimator", Arxiv preprint:1912.05909. 2019.
125 */
126 const double ransac_confidence = 0.99; // The required confidence in the results
127 // The inlier threshold for visualization. This threshold is not used by the algorithm,
128 // it is simply for selecting the inliers to be drawn after MAGSAC finished.
129 const double drawing_threshold_essential_matrix = 3.00;
130 const double drawing_threshold_fundamental_matrix = 1.00;
131 const double drawing_threshold_homography = 1.00;
132
133 switch (FLAGS_problem_type)
134 {
135 case 0:
136 std::cout << "Running homography estimation examples.";
137
138 // Run homography estimation on the EVD dataset
139 runTest(SceneType::HomographyScene, Dataset::extremeview, ransac_confidence, FLAGS_draw_results, drawing_threshold_homography);
140
141 // Run homography estimation on the homogr dataset
142 runTest(SceneType::HomographyScene, Dataset::homogr, ransac_confidence, FLAGS_draw_results, drawing_threshold_homography);
143 break;
144 case 1:
145 std::cout << "Running fundamental matrix estimation examples.";
146
147 // Run fundamental matrix estimation on the kusvod2 dataset
148 runTest(SceneType::FundamentalMatrixScene, Dataset::kusvod2, ransac_confidence, FLAGS_draw_results, drawing_threshold_fundamental_matrix);
149
150 // Run fundamental matrix estimation on the AdelaideRMF dataset
151 runTest(SceneType::FundamentalMatrixScene, Dataset::adelaidermf, ransac_confidence, FLAGS_draw_results, drawing_threshold_fundamental_matrix);
152
153 // Run fundamental matrix estimation on the Multi-H dataset
154 runTest(SceneType::FundamentalMatrixScene, Dataset::multih, ransac_confidence, FLAGS_draw_results, drawing_threshold_fundamental_matrix);
155 break;
156 case 2:
157 std::cout << "Running essential matrix estimation examples.";
158
159 // Run essential matrix estimation on a scene from the strecha dataset
160 runTest(SceneType::EssentialMatrixScene, Dataset::strecha, ransac_confidence, FLAGS_draw_results, drawing_threshold_essential_matrix);
161 break;
162 default:
163 std::cerr << "Problem type " << FLAGS_problem_type << " is unknown. Valid values are 0,1,2.";
164 break;
165 }

Callers

nothing calls this directly

Calls 1

runTestFunction · 0.85

Tested by

no test coverage detected