Skip to content

Commit 00b2c81

Browse files
committed
Adds a few additional checks to ransac before it gets run.
1 parent 11e6a56 commit 00b2c81

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

include/albatross/src/models/ransac.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ RansacOutput ransac(const RansacFunctions<FitType> &ransac_functions,
147147
output.return_code = RANSAC_RETURN_CODE_FAILURE;
148148

149149
if (min_consensus_size >= groups.size() ||
150-
random_sample_size >= groups.size() || max_iterations <= 0) {
150+
min_consensus_size < random_sample_size ||
151+
random_sample_size >= groups.size() || random_sample_size <= 0 ||
152+
max_iterations <= 0 || max_failed_candidates < 0) {
151153
output.return_code = RANSAC_RETURN_CODE_INVALID_ARGUMENTS;
152154
return output;
153155
}

0 commit comments

Comments
 (0)