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

Function runTest

examples/cpp_example.cpp:169–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167}
168
169void runTest(SceneType scene_type_, // The type of the fitting problem
170 Dataset dataset_, // The dataset currently used for the evaluation
171 const double ransac_confidence_, // The confidence required in the results
172 const bool draw_results_, // A flag determining if the results should be drawn
173 const double drawing_threshold_) // The threshold used for selecting the inliers when they are drawn
174{
175 // Store the name of the current problem to be solved
176 const std::string dataset_name = dataset2str(dataset_);
177 std::string problem_name = "Homography";
178 if (scene_type_ == SceneType::FundamentalMatrixScene)
179 problem_name = "Fundamental matrix";
180 else if (scene_type_ == SceneType::EssentialMatrixScene)
181 problem_name = "Essential matrix";
182
183 // Test scenes for homography estimation
184 for (const auto& scene : getAvailableTestScenes(scene_type_, dataset_))
185 {
186 // Close all opened windows
187 cv::destroyAllWindows();
188
189 std::cout << "\n--------------------------------------------------------------\n" <<
190 problem_name << " estimation on scene " << scene << " from dataset " << dataset_name << ".\n" <<
191 "--------------------------------------------------------------\n";
192
193 // Run this if the task is homography estimation
194 if (scene_type_ == SceneType::HomographyScene)
195 {
196 // Apply the homography estimation method built into OpenCV
197 std::cout << "1. Running OpenCV's RANSAC with threshold " << drawing_threshold_ << " px";
198 opencvHomographyFitting(ransac_confidence_,
199 drawing_threshold_, // The maximum sigma value allowed in MAGSAC
200 scene, // The scene type
201 false, // A flag to draw and show the results
202 false); // A flag to apply the MAGSAC post-processing to the OpenCV's output
203
204 // Apply MAGSAC with maximum threshold set to a fairly high value
205 std::cout << "2. Running MAGSAC with fairly high maximum threshold (" << 50 << " px)";
206 testHomographyFitting(ransac_confidence_,
207 50.0, // The maximum sigma value allowed in MAGSAC
208 scene, // The scene type
209 false, // MAGSAC should be used
210 draw_results_, // A flag to draw and show the results
211 2.5); // The inlier threshold for visualization.
212
213 // Apply MAGSAC with maximum threshold set to a fairly high value
214 std::cout << "3. Running MAGSAC++ with fairly high maximum threshold (" << 50 << " px)";
215 testHomographyFitting(ransac_confidence_,
216 50.0, // The maximum sigma value allowed in MAGSAC
217 scene, // The scene type
218 true, // MAGSAC++ should be used
219 draw_results_, // A flag to draw and show the results
220 2.5); // The inlier threshold for visualization.
221 } else if (scene_type_ == SceneType::FundamentalMatrixScene)
222 {
223 // Apply the homography estimation method built into OpenCV
224 std::cout << "1. Running OpenCV's RANSAC with threshold " << drawing_threshold_ << " px";
225 opencvFundamentalMatrixFitting(ransac_confidence_,
226 drawing_threshold_, // The maximum sigma value allowed in MAGSAC

Callers 1

mainFunction · 0.85

Calls 8

dataset2strFunction · 0.85
getAvailableTestScenesFunction · 0.85
opencvHomographyFittingFunction · 0.85
testHomographyFittingFunction · 0.85

Tested by

no test coverage detected