MarcoForte / knn-matting

Python implementation of KNN Matting, CVPR 2012 / TPAMI 2013 http://dingzeyu.li/projects/knn/
MIT License
128 stars 29 forks source link

Change to approximate KNN with spatial coherence to match original better. #1

Open MarcoForte opened 7 years ago

MarcoForte commented 7 years ago

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