-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-opencv.sh
33 lines (29 loc) · 975 Bytes
/
build-opencv.sh
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
#!/bin/bash
set -euo pipefail
# Install dependencies
sudo apt-get install --quiet -y --no-install-recommends \
build-essential \
cmake\
gstreamer1.0-gl \
gstreamer1.0-opencv \
gstreamer1.0-plugins-bad \
gstreamer1.0-plugins-good \
gstreamer1.0-plugins-ugly \
gstreamer1.0-tools \
libgstreamer-plugins-base1.0-dev \
libgstreamer1.0-0 \
libgstreamer1.0-dev
OPENCV_VER="82"
PROJDIR=$(pwd)
TMPDIR=$(mktemp -d)
# Build and install OpenCV from source
cd "${TMPDIR}"
git clone --branch ${OPENCV_VER} --depth 1 --recurse-submodules --shallow-submodules https://github.com/opencv/opencv-python.git opencv-python-${OPENCV_VER}
cd opencv-python-${OPENCV_VER}
export ENABLE_CONTRIB=0
export ENABLE_HEADLESS=1
# Configure OpenCV build
export CMAKE_ARGS="-DWITH_GSTREAMER=ON -DBUILD_NEW_PYTHON_SUPPORT=ON -DBUILD_opencv_python3=ON -DHAVE_opencv_python3=ON"
MAKEFLAGS="-j$(nproc)"
export MAKEFLAGS
python3 -m pip wheel . --verbose --wheel-dir "${PROJDIR}/wheels/"