s2p icon indicating copy to clipboard operation
s2p copied to clipboard

Refac matching binary ctypes

Open amiotc opened this issue 5 years ago • 3 comments

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.

amiotc avatar Mar 13 '19 12:03 amiotc

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 avatar Apr 08 '19 14:04 carlodef

@carlodef I have checked your modifications. Everything seems fine for me. Thank you for the bugfix.

amiotc avatar Apr 09 '19 07:04 amiotc

@amiotc Great, thank you! So now if @jmichel-otb and @dyoussef approve the pull request I think that we can merge.

carlodef avatar Apr 09 '19 09:04 carlodef