-
Notifications
You must be signed in to change notification settings - Fork 15
/
Dockerfile.opencv_source
74 lines (66 loc) · 2.58 KB
/
Dockerfile.opencv_source
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
FROM timongentzsch/l4t-ubuntu20-base
ARG DEBIAN_FRONTEND=noninteractive
ARG OPEN_CV_VERSION=4.5.0
### TODO: Add multistagebuild with crosscompile image ###
#
# install opencv deps
#
RUN apt-get update && \
apt-get install -y --no-install-recommends build-essential cmake git unzip pkg-config \
libjpeg-dev libpng-dev libtiff-dev \
libavcodec-dev libavformat-dev libswscale-dev \
libgtk2.0-dev libcanberra-gtk* \
python3-dev python3-numpy python3-pip \
libxvidcore-dev libx264-dev libgtk-3-dev \
libtbb2 libtbb-dev libdc1394-22-dev \
gstreamer1.0-tools libv4l-dev v4l-utils \
libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
libavresample-dev libvorbis-dev libxine2-dev \
libfaac-dev libmp3lame-dev libtheora-dev \
libopencore-amrnb-dev libopencore-amrwb-dev \
libopenblas-dev libatlas-base-dev libblas-dev \
liblapack-dev libeigen3-dev gfortran \
libhdf5-dev protobuf-compiler \
libprotobuf-dev libgoogle-glog-dev libgflags-dev qt5-default \
file && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean
#
# required for cuda compiler
#
RUN apt-get update && \
apt-get install -y --no-install-recommends gcc-8 g++-8 && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 8 && \
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 8 && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean
RUN git clone --depth 1 https://github.com/opencv/opencv.git -b ${OPEN_CV_VERSION} && \
git clone --depth 1 https://github.com/opencv/opencv_contrib.git -b ${OPEN_CV_VERSION}
#
# build opencv debian pacakges from source.
# the generated .deb files will be found in release/*.deb .
# they will install opencv in /usr/local so it will not conflict with native ubuntu
# opencv installed version and will receive precedence with ld when loading opencv libraries
#
RUN cd opencv && \
mkdir release && \
cd release && \
cmake -D CUDA_ARCH_BIN="7.2,5.3" \
-D WITH_CUDA=ON \
-D CUDA_ARCH_PTX="" \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
-D WITH_LIBV4L=ON \
-D BUILD_opencv_python3=ON \
-D BUILD_TESTS=OFF \
-D BUILD_PERF_TESTS=OFF \
-D BUILD_EXAMPLES=OFF \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CPACK_BINARY_DEB=ON \
-D CPACK_SET_DESTDIR=OFF \
-D CPACK_PACKAGING_INSTALL_PREFIX=/usr/local ..
RUN cd opencv/release && make -j$(nproc)
RUN cd opencv/release && make install
RUN cd opencv/release && make package
CMD ["bash"]
WORKDIR /root