pythonpython-3.6importerroropencv-contrib

ximgproc (opencv-contrib sub-module) installed successfully but i am getting AttributeError


I installed opencv-contrib that has ximgproc as a sub-module, using this:

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

when I run below lines:

import cv2

# ...

right_matcher = cv2.ximgproc.createRightMatcher(left_matcher)

I am getting this error:

AttributeError: module 'cv2.cv2' has no attribute 'ximgproc'

How can I use ximgproc functions?


Solution

  • I installed openCV and the separate contrib module via pip install opencv-python opencv-contrib-python. That worked fine for me. If there is no reason why you want to install openCV manually you could try that.

    See here for the installation instructions on the GitHub repo of opencv-python