Installing OpenCV on the Rock Pi4B


#1

I am currently using the Debian image provided by radxa, but I am having many issues with the installation of OpenCV. Has anyone tried doing it and succeeded? I think the Ubuntu OS image may help in solving some of these, but I am not sure.


Opencv 4 and tensorflow 1.12
#2

We will release a ubuntu bionic server image today. Testing now.


#3

Great, thanks a lot! Please do update the link here when it is ready.


#4

Uploading now…

You can download from:

http://dl.radxa.com/rockpi/images/ubuntu/rockpi4b-ubuntu-bionic-minimal-20181123_2237-gpt.img.gz


#6

Hi, i am new to The Pi world and learning. I have tryed ton install the Opencv using this tuto: https://www.learnopencv.com/install-opencv3-on-ubuntu/
Can someone tell me what is wrong and a path to a solution?

I got errors when i try the make file:
- Excluding from source files list: /modules/core/test/test_intrin128.sse4_2.cpp
– Excluding from source files list: /modules/core/test/test_intrin128.avx.cpp
– Excluding from source files list: /modules/core/test/test_intrin128.avx2.cpp
– Excluding from source files list: /modules/core/test/test_intrin256.avx2.cpp
– Excluding from source files list: modules/imgproc/src/corner.avx.cpp
– Excluding from source files list: modules/imgproc/src/filter.avx2.cpp
– Excluding from source files list: modules/imgproc/src/imgwarp.avx2.cpp
– Excluding from source files list: modules/imgproc/src/imgwarp.sse4_1.cpp
– Excluding from source files list: modules/imgproc/src/resize.avx2.cpp
– Excluding from source files list: modules/imgproc/src/resize.sse4_1.cpp
– Excluding from source files list: /modules/dnn/layers/layers_common.avx.cpp
– Excluding from source files list: /modules/dnn/layers/layers_common.avx2.cpp
– Excluding from source files list: /modules/dnn/layers/layers_common.avx512_skx.cpp
– Excluding from source files list: modules/features2d/src/fast.avx2.cpp
– Excluding from source files list: modules/calib3d/src/undistort.avx2.cpp
– OpenCL samples are skipped: OpenCL SDK is required
–
– General configuration for OpenCV 4.0.0 =====================================
– Version control: 4.0.0
–
– Platform:
– Timestamp: 2018-12-08T19:30:34Z
– Host: Linux 4.4.154-ge0ce80a-dirty aarch64
– CMake: 3.10.2
– CMake generator: Unix Makefiles
– CMake build tool: /usr/bin/make
– Configuration: RELEASE
–
– CPU/HW features:
– Baseline: NEON FP16
– required: NEON
– disabled: VFPV3
–
– C/C++:
– Built as dynamic libs?: YES
– C++ Compiler: /usr/bin/c++ (ver 7.3.0)
– C++ flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
– C++ flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
– C Compiler: /usr/bin/cc
– C flags (Release): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
– C flags (Debug): -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narrowing -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
– Linker flags (Release):
– Linker flags (Debug):
– ccache: NO
– Precompiled headers: YES
– Extra dependencies: dl m pthread rt /usr/lib/aarch64-linux-gnu/libGL.so /usr/lib/aarch64-linux-gnu/libGLU.so
– 3rdparty dependencies:
–
– OpenCV modules:
– To be built: calib3d core dnn features2d flann gapi highgui imgcodecs imgproc java_bindings_generator ml objdetect photo python2 python_bindings_generator stitching ts video videoio
– Disabled: world
– Disabled by dependency: -
– Unavailable: java js python3
– Applications: tests perf_tests examples apps
– Documentation: NO
– Non-free algorithms: NO
–
– GUI:
– QT: YES (ver 5.9.5)
– QT OpenGL support: YES (Qt5::OpenGL 5.9.5)
– GTK+: NO
– OpenGL support: YES (/usr/lib/aarch64-linux-gnu/libGL.so /usr/lib/aarch64-linux-gnu/libGLU.so)
– VTK support: NO
–
– Media I/O:
– ZLib: /usr/lib/aarch64-linux-gnu/libz.so (ver 1.2.11)
– JPEG: /usr/lib/aarch64-linux-gnu/libjpeg.so (ver 80)
– WEBP: build (ver encoder: 0x020e)
– PNG: /usr/lib/aarch64-linux-gnu/libpng.so (ver 1.6.34)
– TIFF: /usr/lib/aarch64-linux-gnu/libtiff.so (ver 42 / 4.0.9)
– JPEG 2000: build (ver 1.900.1)
– OpenEXR: build (ver 1.7.1)
– HDR: YES
– SUNRASTER: YES
– PXM: YES
– PFM: YES
–
– Video I/O:
– DC1394: YES (ver 2.2.5)
– FFMPEG: YES
– avcodec: YES (ver 57.107.100)
– avformat: YES (ver 57.83.100)
– avutil: YES (ver 55.78.100)
– swscale: YES (ver 4.8.100)
– avresample: NO
– GStreamer: NO
– v4l/v4l2: linux/videodev2.h
–
– Parallel framework: TBB (ver 2017.0 interface 9107)
–
– Trace: YES (built-in)
–
– Other third-party libraries:
– Lapack: NO
– Eigen: YES (ver 3.3.4)
– Custom HAL: YES (carotene (ver 0.0.1))
– Protobuf: build (3.5.1)
–
– OpenCL: YES (no extra features)
– Include path: /home/rock/opencv/3rdparty/include/opencl/1.2
– Link libraries: Dynamic load
–
– Python 2:
– Interpreter: /usr/bin/python2.7 (ver 2.7.15)
– Libraries: /usr/lib/aarch64-linux-gnu/libpython2.7.so (ver 2.7.15rc1)
– numpy: /home/rock/.local/lib/python2.7/site-packages/numpy/core/include (ver 1.15.4)
– packages path: lib/python2.7/dist-packages
–
– Python (for build): /usr/bin/python2.7
–
– Java:
– ant: NO
– JNI: NO
– Java wrappers: NO
– Java tests: NO
–
– Install to: /usr/local
– -----------------------------------------------------------------
–
– Configuring incomplete, errors occurred!
See also β€œ/home/rock/opencv/build/CMakeFiles/CMakeOutput.log”.
See also β€œ/home/rock/opencv/build/CMakeFiles/CMakeError.log”.
rock@linux:~/opencv/build$ more /home/rock/opencv/build/CMakeFiles/CMakeError.log
Build output check failed:
Regex: β€˜command line option .* is valid for .* but not for C++’
Output line: 'cc1plus: warning: command line option β€˜-Wmissing-prototypes’ is valid for C/ObjC b

#include <OpenCL_INCLUDE_DIR-NOTFOUND/CL/cl.h>

int main(int argc, char** argv)
{
  (void)argv;
#ifndef CL_VERSION_1_2
  return ((int*)(&CL_VERSION_1_2))[argc];
#else
  (void)argc;
  return 0;
#endif
}

Determining if the CL_VERSION_1_1 exist failed with the following output:
Change Dir: /home/rock/opencv/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_b1f31/fast"
/usr/bin/make -f CMakeFiles/cmTC_b1f31.dir/build.make CMakeFiles/cmTC_b1f31.dir/build
make[1]: Entering directory '/home/rock/opencv/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_b1f31.dir/CheckSymbolExists.c.o
/usr/bin/cc   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -W
error=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -W
strict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narr
owing -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread 
-fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden  -O3 -DNDEBUG -fPIE 
  -o CMakeFiles/cmTC_b1f31.dir/CheckSymbolExists.c.o   -c /home/rock/opencv/build/CMakeFiles/CMakeTm
p/CheckSymbolExists.c
/home/rock/opencv/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:2:10: fatal error: OpenCL_INCLUDE_DI
R-NOTFOUND/CL/cl.h: No such file or directory
 #include <OpenCL_INCLUDE_DIR-NOTFOUND/CL/cl.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
CMakeFiles/cmTC_b1f31.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_b1f31.dir/CheckSymbolExi
sts.c.o' failed
make[1]: *** [CMakeFiles/cmTC_b1f31.dir/CheckSymbolExists.c.o] Error 1
make[1]: Leaving directory '/home/rock/opencv/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_b1f31/fast' failed
make: *** [cmTC_b1f31/fast] Error 2

File /home/rock/opencv/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <OpenCL_INCLUDE_DIR-NOTFOUND/CL/cl.h>

int main(int argc, char** argv)
{
  (void)argv;
#ifndef CL_VERSION_1_1
  return ((int*)(&CL_VERSION_1_1))[argc];
#else
  (void)argc;
  return 0;
#endif
}

Determining if the CL_VERSION_1_0 exist failed with the following output:
Change Dir: /home/rock/opencv/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_af04d/fast"
/usr/bin/make -f CMakeFiles/cmTC_af04d.dir/build.make CMakeFiles/cmTC_af04d.dir/build
make[1]: Entering directory '/home/rock/opencv/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_af04d.dir/CheckSymbolExists.c.o
/usr/bin/cc   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -W
error=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -W
strict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narr
owing -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread 
-fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden  -O3 -DNDEBUG -fPIE 
  -o CMakeFiles/cmTC_af04d.dir/CheckSymbolExists.c.o   -c /home/rock/opencv/build/CMakeFiles/CMakeTm
p/CheckSymbolExists.c
/home/rock/opencv/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:2:10: fatal error: OpenCL_INCLUDE_DI
R-NOTFOUND/CL/cl.h: No such file or directory
 #include <OpenCL_INCLUDE_DIR-NOTFOUND/CL/cl.h>
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
CMakeFiles/cmTC_af04d.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_af04d.dir/CheckSymbolExi
sts.c.o' failed
make[1]: *** [CMakeFiles/cmTC_af04d.dir/CheckSymbolExists.c.o] Error 1
make[1]: Leaving directory '/home/rock/opencv/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_af04d/fast' failed
make: *** [cmTC_af04d/fast] Error 2

File /home/rock/opencv/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <OpenCL_INCLUDE_DIR-NOTFOUND/CL/cl.h>

int main(int argc, char** argv)
{
  (void)argv;
#ifndef CL_VERSION_1_0
  return ((int*)(&CL_VERSION_1_0))[argc];
#else
  (void)argc;
  return 0;
#endif
}

Determining if the include file sys/videoio.h exists failed with the following output:
Change Dir: /home/rock/opencv/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_6db2e/fast"
/usr/bin/make -f CMakeFiles/cmTC_6db2e.dir/build.make CMakeFiles/cmTC_6db2e.dir/build
make[1]: Entering directory '/home/rock/opencv/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_6db2e.dir/CheckIncludeFile.c.o
/usr/bin/cc   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -W
error=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -W
strict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Winit-self -Wno-narr
owing -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -pthread 
-fomit-frame-pointer -ffunction-sections -fdata-sections    -fvisibility=hidden  -O3 -DNDEBUG -fPIE 
  -o CMakeFiles/cmTC_6db2e.dir/CheckIncludeFile.c.o   -c /home/rock/opencv/build/CMakeFiles/CMakeTmp
/CheckIncludeFile.c
/home/rock/opencv/build/CMakeFiles/CMakeTmp/CheckIncludeFile.c:1:10: fatal error: sys/videoio.h: No 
such file or directory
 #include <sys/videoio.h>
          ^~~~~~~~~~~~~~~
compilation terminated.
CMakeFiles/cmTC_6db2e.dir/build.make:65: recipe for target 'CMakeFiles/cmTC_6db2e.dir/CheckIncludeFi
le.c.o' failed
make[1]: *** [CMakeFiles/cmTC_6db2e.dir/CheckIncludeFile.c.o] Error 1
make[1]: Leaving directory '/home/rock/opencv/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_6db2e/fast' failed
make: *** [cmTC_6db2e/fast] Error 2

Thanks for helping
Pierre


#7

Hi,

Your configuration enabled OpenCL, so you want to use GPU acceleration?

– OpenCL: YES (no extra features)

The other error is <sys/videoio.h> not found. From the discussion here:

https://github.com/opencv/opencv/issues/6262

You should set the WITH_V4L = OFF and keep WITH_LIBV4L = ON with cmake -D.


#8

Thanks for the response. I will try it Today.

Yes, I do want to use GPU acceleration and any other acceleration you can propose.

Thanks
Pierre


#9

Hello, i get stuck with this error

– Performing Test HAVE_CPU_NEON_SUPPORT (check file: cmake/checks/cpu_neon.cpp)
– Performing Test HAVE_CPU_NEON_SUPPORT - Failed
– NEON is not supported by C++ compiler
– Performing Test HAVE_CPU_FP16_SUPPORT (check file: cmake/checks/cpu_fp16.cpp)
– Performing Test HAVE_CPU_FP16_SUPPORT - Failed
– FP16 is not supported by C++ compiler
CMake Error at cmake/OpenCVCompilerOptimizations.cmake:460 (message):
Required baseline optimization is not supported: VFPV3
(CPU_BASELINE_REQUIRE=;VFPV3;NEON)
Call Stack (most recent call first):
cmake/OpenCVCompilerOptions.cmake:268 (include)
CMakeLists.txt:556 (include)

Looks like i am missing some dependency. But not sure what

I have a script to help install Opencv and i am tweeking is as i go
# also http://milq.github.io/install-opencv-ubuntu-debian/

KEEP UBUNTU OR DEBIAN UP TO DATE

sudo apt-get -y update
sudo apt-get -y upgrade
sudo apt-get -y dist-upgrade
sudo apt-get -y autoremove

INSTALL THE DEPENDENCIES

Build tools:

sudo apt-get install -y build-essential cmake

GUI (if you want to use GTK instead of Qt, replace β€˜qt5-default’ with β€˜libgtkglext1-dev’ and remove β€˜-DWITH_QT=ON’ option in CMake):

sudo apt-get install -y qt5-default libvtk6-dev

Media I/O:

sudo apt-get install -y zlib1g-dev libjpeg-dev libwebp-dev libpng-dev libtiff5-dev libjasper-dev libopenexr-dev libgdal-dev

Video I/O:

sudo apt-get install -y libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev yasm libopencore-amrnb-dev libopencore-amrwb-dev libv4l-dev libxine2-dev

Parallelism and linear algebra libraries:

sudo apt-get install -y libtbb-dev libeigen3-dev
sudo apt-get install -y libgtk2.0-dev libgtk-3-dev
sudo apt-get install -y libcanberra-gtk*
sudo apt-get install -y libatlas-base-dev gfortran

Python:

sudo apt-get install -y python-dev python-tk python-numpy python3-dev python3-tk python3-numpy

Java:

sudo apt-get install -y ant default-jdk

Documentation:

sudo apt-get install -y doxygen

Video lib

sudo apt-get install libxine2

INSTALL THE LIBRARY (YOU CAN CHANGE β€˜3.1.0’ FOR THE LAST STABLE VERSION)

sudo apt-get install -y unzip wget
wget https://github.com/opencv/opencv/archive/4.0.0.zip
unzip 4.0.0.zip
rm 4.0.0.zip
mv opencv-4.0.0 OpenCV
cd OpenCV
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE
-D CMAKE_INSTALL_PREFIX=/usr/local
-D INSTALL_PYTHON_EXAMPLES=OFF
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.4.0/modules
-D ENABLE_NEON=ON
-D ENABLE_VFPV3=ON
-D BUILD_TESTS=OFF
-D WITH_V4L=OFF
-D WITH_LIBV4L=ON
-D BUILD_EXAMPLES=OFF …
make -j6
sudo make install
sudo ldconfig

EXECUTE SOME OPENCV EXAMPLES AND COMPILE A DEMONSTRATION

To complete this step, please visit β€˜http://milq.github.io/install-opencv-ubuntu-debian’.


#10

Any ONe have an idear how to fix (Include the NEON and VFPV).
We need that to get Better Performance.

Update 2018-12-17 : I read that it can be related to the version of the c++ compiler. I will try with g++ version 8


#11

For GPU acceleration, you need the libmali with OpenCL enabled, currently the libmali in the released image is only OpenGL ES enabled, that means you can’t use OpenCL, we will release a separate deb package for OpenCL enabled libmali. I will update to you.


#12

Cool Thanks!

What is the timeframe for this release?


#13

I was not able to install in on the Debian image, But i got it working on the Ubuntu Image.
p


#14

Hi,

I was able to install Opencv4.01 on Ubuntu Latest Image. 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-get install vtk*
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
############ For Python 3 ############

create virtual environment

now install python libraries within this virtual environment

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

quit virtual environment

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=/usr/local/lib/python3.6/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

Enable C++11

mkdir build && cd build
sudo cmake …
sudo cmake --build . --config Release
sudo ln -s /usr/local/lib/python3.6/site-packages/cv2.cpython-36m-aarch64-linux-gnu.so /usr/local/lib/python3.6/site-packages/cv2.so


#15

We have made a debian package for OpenCV 4. Please refer: https://wiki.radxa.com/Rockpi4/Ubuntu to install it.


#16

Thanks that very cool


#17

Hi @jack, is there any update on the OpenCL enabled libmali .deb package? I was interested in using the GPU for performing some computer vision tasks. Thanks!


#18

Yes, the mali package with OpenCL support is already added to the apt source.

https://github.com/radxa/apt/tree/gh-pages/bionic/pool/main/m/mali-binary

please install it with

sudo apt-get install rockchip-mali-midgard14 rockchip-mali-midgard-dev

And check if it works with clinfo command.


#19

Hi,

I get this error:

Unpacking rockchip-mali-midgard14 (1.6-1) …
dpkg: error processing archive /var/cache/apt/archives/rockchip-mali-midgard14_1.6-1_arm64.deb (–unpack):
trying to overwrite β€˜/usr/lib/aarch64-linux-gnu/libEGL.so’, which is also in package libglvnd-dev:arm64 1.0.0-2ubuntu2.2
Errors were encountered while processing:
/var/cache/apt/archives/rockchip-mali-midgard14_1.6-1_arm64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I have tryed to fix the error:
sudo apt-get update --fix-missing
sudo apt-get install -f

then

sudo dpkg --configure -a

sudo apt-get clean

sudo apt-get update

And Clinfo will not install

Reading state information… Done
You might want to run β€˜apt --fix-broken install’ to correct these.
The following packages have unmet dependencies:
rockchip-mali-midgard-dev : Depends: rockchip-mali-midgard14 (= 1.6-1) but it is not going to be installed
E: Unmet dependencies. Try β€˜apt --fix-broken install’ with no packages (or specify a solution).

  • Still cannot install the package

#20

Hi @Pierre, I solved this by using a force overwrite… I was able to install clinfo independently, but try this:

sudo dpkg -i --force-overwrite /var/cache/apt/archives/rockchip-mali-midgard14_1.6-1_arm64.deb 

Then it worked without errors for me. PS: thanks @jack and the Radxa team for the drivers! Now I am trying to install OpenCV with OpenCL enabled, will update here soon.


#21

Yes that Works! Thanks