├── Dockerfile └── README.md /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:16.04 2 | 3 | RUN apt-get update && \ 4 | apt-get upgrade -y && \ 5 | apt-get install -y --no-install-recommends python python-dev python-pip build-essential cmake git pkg-config libjpeg8-dev libtiff5-dev libjasper-dev libpng12-dev libgtk2.0-dev libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libatlas-base-dev gfortran libavresample-dev libgphoto2-dev libgstreamer-plugins-base1.0-dev libdc1394-22-dev && \ 6 | pip install numpy && \ 7 | cd /opt && \ 8 | git clone https://github.com/opencv/opencv_contrib.git && \ 9 | cd opencv_contrib && \ 10 | git checkout 3.4.0 && \ 11 | cd /opt && \ 12 | git clone https://github.com/opencv/opencv.git && \ 13 | cd opencv && \ 14 | git checkout 3.4.0 && \ 15 | mkdir build && \ 16 | cd build && \ 17 | cmake -D CMAKE_BUILD_TYPE=RELEASE \ 18 | -D BUILD_NEW_PYTHON_SUPPORT=ON \ 19 | -D CMAKE_INSTALL_PREFIX=/usr/local \ 20 | -D INSTALL_C_EXAMPLES=OFF \ 21 | -D INSTALL_PYTHON_EXAMPLES=OFF \ 22 | -D OPENCV_EXTRA_MODULES_PATH=/opt/opencv_contrib/modules \ 23 | -D PYTHON_EXECUTABLE=/usr/bin/python2.7 \ 24 | -D BUILD_EXAMPLES=OFF /opt/opencv && \ 25 | make -j $(nproc) && \ 26 | make install && \ 27 | ldconfig && \ 28 | apt-get purge -y git && \ 29 | apt-get clean && rm -rf /var/lib/apt/lists/* && \ 30 | rm -rf /opt/opencv* 31 | 32 | CMD /bin/bash 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ubuntu 16.04 with OpenCV+Modules and python2.7 2 | 3 | Docker image based on Ubuntu 16.04 with python 2.7 and compiled opencv 3.4.0 with all modules from https://github.com/opencv/opencv_contrib 4 | 5 | # License 6 | 7 | * https://github.com/opencv/opencv/blob/master/LICENSE 8 | * https://github.com/opencv/opencv_contrib/blob/master/LICENSE 9 | 10 | # Usage 11 | 12 | In your python script simply import OpenCV `import cv2`. 13 | 14 | # Use Camera 15 | 16 | `$ xhost +local: # (optional) for displaying images with cv.imshow()` 17 | 18 | `$ docker run -it --rm --device=/dev/video0 -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY -v ~/myscripts/:/data dymat/opencv python /data/video.py` 19 | 20 | # Version built with CUDA 21 | 22 | If you need OpenCV with CUDA support: 23 | 24 | `$ docker pull dymat/opencv:cuda` 25 | 26 | # Use on ARM-Architectures 27 | 28 | If you want to use this image on ARM-Architectures use `dymat/opencv:arm32v7`, which is based on `arm32v7/ubuntu` and compiled on Raspberry Pi 3 (ARMv7). 29 | 30 | `$ docker pull dymat/opencv:arm32v7` 31 | --------------------------------------------------------------------------------