def ORB(arr, show=False, save=False): # arr = cv2.imread('/Users/ruhansa/Dropbox/xray/data/simple.jpg', 0) orb = cv2.ORB() kp, des = orb.detectAndCompute(arr, None) from src.utils.io import add_points img = Image.fromarray(arr.astype(np.uint8)) draw_keypoints(kp, img) img.show()
def sift_descriptor(arr, show=False, save=False, fn=None): sift = cv2.SIFT() kp, descr = sift.detectAndCompute(arr, None) if show is True: img = Image.fromarray(arr.astype(np.uint8)) img = draw_keypoints(kp, img) img.show() if save is True: if fn is None: return img = Image.fromarray(arr.astype(np.uint8)) img = draw_keypoints(kp, img) img.save(fn) return kp, descr