Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

opencv's api is changing rapidly, and that tutorial might need an update.

you already have found c2.xfeatures2d.SURF_create(), and it's similar with ORB,MSER,AKAZE, or GFTTDetector, there is a _create() method for all of them, which gives you an instance:

>>> orb = cv2.ORB_create()
>>> help(orb)
...
 |  Methods inherited from Feature2D:
 |
 |  compute(...)
 |      compute(image, keypoints[, descriptors]) -> keypoints, descriptors
 |
 |  defaultNorm(...)
 |      defaultNorm() -> retval
 |
 |  descriptorSize(...)
 |      descriptorSize() -> retval
 |
 |  descriptorType(...)
 |      descriptorType() -> retval
 |
 |  detect(...)
 |      detect(image[, mask]) -> keypoints
 |
 |  detectAndCompute(...)
 |      detectAndCompute(image, mask[, descriptors[, useProvidedKeypoints]]) -> keypoints, descriptors
 |
 |  empty(...)
 |      empty() -> retval
...

or SIFT:

>>> img = cv2.imread('simple.jpg',0)
>>> sift = cv2.xfeatures2d.SIFT_create()
>>> sift.detect(img)

opencv's api is changing rapidly, and that tutorial might need an update.

you already have found c2.xfeatures2d.SURF_create()cv2.xfeatures2d.SURF_create(), and it's similar with ORB,MSER,AKAZE, or GFTTDetector, there is a _create() method for all of them, which gives you an instance:

>>> orb = cv2.ORB_create()
>>> help(orb)
...
 |  Methods inherited from Feature2D:
 |
 |  compute(...)
 |      compute(image, keypoints[, descriptors]) -> keypoints, descriptors
 |
 |  defaultNorm(...)
 |      defaultNorm() -> retval
 |
 |  descriptorSize(...)
 |      descriptorSize() -> retval
 |
 |  descriptorType(...)
 |      descriptorType() -> retval
 |
 |  detect(...)
 |      detect(image[, mask]) -> keypoints
 |
 |  detectAndCompute(...)
 |      detectAndCompute(image, mask[, descriptors[, useProvidedKeypoints]]) -> keypoints, descriptors
 |
 |  empty(...)
 |      empty() -> retval
...

or SIFT:

>>> img = cv2.imread('simple.jpg',0)
>>> sift = cv2.xfeatures2d.SIFT_create()
>>> sift.detect(img)