Sign inSign up

sgtwilko/rpi-raspbian-opencv

By sgtwilko

Updated about 7 years ago

OpenCV compiled for Raspbian with python2 and python3.

Image
24

10K+

sgtwilko/rpi-raspbian-opencv repository overview

OpenCV for Raspberry Pi

This is OpenCV compiled for the Raspberry Pi. It includes python bindings for both Python2 and Python3.

Docker Stars Docker Stars

If you use this repo, please Star it!

Getting the right image

tl;dr: just use docker pull sgtwilko/rpi-raspbian-opencv, this will pull the image tagged as latest which is probably what you want. Then skip down to the usage section at the bottom of this page.

Full version: We are building OpenCV for the most recent patch level for the last two minor versions of the current major version.
E.g., at the time of writing the latest major version is 4, this the latest two minor versions for this are 4.1 and 4.0.
We will be building only the most up to date patch version for 4.1 and 4.0, in this instance 4.1.1 and 4.0.1.
We will not be building 4.1.0 or 4.0.0 as they are only patch level changes to the minor releases.

In addition to the last two minor version of the current major version, we will also build the last minor version of the previous major version (i.e., we will continue to build a 3.something version until 5.0 is released).
Confused? yep, you should be.

The current builds are based from resin/rpi-raspbian, but will be changing to balenalib/rpi-raspbian.
If you want to test the new images out have a look at https://hub.docker.com/r/sgtwilko/balenalib-rpi-raspbian-opencv

We have a selection of tags, and this is the nomenclature we are using:

Mostly you can just grab latest, this will be based upon resin/rpi-raspbian:latest (currently Jessie).
If you need something else the tag is split into RaspbianVersion-FullOpenCVVersion, or RaspbianVersion-OpenCVMajorMinor, or RaspbianVersion-OpenCVMajorVersion.

I.e.,
sgtwilko/rpi-raspbian-opencv:jessie-3.3.1 Is an image based upon the Jessie version of Raspbian, with OpenCV 3.3.1.

Both operating system and OpenCV version can be replaced with latest so you can request
sgtwilko/rpi-raspbian-opencv:jessie-latest to get the latest version of OpenCV for Jessie,
or sgtwilko/rpi-raspbian-opencv:latest-3.3.1 to get OpenCV 3.3.1 for the version of Raspbian tagged as latest by resin.

latest for Raspbian will always be the version resin/rpi-raspbian has tagged as latest.
latest for OpenCV should be the most recent release.

Each image will have several tags initially assigned.
For example, we when it was first built we had the same image tagged as:
jessie.20171217-3.3.1, jessie-3.3.1, jessie-latest, latest-3.3.1, latest-latest and latest
We have also added Major.Minor and Major version tags, so this image would also have been tagged as
jessie-3.3, jessie-3, latest-3.3, latest-3

This image is now just tagged as jessie.20171217-3.3.1, as both the version of jessie has moved on, and a later version of OpenCV has been released.

If you have a problem with a more recent version just use the full date tagged version, e.g. jessie.20171217-3.3.1.

Usage

These images can be used as a source image for your own development.

Open CV App Development To develop apps within the container you may want to display images and/or mount a host directory to act as a persistent file store for source and images.

To access the Raspberry Pi Camera you need to allow access to the vcsm and vchiq devices:

docker run -ti --device=/dev/vcsm \
	--device=/dev/vchiq \
	sgtwilko/rpi-raspbian-opencv:latest /bin/bash

To display windows created by Open CV properly start docker with the following commands:

docker run -ti -e DISPLAY=$DISPLAY \
	-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
	sgtwilko/rpi-raspbian-opencv:latest

You will need to run either xhost + or a similar command on the host to allow connections from docker to your XWindows display. ** NOTE: ** xhost + disables all security checks! Do not use this on a system directly connected to the internet.

To mount a host directory for development (e.g., where source files for your Open CV application are stored) use the -v option for the run command:

docker run -ti -v hostDirectoryPath:containerDirectory \
	sgtwilko/rpi-raspbian-opencv:latest

Replacing hostDirectoryPath and containerDirectory with the folder outside the container that you want mapped to the folder inside the container.

Putting all that together, you'll probably end up with a command very similar to the following:

docker run -ti --device=/dev/vcsm \
	--device=/dev/vchiq \
	-e DISPLAY=$DISPLAY \
	-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
	-v hostDirectoryPath:containerDirectory \
	sgtwilko/rpi-raspbian-opencv:latest

Tag summary

Content type

Image

Digest

Size

383.7 MB

Last updated

about 7 years ago

docker pull sgtwilko/rpi-raspbian-opencv:stretch-balena-3