Skip to content

Instantly share code, notes, and snippets.

@GowriUmesh
Created May 11, 2022 11:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save GowriUmesh/9b5068859a1361f58ea11d753c95110b to your computer and use it in GitHub Desktop.
Save GowriUmesh/9b5068859a1361f58ea11d753c95110b to your computer and use it in GitHub Desktop.
# Build arguments
ARG ZED_SDK_MAJOR
ARG ZED_SDK_MINOR
ARG L4T_MINOR_VERSION
# Specify the parent image from which we build
FROM stereolabs/zed:${ZED_SDK_MAJOR}.${ZED_SDK_MINOR}-devel-l4t-r32.${L4T_MINOR_VERSION}
# OpenCV Version
ARG OPENCV_VERSION
# Install dependencies
RUN apt-get update || true && apt-get upgrade -y &&\
# Install build tools, build dependencies and python
apt-get install --no-install-recommends -y \
build-essential gcc g++ \
cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev \
libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev \
yasm libatlas-base-dev gfortran libpq-dev \
libxine2-dev libglew-dev libtiff5-dev zlib1g-dev libavutil-dev libpostproc-dev \
libeigen3-dev python3-dev python3-pip python3-numpy libx11-dev tzdata \
&& rm -rf /var/lib/apt/lists/*
# Set Working directory
WORKDIR /opt
# Install OpenCV from Source
RUN git clone --depth 1 --branch ${OPENCV_VERSION} https://github.com/opencv/opencv.git && \
git clone --depth 1 --branch ${OPENCV_VERSION} https://github.com/opencv/opencv_contrib.git && \
cd opencv && \
mkdir build && \
cd build && \
cmake \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/ \
-D PYTHON3_PACKAGES_PATH=/usr/lib/python3/dist-packages \
-D WITH_V4L=ON \
-D WITH_QT=OFF \
-D WITH_OPENGL=ON \
-D WITH_GSTREAMER=ON \
-D OPENCV_GENERATE_PKGCONFIG=ON \
-D OPENCV_ENABLE_NONFREE=ON \
-D OPENCV_EXTRA_MODULES_PATH=/opt/opencv_contrib/modules \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D INSTALL_C_EXAMPLES=OFF \
-D BUILD_EXAMPLES=OFF .. && \
make -j"$(nproc)" && \
make install
# ALternatively, Install from Ubuntu Repository
###
#RUN apt-get update -y || true && \
# DEBIAN_FRONTEND=noninteractive apt-get install -y && \
# apt-get install -y --no-install-recommends libopencv-dev && \
# rm -rf /var/lib/apt/lists/* && apt autoremove && apt clean
###
WORKDIR /
CMD ["bash"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment