MISS3D / s2p

This repository is not maintained, please use https://github.com/centreborelli/s2p instead.
GNU Affero General Public License v3.0
144 stars 77 forks source link

[refactor] Replace sift_roi binary by shared library and ctypes #193

Closed jmichel-otb closed 5 years ago

jmichel-otb commented 5 years ago

This PR modifies the image_keypoints implementation in sift.py module, while preserving its API (to the exception of the extra_params option which had to be removed).

It now reads the roi with rasterio into a numpy array, pass it to the keypoints_from_nparray, which will call the actual C++ sift code with ctypes and return the sift points and descriptors in another numpy array. This array is then written to the txt file using numpy io.

I had to fix a bunch of bugs in the sift test itself. I also autopep8 the sift.py file which explains minor diff outside of methods cited above.

the libsift4ctypes.so shared library is installed in s2p/lib. Relative path is hardcoded in sift.py, which allow the whole thing to work without updating LD_LIBRARY_PATH. However a cleaner solution would be to manage the LD_LIBRARY_PATH in a config script (out of the scope of this PR).