Scripts for Jetson Nano
- Install script for OpenCV 3.4 (allows build and install of OpenALPR) - Uninstaller for Desktop Environment on Ubuntu 18.04 JetPack SD Card Imagemerge-requests/73/head
parent
7ca9b39edc
commit
47b48c3f10
|
@ -0,0 +1,84 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
|
||||
#
|
||||
# NVIDIA Corporation and its licensors retain all intellectual property
|
||||
# and proprietary rights in and to this software, related documentation
|
||||
# and any modifications thereto. Any use, reproduction, disclosure or
|
||||
# distribution of this software and related documentation without an express
|
||||
# license agreement from NVIDIA Corporation is strictly prohibited.
|
||||
#
|
||||
|
||||
# The orginal script 'install_opencv4.0.0_Nano.sh' could be found here:
|
||||
# https://github.com/AastaNV/JEP/blob/master/script/install_opencv4.0.0_Nano.sh
|
||||
#
|
||||
# I did some modification so that it installs opencv-3.4.6 instead. Refer
|
||||
# to my blog posts for more details.
|
||||
#
|
||||
# JK Jung, jkjung13@gmail.com
|
||||
#
|
||||
# Also modified by moeiscool of Shinobi Systems to find the patch file in the directory of the script
|
||||
|
||||
set -e
|
||||
|
||||
folder=${HOME}/src
|
||||
mkdir -p $folder
|
||||
DIR=$(cd `dirname $0` && pwd)
|
||||
|
||||
echo "** Purge old opencv installation"
|
||||
sudo apt-get purge -y libopencv*
|
||||
|
||||
echo "** Install requirements"
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y build-essential make cmake cmake-curses-gui git g++ pkg-config curl
|
||||
sudo apt-get install -y libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libeigen3-dev libglew-dev libgtk2.0-dev
|
||||
sudo apt-get install -y libtbb2 libtbb-dev libv4l-dev v4l-utils qv4l2 v4l2ucp
|
||||
sudo apt-get install -y libdc1394-22-dev libxine2-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
|
||||
# sudo apt-get install -y libjasper-dev
|
||||
sudo apt-get install -y libjpeg8-dev libjpeg-turbo8-dev libtiff-dev libpng-dev
|
||||
sudo apt-get install -y libxvidcore-dev libx264-dev libgtk-3-dev
|
||||
sudo apt-get install -y libatlas-base-dev libopenblas-dev liblapack-dev liblapacke-dev gfortran
|
||||
sudo apt-get install -y qt5-default
|
||||
|
||||
sudo apt-get install -y python2.7-dev python3.6-dev python3-testresources
|
||||
rm -f $folder/get-pip.py
|
||||
wget https://bootstrap.pypa.io/get-pip.py -O $folder/get-pip.py
|
||||
sudo python3 $folder/get-pip.py
|
||||
sudo python2 $folder/get-pip.py
|
||||
sudo pip3 install -U protobuf numpy matplotlib
|
||||
sudo pip2 install -U protobuf numpy matplotlib
|
||||
|
||||
if [ ! -f /usr/local/cuda/include/cuda_gl_interop.h.bak ]; then
|
||||
sudo cp /usr/local/cuda/include/cuda_gl_interop.h /usr/local/cuda/include/cuda_gl_interop.h.bak
|
||||
fi
|
||||
sudo patch -N /usr/local/cuda/include/cuda_gl_interop.h < $DIR/cuda_gl_interop.h.patch && echo "** '/usr/local/cuda/include/cuda_gl_interop.h' appears to be patched already. Continue..."
|
||||
|
||||
echo "** Download opencv-3.4.6"
|
||||
cd $folder
|
||||
if [ ! -f opencv-3.4.6.zip ]; then
|
||||
wget https://github.com/opencv/opencv/archive/3.4.6.zip -O opencv-3.4.6.zip
|
||||
fi
|
||||
if [ -d opencv-3.4.6 ]; then
|
||||
echo "** ERROR: opencv-3.4.6 directory already exists"
|
||||
exit
|
||||
fi
|
||||
unzip opencv-3.4.6.zip
|
||||
cd opencv-3.4.6/
|
||||
|
||||
echo "** Building opencv..."
|
||||
mkdir build
|
||||
cd build/
|
||||
|
||||
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_CUDA=ON -D CUDA_ARCH_BIN="5.3" -D CUDA_ARCH_PTX="" -D WITH_CUBLAS=ON -D ENABLE_FAST_MATH=ON -D CUDA_FAST_MATH=ON -D ENABLE_NEON=ON -D WITH_GSTREAMER=ON -D WITH_LIBV4L=ON -D BUILD_opencv_python2=ON -D BUILD_opencv_python3=ON -D BUILD_TESTS=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_EXAMPLES=OFF -D WITH_QT=ON -D WITH_OPENGL=ON ..
|
||||
make -j3
|
||||
sudo make install
|
||||
sudo ldconfig
|
||||
|
||||
sudo ln -s /usr/local/bin/opencv_* /usr/bin/
|
||||
sudo ln -s /usr/local/lib/libopencv_* /usr/lib/
|
||||
|
||||
python3 -c 'import cv2; print("python3 cv2 version: %s" % cv2.__version__)'
|
||||
python2 -c 'import cv2; print("python2 cv2 version: %s" % cv2.__version__)'
|
||||
|
||||
echo "** Install opencv-3.4.6 successfully"
|
||||
echo "Now you can run INSTALL/openalpr-gpu-easy.sh to build OpenALPR"
|
|
@ -1,3 +1,4 @@
|
|||
# Moe was here
|
||||
echo "============="
|
||||
echo "Do you want to purge Desktop components from your Ubuntu 18.04 installation?"
|
||||
echo "You cannot undo this. Choose wisely."
|
||||
|
@ -6,8 +7,21 @@ echo "(y)es or (N)o"
|
|||
read purgeDesktop
|
||||
if [ "$purgeDesktop" = "Y" ] || [ "$purgeDesktop" = "y" ]; then
|
||||
echo "Really really sure?"
|
||||
echo "(y)es or (N)o"
|
||||
read purgeDesktopSecond
|
||||
if [ "$purgeDesktopSecond" = "Y" ] || [ "$purgeDesktopSecond" = "y" ]; then
|
||||
echo "!----------------------------!"
|
||||
echo "Reset network interface to DHCP? (Automatically assign IP Address from network)"
|
||||
echo "If you don't do this you might not be able to access your machine."
|
||||
echo "You can edit it after in /etc/network/interfaces"
|
||||
echo "!----------------------------!"
|
||||
echo "(y)es or (N)o"
|
||||
read resetNetworkInterface
|
||||
if [ "$resetNetworkInterface" = "Y" ] || [ "$resetNetworkInterface" = "y" ]; then
|
||||
echo "source-directory /etc/network/interfaces.d" > "/etc/network/interfaces"
|
||||
echo "auto eth0" >> "/etc/network/interfaces"
|
||||
echo "iface eth0 inet dhcp" >> "/etc/network/interfaces"
|
||||
fi
|
||||
echo "Fixing ownership of /lib"
|
||||
sudo chown root:root / /lib
|
||||
echo "Removing desktop UI..."
|
||||
|
@ -35,10 +49,5 @@ if [ "$purgeDesktop" = "Y" ] || [ "$purgeDesktop" = "y" ]; then
|
|||
# cd /usr/src/
|
||||
# sudo rm -rf *
|
||||
sudo systemctl isolate multi-user.target
|
||||
####
|
||||
echo "Resetting network interface file"
|
||||
echo "source-directory /etc/network/interfaces.d" > "/etc/network/interfaces"
|
||||
echo "auto eth0" >> "/etc/network/interfaces"
|
||||
echo "iface eth0 inet dhcp" >> "/etc/network/interfaces"
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
--- cuda_gl_interop.h.bak 2019-05-14 13:22:48.260006308 +0800
|
||||
+++ cuda_gl_interop.h 2019-05-14 13:42:50.488005850 +0800
|
||||
@@ -58,13 +58,13 @@
|
||||
|
||||
#else /* __APPLE__ */
|
||||
|
||||
-#if defined(__arm__) || defined(__aarch64__)
|
||||
-#ifndef GL_VERSION
|
||||
-#error Please include the appropriate gl headers before including cuda_gl_interop.h
|
||||
-#endif
|
||||
-#else
|
||||
+//#if defined(__arm__) || defined(__aarch64__)
|
||||
+//#ifndef GL_VERSION
|
||||
+//#error Please include the appropriate gl headers before including cuda_gl_interop.h
|
||||
+//#endif
|
||||
+//#else
|
||||
#include <GL/gl.h>
|
||||
-#endif
|
||||
+//#endif
|
||||
|
||||
#endif /* __APPLE__ */
|
||||
|
Loading…
Reference in New Issue