0

I want to change the following two commands which are written in opencv 2.3 .

fea_det=cv2.FeatureDetector_create("SIFT")
des_ext=cv2.DescriptorExtractor_create("SIFT")

In opencv 3, I know that there is a command which create SIFT, so

fea_det=cv2.xfeatures2d.SIFT_create()

But what should I use for des_ext ? I am asking that what is the equivalent code of "cv2.DescriptorExtractor_create("SIFT")" in opencv 3?

1
  • 1
    First google search. SO is not a how to search this on search engine website! Commented Aug 8, 2017 at 20:02

1 Answer 1

8

FeatureDetector_create and DescriptorExtractor_create since OpenCV 3 were moved to xfeatures2d subdirectory.

>>> sift = cv2.xfeatures2d.SIFT_create()
>>> (kps, descs) = sift.detectAndCompute(gray, None)
>>> print("# kps: {}, descriptors: {}".format(len(kps), descs.shape))
# kps: 274, descriptors: (274, 128)

Take a look for more information at this article.

Sign up to request clarification or add additional context in comments.

1 Comment

If answer was useful for you, please mark it as correct

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.