Cross compile OpenCv - GruszekG/nanny GitHub Wiki

1. Required packages:

  • Git
  • CMake
  • gcc-arm-linux-gnueabihf

2. Get OpenCv source code:

  • Clone OpenCV repository

git clone https://github.com/opencv/opencv

  • Get the release version (for example version 4.0.0)

git checkout 4.0.0

3. Compile

  • Go to linux platform location

cd ~/opencv/platform/linux

  • Create build location

mkdir build_hardfp cd build_hardfp

  • Run cmake with specific parameters

cmake -DENABLE_NEON=ON -DCMAKE_TOOLCHAIN_FILE=../arm-gnueabi.toolchain.cmake ../../..

  • Build opencv

make make install

4. Copy compiled OpenCv libs to BBB

scp ~/opencv/platforms/linux/build_hardfp/lib debian@<BBB_ip_address>:/usr/local/lib

References:

https://docs.opencv.org/3.4/d0/d76/tutorial_arm_crosscompile_with_cmake.html