Opencv 4 and tensorflow 1.12


#1

Hi all - I have one on order. Can’t wait.

With this powerful board, can anyone share their experience with installing and running tensorflow?
Does the Raspi Pi version and protobuf install fine? https://github.com/lhelontra/tensorflow-on-arm/releases/download/v1.12.0/tensorflow-1.12.0-cp35-none-linux_armv7l.whl

I see the attempt to install opencv 4 Installing OpenCV on the Rock Pi4B
Anyone succeeded?

Thanks


#2

Hi, I filely got it working. Here is the Script I used:
echo “OpenCV installation by learnOpenCV.com

Define OpenCV version to install

cvVersion=“master”

Clean build directories

rm -rf opencv/build
rm -rf opencv_contrib/build

Create directory for installation

mkdir installation
mkdir installation/OpenCV-"$cvVersion"

Save current working directory

cwd=$(pwd)
sudo apt -y update
sudo apt -y upgrade
sudo apt -y remove x264 libx264-dev

Install dependencies

sudo apt -y install build-essential checkinstall cmake pkg-config yasm
sudo apt -y install git gfortran
sudo apt -y install libjpeg8-dev libjasper-dev libpng12-dev

sudo apt -y install libtiff5-dev

sudo apt -y install libtiff-dev

sudo apt-get -y install python-opencv

sudo apt -y install libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev
sudo apt -y install libxine2-dev libv4l-dev
cd /usr/include/linux
sudo ln -s -f …/libv4l1-videodev.h videodev.h
cd $cwd

sudo apt -y install libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev
sudo apt -y install libgtk2.0-dev libtbb-dev qt5-default
sudo apt -y install libatlas-base-dev
sudo apt -y install libfaac-dev libmp3lame-dev libtheora-dev
sudo apt -y install libvorbis-dev libxvidcore-dev
sudo apt -y install libopencore-amrnb-dev libopencore-amrwb-dev
sudo apt -y install libavresample-dev
sudo apt -y install x264 v4l-utils

Optional dependencies

sudo apt -y install libprotobuf-dev protobuf-compiler
sudo apt -y install libgoogle-glog-dev libgflags-dev
sudo apt -y install libgphoto2-dev libeigen3-dev libhdf5-dev doxygen
sudo apt -y install python3-dev python3-pip
sudo -H pip3 install -U pip numpy
sudo apt -y install python3-testresources
cd $cwd
############ For Python 3 ############

create virtual environment

python3 -m venv OpenCV-"$cvVersion"-py3
echo “# Virtual Environment Wrapper” >> ~/.bashrc
echo “alias workoncv-$cvVersion=“source $cwd/OpenCV-$cvVersion-py3/bin/activate”” >> ~/.bashrc
source “$cwd”/OpenCV-"$cvVersion"-py3/bin/activate

now install python libraries within this virtual environment

sudo pip install wheel numpy scipy matplotlib scikit-image scikit-learn ipython dlib

quit virtual environment

deactivate
git clone https://github.com/opencv/opencv.git
cd opencv
git checkout $cvVersion
cd …

git clone https://github.com/opencv/opencv_contrib.git
cd opencv_contrib
git checkout $cvVersion
cd …
cd opencv
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE
-D CMAKE_INSTALL_PREFIX=/usr/local
-D INSTALL_C_EXAMPLES=ON
-D INSTALL_PYTHON_EXAMPLES=ON
-D WITH_TBB=ON
-D WITH_V4L=ON
-D ENABLE_NEON=ON
-D OPENCV_ENABLE_NONFREE=ON
-D OPENCV_PYTHON3_INSTALL_PATH=$cwd/OpenCV-$cvVersion-py3/lib/python3.5/site-packages
-D WITH_QT=ON
-D WITH_OPENGL=ON
-D OPENCV_EXTRA_MODULES_PATH=…/…/opencv_contrib/modules
-D BUILD_EXAMPLES=ON …
sudo make -j6
sudo make install
cmake_minimum_required(VERSION 3.1)

Enable C++11

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(OpenCV_DIR /usr/local/installation/OpenCV-master/lib/cmake/opencv4)
mkdir build && cd build
sudo cmake …
sudo cmake --build . --config Release


Opencv with Raspberry Pi Cam (Rock Pi 4B)
#3

We have made a pre-built openCV 4.0 package for ROCK Pi. Please refer: https://wiki.radxa.com/Rockpi4/Ubuntu

Basically,

sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev

and

sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libdc1394-22-dev
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libavresample-dev
sudo apt install tesseract-ocr cmake-data liblept5

And finally.

sudo apt-get install opencv4.0

Opencv with Raspberry Pi Cam (Rock Pi 4B)
#4

The guy from recently added rk3399 config. So one should be able to build tensorflow for the RockPi!


#5

Hello! Want to talk about it with professionals? Probably I can help you to fix it. Could I suggest you to read an article about OpenCV developer and in the end fill contact form. Our devs will help you as soon as possible!