I can't get Opencv aruco to work on raspberry pi

Question:

I’ve tried to install cv2 on my raspberry pi and when I run just import cv2 in python it executes fine but when I run import cv2.aruco

If it’s relevant, I have a raspberry pi 1b (the original one with 2 usb ports not 4)

I am met with this error message

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

to install opencv I ran the following:

pip install opencv-python==4.5.3.56

I would appreciate any advice for where to go from here.

Thanks

Asked By: nigel

||

Answers:

The opencv-contrib-python requires the opencv-contrib-python add-on package to OpenCV. A pip install opencv-contrib-python should do the trick.

Answered By: Benjamin Pierce

For anyone still having this issue:

In order to make opencv-contrib work on Raspi there are two thing you need:

You shouldn’t have the standard opencv installed

And then:

A specific version needs to be installed, you can find what is the most recent version that works on this website:
https://www.piwheels.org/project/opencv-contrib-python/
Once you’ve found a version that works (one with a green tick for your OS)

You can install that specific version using this command:

pip install opencv-contrib-python==4.5.3.56

Just change the number to the most recent working version

I followed this tutorial:
https://singleboardblog.com/install-python-opencv-on-raspberry-pi/

Answered By: nigel
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.