Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python opencv Aruco "No module named 'cv2.aruco'"

Tags:

I am running an Ubuntu virtual machine with, Python 3.6.1, Anaconda 4.4.0 (64-bit). I am trying to run the code on this website. When I try to use

import cv2.aruco

I get:

>>> import cv2.aruco Traceback (most recent call last):   File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'cv2.aruco' 

Is this something I need to install or setup?

like image 894
Max Mullin Avatar asked Aug 31 '17 02:08

Max Mullin


People also ask

What is ArUco marker?

ArUco markers are binary square fiducial markers that can be used for camera pose estimation. Their main benefit is that their detection is robust, fast and simple. The aruco module includes the detection of these types of markers and the tools to employ them for pose estimation and camera calibration.


2 Answers

If cv2.aruco is not found, try installing opencv-contrib-python, such as by running the following (for the default Python installation):

pip install opencv-contrib-python 

Or for a specific Python installation (in this case Python 3)

python3 -m pip install opencv-contrib-python 

Then try re-running the script trying to access cv2.aruco.

like image 110
intcreator Avatar answered Sep 21 '22 20:09

intcreator


If cv2.aruco is not found, first make sure that opencv-python is not installed.

for that you can use:

pip uninstall opencv-python 

Then install:

pip install opencv-contrib-python 

We are uninstalling opencv-python because installing two packages of opencv will contradict each other and will not let the other one install.

like image 40
SaKu. Avatar answered Sep 21 '22 20:09

SaKu.