knn-matting
knn-matting copied to clipboard
Change to approximate KNN with spatial coherence to match original better.
The original code uses an approximate nearest neighbour with two levels of spatial coherence. The approximation is gotten by limiting the number of comparisons in the NN search, outlined here http://www.vlfeat.org/matlab/vl_kdtreequery.html
Sklearn doesn't have the 'MAXNUMCOMPARISONS' parameter. The Annoy library does https://github.com/spotify/annoy. It seems like it would use less memory and be faster. Another possibility is this library, https://github.com/primetang/pyflann