Closed cslayers closed 6 years ago
Thanks for the find. This is actually a very old and sloppy part of the code. I think I will rewrite it in the next version.
A much better algorithm would be to get a list of random row indices using Knuth shuffles, then copy those rows into the output.
However, mathematically speaking, the existing implementation does indeed return a uniformly random subset of the rows. It does not, however, permute those rows in a random way--the order of the remaining row indices is strictly increasing.
I never bothered to improve this before, since this function is only used in the RANSAC procedure, which so far hasn't been contributing much to the overall execution time.
Refactored in version 1.4.5
I am curious about the function rand_rows ,when it selecting enough number of random rows of groups of matching points to calculate an affine matrix by the function solve_system. Why it remove most of rows instead of picking serveral rows? Looking forward to your reply. Thanks you!