Transplant Opencv to SP7021+Raspbian
Traditionally install opencv that need install many dependency package at first, then do cmake, make and make install. The full action will take several hours, even one day for Rpi2. SP7021+Raspbian development board performance is similar to Rpi2, so it will take very long time to install opencv.
This chapter will use another method to shorten the install Opencv time in SP7021 board. The dependency packages will be collect to a batch file. The opencv and opencv_contrib source and library files will be compress and put in server. User just need download the dependency.sh, opencv-4.1.0.tar.gz and opencv_contrib-4.1.0.tar.gz files and follow a few operate steps to finish the installation. It only take less than 30 mins.
Please follow below steps to install opencv-4.1.0.
1) Download files from server
$ wget http://113.196.136.132/packages/armhf/opencv410.tar
$ tar -xvf opencv410.tar
This step will get opencv-4.1.0.tar.gz, opencv_contrib-4.1.0.tar.gz and dependency.sh.
2) Copy the folder to new SP7021 board, the folder should named "work"
3) unzip files
$ tar -xzvf opencv-4.1.0.tar.gz
$ tar -xzvf opencv_contrib-4.1.0.tar.gz
4)install dependency packages
$ cd work
$ ./dependency.sh
5) execute make install
$ cd opencv-4.1.0/build
$ sudo make install
$ sudo ldconfig
6) copy cv2 library to dist-packages
$ cd /usr/local/lib/python3.7/site-packages/cv2/python-3.7
$ sudo cp cv2.cpython-37m-arm-linux-gnueabihf.so /usr/local/lib/python3.7/dist-packages
$ sudo ln -s cv2.cpython-37m-arm-linux-gnueabihf.so cv2.so
Confirm install opencv status: at command line type
$ python3
>>> import cv2
>>> cv2._version_
'4.1.0'