Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Tensorflow 1.5 + OpenCV 3.4.1 + Python 3
FROM gcr.io/tensorflow/tensorflow:1.5.0-gpu-py3
LABEL maintainer="Igor Moiseev <moiseev.igor@gmail.com>"
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
cmake \
git \
wget \
unzip \
yasm \
pkg-config \
libswscale-dev \
libtbb2 \
libtbb-dev \
libjpeg-dev \
libpng-dev \
libtiff-dev \
libjasper-dev \
libavformat-dev \
libpq-dev \
qtbase5-dev \
python3.5-dev \
python3-tk \
cuda-core-9-0 \
cuda-command-line-tools-9-0
RUN pip install --upgrade pip && \
pip install -U setuptools && \
pip install numpy
RUN git clone https://github.com/opencv/opencv.git && \
cd opencv; git checkout 3.4.1; cd .. && \
git clone https://github.com/opencv/opencv_contrib.git && \
cd opencv_contrib; git checkout 3.4.1; cd .. && \
cd opencv; mkdir build; cd build && \
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D WITH_CUDA=OFF \
-D WITH_TBB=ON \
-D WITH_V4L=ON \
-D WITH_QT=ON \
-D WITH_OPENGL=ON \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules .. && \
make -j`nproc` && \
make install && \
sh -c 'echo "/usr/local/lib" >> /etc/ld.so.conf.d/opencv.conf' && \
ldconfig && \
cd / && rm -rf opencv*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment