'how to get opencv_contrib module in anaconda

Can anyone tell me commands to get contrib module for anaconda

I need that module for matches = flann.knnMatch(des1,des2,k=2) to run correctly

error thrown is cv2.error: ......\modules\python\src2\cv2.cpp:163: error: (-215) The data should normally be NULL! in function NumpyAllocator::allocate

Also I am using Anaconda openCV version 3, and strictly dont want to switch to lower versions P.S. as suggested at many places to edit file cv2.cpp option is not available with anaconda.



Solution 1:[1]

I would recommend installing pip in your anaconda environment then just doing: pip install opencv-contrib-python. This comes will opencv and opencv-contrib.

Solution 2:[2]

You can try this: https://anaconda.org/michael_wild/opencv-contrib

To install this package with conda run:

conda install -c michael_wild opencv-contrib 

These anaconda packages include the contrib modules with base OpenCV3. Though the file list says it's currently for Windows only!

Solution 3:[3]

The question is old but I thought to update the answer with the latest information. My Anaconda version is 2019.10 and build channel is py_37_0 . I used pip install opencv-python==3.4.2.17 and pip install opencv-contrib-python==3.4.2.17. Now they are also visible as installed packages in Anaconda navigator and I am able to use patented methods like SIFT etc.

Solution 4:[4]

There is repo in conda-forge which includes opencv-contrib: https://github.com/conda-forge/opencv-feedstock

To use it:

conda install --channel=conda-forge libopencv opencv py-opencv

if you run into Numpy error, try pinning more recent version (of Numpy).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 bradden_gross
Solution 2 Gino Mempin
Solution 3 devShaurya
Solution 4 apatsekin