Build and Install OpenCV 4.5.3 on Raspberry Pi 3 with OpenCL, OpenGL and GStreamer Enable

Muhammad Yunus
2 min readOct 16, 2021

After previously we are successfully building and installing OpenCL on Raspberry Pi 3 via PoCL and VC4CL. Now, we will try to build OpenCV 4.5.3 (latest version when this tutorial created) with OpenCL, OpenGL and GStreamer enable.

Prerequisites

  • Increase Swap file on Raspberry Pi by referring to this tutorial. I just setup into 2GB swap file.

Download & Build OpenCV 4.5.3

  • Create installation script with name build_opencv_4.5.3.sh and put the following script,
  • Then execute that script with the following command,
cd ~
sudo chmod +x build_opencv_4.5.3.sh
./build_opencv_4.5.3.sh
  • Build process will take several hours (~7 hour in Raspberry Pi 3) to complete,
  • Above script will automatically installing dependency libraries, configuring OpenCV using cmake, building & installing.
  • This is build configuration from my side,
  • On above build configuration, we can see that OpenCV able to recognize OpenCL, OpenGL with Qt-4 backend, and GStreamer.
  • It’s also come with OpenCV Python bindings in Python3,

Source :

--

--

Muhammad Yunus

IoT Engineer, Software Developer & Machine Learning Enthusiast