简体   繁体   中英

feature descriptor for a given 2d point in an image

Trying to get a descriptor for a predefined point using python opencv3. The goal is to provide a set of points for a given image and get their corresponding feature descriptors. I'm open to using SIFT, SURF, Brief, ORB, and basically any descriptor. However, I do not want to use any of the detection methods provided. I have created the following:

feat_object = cv2.xfeatures2d.BriefDescriptorExtractor_create()

# define keypoint for a single 2d point
pt = cv2.KeyPoint(point[0,0],point[1,0], 10)

# create feature descriptor
out = feat_object.compute(frame, pt)

However, I get the following error.

----> out = feat_object.compute(frame, pt)

SystemError: error return without exception set

Any suggestions?

Ok, resolving the matter ended up being simple. The correct code snippet looks like the following:

feat_object = cv2.xfeatures2d.BriefDescriptorExtractor_create()

define keypoint for a single 2d point

pt = [cv2.KeyPoint(point[0,0],point[1,0], 10)]

create feature descriptor

out = feat_object.compute(frame, pt)

with frame defined as a grayscale image and pt being a list of keypoints. So even if you only want to process a single keypoint, you still are required to pass it in as a list.

I've only tested this out in opencv2.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM