백곡시스템

Cross-Compile OpenCV 3.4.0 to Raspberry Pi 3

출처: https://medium.com/@vbob/cross-compile-opencv-3-4-0-to-raspberry-pi-3-1f62a455989b

Title says pretty much the objective of this tutorial, so let’s go!

a) Prerequisites

  • A Raspberry Pi 3 (ARMv7) with Raspbian Stretch (let’s call it RPi3)
  • A x86_64 computer with Ubuntu 17.04 (which we’ll call build machine)

P.S.: The commands may work on other distros, but they weren’t tested.

b) Creating a docker environment for easy containerization

  • Create our workfolder and cd to it

  • Install the dependencies on the build machine

  • Create the container where we will compile

This step may take a while on the first time, since you don’t have the images locally. It will be faster next time!

  • Set the container image as executable

  • Get into docker environment

c) Installing dependencies

d) Downloading the OpenCV source code

  • Today OpenCV v3.4.0 is the latest stable release, but this tutorial should work for any future version without problems. Just change the version number when needed.

e) Configuring the build environment

  • Install pip

  • Install Python dependencies

f) Compiling!

  • Create the binaries

  • Compress the binaries

  • Exit the docker container

  • Copy the opencv_build3.4.tar.gz file, located at ./rpi3-compiling-env/opencv-3.4.0/build from your build machine to your RPi3.

g) Installing on Raspberry Pi 3

  • Uncompress the opencv_build3.4.tar.gz file on your RPi3

  • Install it locally

  • Create a symbolic link so Python finds it as when ‘import cv2’

댓글 남기기

Close Menu