11

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.

AMC
  • 2,642
  • 7
  • 13
  • 35
shraddha agrawal
  • 145
  • 1
  • 2
  • 8
  • Please read this ["What should I do when someone answers my question?"](http://stackoverflow.com/help/someone-answers). – thewaywewere Jun 03 '17 at 06:25

7 Answers7

15

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

bradden_gross
  • 668
  • 8
  • 24
10

Anaconda supports pip install to install package into conda environment. You can download OpenCV 3.2.0 with opencv_contrib from this well known Unofficial Windows Binaries for Python Extension Packages website. See the filename below for the right version. Then type the command in Anaconda Prompt window to install the package:

For Python 3.5 and 64-bit Windows:

pip install opencv_python‑3.2.0+contrib‑cp35‑cp35m‑win_amd64.whl

For Python 3.6 and 64-bit Windows:

pip install opencv_python‑3.2.0+contrib‑cp36‑cp36m‑win_amd64.whl

Most of the OpenCV 3.2.0 packages in Anaconda repository didn't specific if they come with opencv_contrib. The pip install approach is easier and proven, see one of the SO post. The only drawback is that conda list will not show pip installed package there but actually it's.

However, if you want to have trial on conda install, below is the command for installing OpenCV 3.2.0 for Python 3.5 or 3.6 but likely without opencv_contrib.

conda install -c conda-forge opencv=3.2.0 

Hope this help.

thewaywewere
  • 8,128
  • 11
  • 41
  • 46
6

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!

Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
shawon13
  • 91
  • 9
  • 1
    Please add the relevant details from your link to your post. If the link changes, your post will not help anyone. – dckuehn Apr 25 '17 at 21:11
1

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.

devShaurya
  • 180
  • 1
  • 6
1

Method 1: in Anaconda Prompt write this, will install opencv-contrib v4.6

pip install opencv-contrib-python

Method 2: Install previous version of opencv-contrib v3.3.1

According to https://anaconda.org/michael_wild/opencv-contrib it says it support win64bit only and python 3.6.x.

So, first you need to create new enviroment support python 3.6

conda create --opencv_contrib36 python=3.6.13

then, install the packages

conda install -c michael_wild opencv-contrib
0

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).

apatsekin
  • 1,524
  • 10
  • 12
-3

This worked for me in Windows 10 on Anaconda 5.3 with python 3.6

conda install -c conda-forge opencv
Nusrath
  • 499
  • 1
  • 4
  • 16