Installing OpenCV 3 for Aruco on a Raspberry Pi 3

Basically followed these instructions

Install guide: Raspberry Pi 3 + Raspbian Jessie + OpenCV 3

Except! Don’t get his suggested zips. They did not work since they were to old to have aruco. I did this and there was only the dictionary of constants and none of the functions in cv2.aruco.

Here’s a script that is basically compiled from the page, except git cloning the opencv directories.

Put this into a and run

chmod +x

then run the script

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y build-essential cmake pkg-config
sudo apt-get install -y libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install -y libxvidcore-dev libx264-dev
sudo apt-get install -y libgtk2.0-dev
sudo apt-get install -y libatlas-base-dev gfortran
sudo apt-get install -y python2.7-dev python3-dev
cd ~
#wget -O
#wget -O
git clone
git clone
pip install numpy
cd ~/opencv
mkdir build
cd build
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \

make -j4
sudo make install
sudo ldconfig

This process takes a while. However the early stages might still ask you stuff so get into the cloning before you leave it be for a couple hours. OpenCV is pretty big. I think it’s using 40% of a 8gb SD card, so plan accordingly. I think you can delete the clone directories once it’s installed.

2 thoughts on “Installing OpenCV 3 for Aruco on a Raspberry Pi 3”

  1. Can verify this worked great for me as of June 2017. However, I found that if compiled on all four cores the PI would freeze up and I wouldn’t be able to see progress, so I canceled. Switching ‘make j4’ to ‘make j2’ sets it to only use two cores, and this way I was able to watch progress the whole way through.

  2. “corners, ids, rejectedImgPoints = aruco.detectMarkers(gray, aruco_dict, parameters=parameters)”

    returns nothing in the corners and ids

Leave a Reply

Your email address will not be published. Required fields are marked *