s2p
s2p copied to clipboard
Refac matching binary ctypes
This PR follows the same logic as PR #193. It modifies the keypoints_match
implementation in sift.py
module, while preserving its API.
SIFT keypoints are now read from the txt file generated at the previous step, and stored into numpy arrays. These arrays are passed to keypoints_match_from_nparray
, which calls the C++ code performing matches between two sets of SIFT keypoints.
The actual matching C code has been rewritten in the sift4ctypes.cpp
file. The former matching implementation was using multiple C structures, which would have implied to format all the numpy arrays into these structures, and extract the returned structure into a numpy array. Also, most of the information stored in these structures was useless for the matching algorithm. Hence, rewriting the functions so that they accept arrays instead of the defined structures seemed the best option.
The called library returns an array, which is transformed in a numpy array and written in a text file.
Thank you @amiotc. I've fixed a coordinates swap in the file sift4ctypes.cpp
and changed the datatype of a ctypes.POINTER
to ndpointer
in sift.py
. Could you check that everything's ok?
@carlodef I have checked your modifications. Everything seems fine for me. Thank you for the bugfix.
@amiotc Great, thank you! So now if @jmichel-otb and @dyoussef approve the pull request I think that we can merge.