Skip to content

Cannot use sift and other nonfree modules #132

Closed
@simbaforrest

Description

@simbaforrest

Expected behaviour

I was using opencv-contrib-python. I was hoping I can use:

sift = cv2.xfeatures2d_SURF.create()
kp = sift.detect(gray, None)

Actual behaviour

But when I run sift, there is the following error:

cv2.error: OpenCV(3.4.3) C:\projects\opencv-python\opencv_contrib\modules\xfeatures2d\src\surf.cpp:1016: error: (-213:The function/feature is not implemented) This algorithm is patented and is excluded in this configuration; Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library in function 'cv::xfeatures2d::SURF::create'

Steps to reproduce

  • example code
import numpy as np
import cv2

gray = np.zeros((480,640), np.uint8)

sift = cv2.xfeatures2d_SURF.create()
kp = sift.detect(gray, None)

img = cv2.drawKeypoints(gray, kp)

cv2.imwrite('sift.jpg', img)
  • operating system: Win 10
  • architecture: x64
  • opencv-python version: 3.4.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions