Wednesday, May 12, 2021

How to build OpenCV 4.5.2 with Java on Raspberry Pi with minimal effort


 Installed Rpi with 

Raspberry Pi OS with desktop and recommended software

Release date: March 4th 2021
Kernel version: 5.10
Size: 2,868MB
from here 
https://www.raspberrypi.org/software/operating-systems/

do the initialization wizard and agree to update / upgrade all the packages (takes time)


then do 

sudo apt-get install -y byobu mlocate doublecmd-qt wget ant maven busybox build-essential cmake curl mc git g++ gzip htop python-all-dev python-all python3-pip python3 python rsync zip nedit code mosquitto mosquitto-clients default-jdk ntp samba samba-common-bin smbclient

agree to everything


I have configured Samba too but it is not related

set
JAVA_HOME and ANT_HOME environment variables

do

 mvn --version

it will give you

pi@rpi:~ $ mvn --version Apache Maven 3.6.0 Maven home: /usr/share/maven Java version: 11.0.11, vendor: Raspbian, runtime: /usr/lib/jvm/java-11-openjdk-armhf Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "5.10.17-v7l+", arch: "arm", family: "unix" pi@rpi:~ $



The path the ant install is searched by hand


so you do

export ANT_HOME=/usr/share/ant
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-armhf


now get openCV


in the user home dir


mkdir work cd work git clone git://github.com/opencv/opencv.git cd opencv/ git fetch --all --tags git checkout tags/4.5.2 mkdir build cd build cmake -DBUILD_SHARED_LIBS=OFF ..
make -j4




it takes a lot of time...






No comments:

Followers