How to Enable OpenCL Support in OpenCV for MediaTek Yocto Platforms

From ProventusNova DeveloperWiki

How to Enable OpenCL Support in OpenCV for MediaTek Yocto Platforms

This guide explains how to add OpenCL support to OpenCV in a Yocto-based BSP for MediaTek Genio or similar platforms by modifying the OpenCV recipe through a .bbappend file.

Prerequisites

Before proceeding, make sure you have:

  • A working Yocto Project build setup for your MediaTek Genio or similar platform.
  • A custom meta-layer where you can place .bbappend files.
  • Basic knowledge of BitBake and Yocto layer structure.

Step 1: Locate the Base Recipe

OpenCV is typically provided by meta-openembedded:

meta-oe/recipes-support/opencv/opencv_4.5.5.bb

We will extend this recipe with a .bbappend in your custom layer.

Step 2: Create the .bbappend File

Create the following directory structure in your custom layer:

meta-yourlayer/
└── recipes-support/
    └── opencv/
        └── opencv_4.5.5.bbappend

Step 3: Enable OpenCL via PACKAGECONFIG

Edit opencv_4.5.5.bbappend and add:

# Enable OpenCL in OpenCV build
PACKAGECONFIG:append = " opencl"

This appends opencl to the build configuration options, enabling OpenCL support during the CMake configuration.

Step 4: Rebuild OpenCV

To apply the changes, clean and rebuild OpenCV:

bitbake -c clean opencv
bitbake opencv

Need Further Support?

📞 Book Consultation Call: Show Calendar!

📩 Contact Via Email: support@proventusnova.com

🌐 Visit Our Website: ProventusNova.com