From 4016967829a28af0b520c3b01a365b9d3b578708 Mon Sep 17 00:00:00 2001 From: Cody Bennett Date: Thu, 16 Aug 2018 12:49:08 -0500 Subject: [PATCH 1/3] Add many new dependencies, install OpenCV and OpenCV_Contrib from official OpenCV Git Repositories, and ensure network interfaces are initialized prior to hostapd installation --- mtf-pi-install.sh | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/mtf-pi-install.sh b/mtf-pi-install.sh index e3e4806..9328501 100755 --- a/mtf-pi-install.sh +++ b/mtf-pi-install.sh @@ -4,15 +4,49 @@ echo -ne "Preparing Raspbian... " sudo apt-get -y purge --auto-remove gvfs-backends gvfs-fuse &> /dev/null sudo apt-get -y install vim &> /dev/null +sudo iplink set wlan0 up echo -ne " Done\n" -# Install OpenCV. -echo -ne "Installing OpenCV... " +# Install OpenCV Dependencies +echo -ne "Installing OpenCV Dependencies... " sudo apt-get -y install build-essential git cmake pkg-config &> /dev/null sudo apt-get -y install libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev &> /dev/null sudo apt-get -y install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev &> /dev/null sudo apt-get -y install libxvidcore-dev libx264-dev &> /dev/null sudo apt-get -y install libatlas-base-dev gfortran &> /dev/null +sudo apt-get -y install libgtk2.0-dev +sudo apt-get -y install python2.7-dev python3-dev +sudo apt-get -y install -f +sudo apt-get -y install hostapd +sudo mkdir /etc/hostapd +sudo touch /etc/hostapd/hostapd.conf +#Install OpenCV and OpenCV_Contrib from Official Git Repository +echo -ne "Installing OpenCV from Official Git Repository" +git clone https://github.com/opencv/opencv_contrib.git +git clone https://github.com/opencv/opencv.git +pip install numpy +cd opencv +mkdir build +cd build +#Check build +echo -ne "Checking enviornment and generating make file headers, this might take a minute or two" +cmake -D CMAKE_BUILD_TYPE=RELEASE \ + -D CMAKE_INSTALL_PREFIX=/usr/local \ + -D INSTALL_PYTHON_EXAMPLES=ON \ + -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \ + -D BUILD_EXAMPLES=ON .. + +#Generate make file +echo -ne "Generating make file, this will take at least an hour, grab a coffee and take a deep breath" +make -j4 +#Install package +echo -ne "Installing package" +sudo make install +sudo ldconfig +echo -ne "Symlinking package for import" +ln -s /usr/local/lib/python2.7/dist-packages/cv2.so cv2.so + +echo -ne "Begin Measure The Future Installation instructions" wget https://github.com/MeasureTheFuture/CVBindings/releases/download/3.4.1/cvbindings_3.4.1_armhf.deb &> /dev/null sudo dpkg -i cvbindings_3.4.1_armhf.deb &> /dev/null From 66c711e55c00f9cefac022788d36ec76925c617b Mon Sep 17 00:00:00 2001 From: Cody Bennett Date: Thu, 16 Aug 2018 18:09:52 -0500 Subject: [PATCH 2/3] Add conditionals on whether to rebuild OpenCV; change prompts from one-liners to echo/read pairs --- mtf-pi-install.sh | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) mode change 100755 => 100644 mtf-pi-install.sh diff --git a/mtf-pi-install.sh b/mtf-pi-install.sh old mode 100755 new mode 100644 index 9328501..7e0ae5b --- a/mtf-pi-install.sh +++ b/mtf-pi-install.sh @@ -4,7 +4,7 @@ echo -ne "Preparing Raspbian... " sudo apt-get -y purge --auto-remove gvfs-backends gvfs-fuse &> /dev/null sudo apt-get -y install vim &> /dev/null -sudo iplink set wlan0 up +sudo ip link set wlan0 up echo -ne " Done\n" # Install OpenCV Dependencies @@ -15,26 +15,29 @@ sudo apt-get -y install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev sudo apt-get -y install libxvidcore-dev libx264-dev &> /dev/null sudo apt-get -y install libatlas-base-dev gfortran &> /dev/null sudo apt-get -y install libgtk2.0-dev -sudo apt-get -y install python2.7-dev python3-dev +sudo apt-get -y install python2.7-dev python3-dev openjdk-8-jdk sudo apt-get -y install -f sudo apt-get -y install hostapd sudo mkdir /etc/hostapd sudo touch /etc/hostapd/hostapd.conf #Install OpenCV and OpenCV_Contrib from Official Git Repository echo -ne "Installing OpenCV from Official Git Repository" +if [ ! -d "opencv" ]; then git clone https://github.com/opencv/opencv_contrib.git git clone https://github.com/opencv/opencv.git +fi pip install numpy cd opencv mkdir build cd build #Check build echo -ne "Checking enviornment and generating make file headers, this might take a minute or two" +if [ ! -d "opencv/build/bin" ]; then cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ - -D INSTALL_PYTHON_EXAMPLES=ON \ + -D INSTALL_PYTHON_EXAMPLES=OFF \ -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \ - -D BUILD_EXAMPLES=ON .. + -D BUILD_EXAMPLES=OFF .. #Generate make file echo -ne "Generating make file, this will take at least an hour, grab a coffee and take a deep breath" @@ -43,6 +46,8 @@ make -j4 echo -ne "Installing package" sudo make install sudo ldconfig +fi + echo -ne "Symlinking package for import" ln -s /usr/local/lib/python2.7/dist-packages/cv2.so cv2.so @@ -66,7 +71,8 @@ echo -ne " Done\n" # Bootstrap the Database. echo -ne "Installing postgreSQL... \n" sudo apt-get -y install postgresql &> /dev/null -read -s -p "Create a password for the MTF database: " mtf_database_pass +echo -ne "Create a password for the MTF database: " +read mtf_database_pass echo -ne "Configuring postgreSQL... \n" sudo sed -i -e "s/password/${mtf_database_pass}/g" /usr/local/mtf/bin/scout.json @@ -125,7 +131,9 @@ do done echo -ne "\n" -read -s -p "Create a name for the wifi network: " APSSID +echo -ne "Create a name for the wifi network: " +read APSSID + sudo apt-get -f install -y hostapd dnsmasq &> /dev/null sudo cat >> /etc/dhcpcd.conf < Date: Thu, 16 Aug 2018 18:19:29 -0500 Subject: [PATCH 3/3] Update mtf-pi-install.sh --- mtf-pi-install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mtf-pi-install.sh b/mtf-pi-install.sh index 7e0ae5b..9af88a9 100644 --- a/mtf-pi-install.sh +++ b/mtf-pi-install.sh @@ -30,14 +30,14 @@ pip install numpy cd opencv mkdir build cd build -#Check build +#Check build, setting to build examples due to unsure if it is a dependency somewhere else, could speed it up dramatically if set to OFF echo -ne "Checking enviornment and generating make file headers, this might take a minute or two" if [ ! -d "opencv/build/bin" ]; then cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ - -D INSTALL_PYTHON_EXAMPLES=OFF \ + -D INSTALL_PYTHON_EXAMPLES=ON \ -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules \ - -D BUILD_EXAMPLES=OFF .. + -D BUILD_EXAMPLES=ON .. #Generate make file echo -ne "Generating make file, this will take at least an hour, grab a coffee and take a deep breath"