Extension_image_recognition/LATCHExtractor.py

17 lines
402 B
Python
Executable File

import cv2
import LFUtilities
import LATCHParameters as params
detector = cv2.ORB_create(params.KEYPOINTS)
#descriptor = cv2.xfeatures2d.LATCH_create(1, True, 15)
descriptor = cv2.xfeatures2d.LATCH_create()
def extract(img_path):
img = LFUtilities.resize(params.IMG_SIZE, cv2.imread(img_path))
kp = detector.detect(img, None)
kp, des = descriptor.compute(img, kp)
return (kp, des)