Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added patch from jpswensen that allows opencv modules #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 44 additions & 3 deletions buildOpenCV.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License: MIT. See license file in root directory
# Copyright(c) JetsonHacks (2017-2018)

OPENCV_VERSION=3.4.3
OPENCV_VERSION=3.4.6
# Jetson AGX Xavier
ARCH_BIN=7.2
# Jetson TX2
Expand All @@ -16,6 +16,13 @@ INSTALL_DIR=/usr/local
# Make sure that you set this to YES
# Value should be YES or NO
DOWNLOAD_OPENCV_EXTRAS=NO

# Download the opencv_contrib repository
# Make sure that you set this to YES
# Value should be YES or NO
DOWNLOAD_OPENCV_CONTRIB=YES


# Source code directory
OPENCV_SOURCE_DIR=$HOME
WHEREAMI=$PWD
Expand Down Expand Up @@ -64,6 +71,10 @@ if [ $DOWNLOAD_OPENCV_EXTRAS == "YES" ] ; then
echo "Also installing opencv_extras"
fi

if [ $DOWNLOAD_OPENCV_CONTRIB == "YES" ] ; then
echo "Also installing opencv_contrib"
fi

# Repository setup
sudo apt-add-repository universe
sudo apt-get update
Expand Down Expand Up @@ -126,6 +137,16 @@ if [ $DOWNLOAD_OPENCV_EXTRAS == "YES" ] ; then
git checkout -b v${OPENCV_VERSION} ${OPENCV_VERSION}
fi

if [ $DOWNLOAD_OPENCV_CONTRIB == "YES" ] ; then
echo "Installing opencv_contrib"
# This is for the test data
cd $OPENCV_SOURCE_DIR
git clone https://github.com/opencv/opencv_contrib.git
cd opencv_contrib
git checkout -b v${OPENCV_VERSION} ${OPENCV_VERSION}
fi


cd $OPENCV_SOURCE_DIR/opencv
mkdir build
cd build
Expand All @@ -142,8 +163,26 @@ cd build
# -D CUDA_NVCC_FLAGS="--expt-relaxed-constexpr" \
# -D WITH_TBB=ON \


time cmake -D CMAKE_BUILD_TYPE=RELEASE \
if [ $DOWNLOAD_OPENCV_CONTRIB == "YES" ] ; then
time cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \
-D WITH_CUDA=ON \
-D CUDA_ARCH_BIN=${ARCH_BIN} \
-D CUDA_ARCH_PTX="" \
-D ENABLE_FAST_MATH=ON \
-D CUDA_FAST_MATH=ON \
-D WITH_CUBLAS=ON \
-D WITH_LIBV4L=ON \
-D WITH_GSTREAMER=ON \
-D WITH_GSTREAMER_0_10=OFF \
-D WITH_QT=ON \
-D WITH_OPENGL=ON \
-D CUDA_NVCC_FLAGS="--expt-relaxed-constexpr" \
-D WITH_TBB=ON \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
../
else
time cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} \
-D WITH_CUDA=ON \
-D CUDA_ARCH_BIN=${ARCH_BIN} \
Expand All @@ -159,6 +198,8 @@ time cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CUDA_NVCC_FLAGS="--expt-relaxed-constexpr" \
-D WITH_TBB=ON \
../
fi


if [ $? -eq 0 ] ; then
echo "CMake configuration make successful"
Expand Down