cancel
Showing results for 
Search instead for 
Did you mean: 

Add OpenCV to STM32MP157C-DK2 Discovery Board

DRuss.2
Associate II

I'm trying to figure out how to add OpenCV to my STM32MP157-DK2 Discovery Board. I am not new to ST Microcontrollers, but I am new to the MP1 and Cortex A processors. I'm also not new to Linux but am completely new to embedded Linux and Yocto.

I can see that there is a recipe for OpenCV included in the Ecosystem V1.2 release distribution package, but when I build the release and flash, OpenCV is not present on the DK2 board. I was able build OpenCV specifically with the bitbake command, but again, it is not present in the image. I have seen a few references to installing OpenCV in the wiki but not enough details to get to the next step.

I am wondering what the correct or preferred method for getting OpenCV included in the image. Preferably, enough information or pointers to documentation that I can understand the bigger picture and know how to do this in general and not simply how just to add OpenCV in this case.

4 REPLIES 4
Christophe Guibout
ST Employee

Hello @Community member​ ,

If you want to add a recipe into your image, you need to add this recipe in the image recipe (st-image-weston.bb if you build this image)

Feel free to look into the wiki.

BR,

Christophe

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
mleo
Senior II

Hello @Community member​ ,

you can also use apt-get mechanism to install on board required packages/libraries.

See article https://wiki.st.com/stm32mpu/wiki/Package_repository_for_OpenSTLinux_distribution

Board $> apt-get update

Board $> apt-cache search opencv

I believe you will find the one you need.

BR,

Milan

wzhan.3
Associate

Hello DRuss, I want to know if you have solved this question. cause I also need to add OpenCV to my MP1 board. Look forwward your reply!

DRuss.2
Associate II

I abandoned developing for the MP1 board long ago, so there is not much I remember or can help you with. The answer I ultimately came up with was to add my own layer to yocto and rebuild. The layer brought in OpenCV. I'll paste my notes below, but I have to admit that they don't make much sense to me now. If they don't make sense to you then, I apologize, but there is not much I can do at this point. I know this worked and that we were able to run OpenCV, but we did not get the performance that we needed and moved onto other things (and other projects).

- https://wiki.st.com/stm32mpu/wiki/How_to_create_your_own_image

- https://wiki.st.com/stm32mpu/wiki/How_to_create_a_new_open_embedded_layer

- First, create a new layer.

 - source your BitBake enve setup

  - cd STM32MPU_workspace/STM32MP15-Ecosystem-v1.2.0/Distribution_Package/openstlinux-20-02-19

  - source ./layers/meta-st/scripts/envsetup.sh

 - Get a list of existing layers

  - bitbake-layers show-layers

 - Create the new layer

  - Specify:

   - Location of the new layer

   - Name of the new layer

   - (Optionally) the priority of the new layer

  - bitbake-layers create-layer ../layers/meta-foo/meta-foo-image

- Add the new layer to your configuration

 - bitbake-layers add-layer../layers/meta-foo/meta-foo-image

- Add a recipe for the image

 - cd ../layers/meta-foo/meta-foo-images

 - mkdir recipes-foo

 - cd recipes-foo

 - mkdir images

 - cd images

 - touch foo-image-weston.bb

 - gedit foo-image-weston.bb

 - Add the following to the file

  

   require recipes-st/images/st-image-weston.bb

   SUMMARY = "Image modified for FOO"

   #

   # INSTALL addons

   # Note - Yocto documentation says that using CORE_IMAGE_EXTRA_INSTALL here

   #    is incorrect and that this variable should only be used in local.conf.

   #

   CORE_IMAGE_EXTRA_INSTALL += " \

     opencv     \

   "

 - Save and exit gedit

- Build Image

 - bitbake foo-image-weston

- Flash Image

 - Out of Scope for this document

- Generate SDK

 - bitbake -c populate_sdk foo-image-weston

- Generate Extended SDK

 - bitbake -c populate_sdk_ext foo-image-weston