DinoDee
DinoDee

Reputation: 3

How to build OpenCV 3.0.0 for Python with non-free modules?

I know this isn't a pure programming question, but I'd like to have a response like https://stackoverflow.com/a/18590112 .

I'd like to know how to build the OpenCV 3.0.0-beta library to use it with Python, with SIFT and SURF functions like seen in the OpenCV documentation, which are a non-free part of the lib, on a Debian Linux operating system, via the command line.

Thanks in advance, and I hope this topic will help in the future all the persons who Googled desperately to find a good tutorial to build this library.

Upvotes: 0

Views: 3707

Answers (1)

berak
berak

Reputation: 39816

with opencv3.0, sift and surf have been moved to a opencv_contrib repo, also, you will need to build the whole thing from src. so:

  1. fork/clone/download that. take your time with the readme there.
  2. add it to your cmake settings in the main opencv repo: cmake -DOPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules <opencv_source_directory>

  3. (re-)build: cmake, make, make-install.

  4. if all went well, you can try it:


>>> import cv2
>>> help(cv2.xfeatures2d)   # additional namespace !
Help on module cv2.xfeatures2d in cv2:

NAME
    cv2.xfeatures2d

FILE
    (built-in)

FUNCTIONS
    SIFT_create(...)
        SIFT_create([, nfeatures[, nOctaveLayers[, contrastThreshold[, edgeThreshold[, sigma]]]]]) -> retval

    SURF_create(...)
        SURF_create([, hessianThreshold[, nOctaves[, nOctaveLayers[, extended[,upright]]]]]) -> retval


>>> sift = cv2.xfeatures2d.SIFT_create()
>>> sift.detect(...)

Upvotes: 1

Related Questions