Error when importing cv2.aruco in python file

Hi guys,

I’m developing a module for a school project in which I need to use OpenCV combined with Aruco.
I have installed the extension SlicerOpenCV and OpenCV is working correctly when I import cv2 in my python file.
However, it seems that there is no aruco submodule. When I do cv2.aruco.some_function, I get the error object has no attribute 'aruco'.
I’ve installed opencv-contrib-python manually using pip in the python interpreter but it doesn’t fix the problem.
cv2 version installed is 3.3.1 on 3DSlicer.

Operating system: MacOS Catalina 10.15.2
Slicer version: 4.10.2

Many thanks in advance!

If you switch to a recent Slicer-4.11 version then you can run slicer.util.pip_install() to install any python package. No need to use SlicerOpenCV anymore.

2 Likes

It worked!
Thank you :slight_smile: