Does anyone have any examples of using OpenCV with python for descriptor extraction?

后端 未结 4 1267
夕颜
夕颜 2021-02-04 05:22

I\'m trying to use OpenCV to extract SURF descriptors from an image. I\'m using OpenCV 2.4 and Python 2.7, but am struggling to find any documentation that provides any informat

4条回答
  •  梦谈多话
    2021-02-04 06:09

    Here's an example of some code I've written for extracting SURF features using Python 2.7 and OpenCV 2.4.

    im2 = cv2.imread(imgPath)
    im = cv2.cvtColor(im2, cv2.COLOR_BGR2GRAY)
    surfDetector = cv2.FeatureDetector_create("SURF")
    surfDescriptorExtractor = cv2.DescriptorExtractor_create("SURF")
    keypoints = surfDetector.detect(im)
    (keypoints, descriptors) = surfDescriptorExtractor.compute(im,keypoints)
    

    This works and returns a set of descriptors. Unfortunately since cv2.SURF() doesn't work in 2.4, you have to go through this tedious process.

提交回复
热议问题