Created
June 14, 2016 04:06
-
-
Save brianthelion/7f3bfde19e5fa583fb43108e8a5f86ca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
if [ -z "$1" ] | |
then | |
echo "First argument is a path to the OpenCV source repo cloned from github"; | |
fi | |
if [ -z "$2" ] | |
then | |
echo "Second path is where you want the venv to end up"; | |
fi | |
REQUIRED="libavdevice-dev" | |
apt-cache show $REQUIRED > /dev/null || { echo "Please sudo apt-get install $REQUIRED"; exit 1; } | |
OPENCV_SRC=`realpath $1`; | |
VENV_PATH=$2; | |
TEMPDIR=`mktemp -d` | |
if [ ! -d "$VENV_PATH" ]; then | |
/usr/bin/pyvenv-3.5 $VENV_PATH; | |
fi | |
. $VENV_PATH/bin/activate || exit; | |
PREFIX=`python -c 'import sys; print(sys.prefix)'`; | |
echo "sys.prefix= $PREFIX"; | |
echo "tempdir= $TEMPDIR"; | |
pip install numpy; | |
cd $TEMPDIR; | |
echo "CONFIGURE"; | |
cmake $OPENCV_SRC -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=$PREFIX &> install_log; | |
echo "MAKE" | |
make -j8 1> make_log 2> make_err; | |
echo "INSTALL" | |
make install 1> install_log 2> install_err; | |
echo "DONE"; | |
python -c 'import cv2; print(cv2.__file__)'; | |
#python -c 'import cv2; print(cv2.VideoCapture("/home/br/Downloads/test_0.mov").isOpened());' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment