Installing opencv 4.4 imx on Host Ubuntu 18.04 for yocto project

While building image for yocto project. Open CV 4.4.0 and tesseract-lang are downloaded MULTIPLE times only to redo the entire download process for the mentioned software. They are both large software and are taking a lot of time to download. I have been trying to complete the build for days now but open cv does not want to move forward from the fetch process. It downloads to a 100% and then starts from 0 again.
I am using ubuntu 18.04 as host OS

Greetings @prateek,

I can’t speak for why this may be occurring since those packages aren’t maintained or tested by us in Yocto. Perhaps the logs for the fetch task of each recipe may provide you with hints.

By the way if I may comment and provide a suggestion. Seeing as you are using our Torizon distribution, why not just package these inside of a container rather than build them into the base image in Yocto?

Both those packages should be available in Debian and thus can be installed in a Debian container with apt.

Furthermore we even have an example of setting up and using OpenCV in a container: https://developer.toradex.com/knowledge-base/torizon-sample-using-opencv-for-computer-vision

Would this be an option for you? Or is there perhaps some reason this wouldn’t work for your use-case?

Best Regards,
Jeremias

Greetings Jeremias,
I need to use eIQ, openvx, all internal speedups by GPU and DSP to get close to neural net numbers provided by nxp. I had to use tensorflow lite 2.4.1 for the purpose of openvx, hence i went for the eiq provided by meta-imx from hardknott.
If i can access above using easyinstaller, please let me know.
I am new here, new to embedded domain altogether, apologies for any oversight
Regards,
Prateek

It’s actually not clear are you using our TorizonCore distribution or our Yocto Reference Images? Both types of images are built with Yocto and can be customized with Yocto. However Torizon has the additional option of using containers to install packages.

If you use our Torizon images we additionally provide examples for opencv:
https://developer.toradex.com/knowledge-base/torizon-sample-using-opencv-for-computer-vision

And Tensorflow:
https://developer.toradex.com/knowledge-base/torizon-sample-image-classification-with-tensorflow-lite

These packages on TorizonCore in containers should be based on NXP’s Yocto recipes, however I’m unsure if we’ll have every package you require.

Otherwise you’ll need to add them in Yocto as you’ve been doing.

Best Regards,
Jeremias

The issue got solved by doing the following.

  1. you will have to add the below line in local.conf for yocto image build

IMAGE_INSTALL_append += "opencv python3-pillow adwaita-icon-theme "

remove opencv from this line.

  1. Build the image without opencv. Considering all packages get built without any error, you will get a successful build

  2. After achieving the successful build, add opencv to local.conf by writing opencv as below, IMAGE_INSTALL_append += "opencv python3-pillow adwaita-icon-theme "

Now when you install, your build should start installing opencv and tesseract-lang. These 2 are heavy packages and on slow internet, will take time to install. If they get a connection disturbance, they start to look for mirrors and you may notice your installation of these software will start from scratch, discarding the previous download.

In case if the software do complete the do_fetch task, there is still a chance that the software tries to reinstall, in that scenario, break the build and rebuild it, it should go to the do_compile task.

Thank you for sharing your procedure. So is this issue resolved for you now?

Best Regards,
Jeremias

yes, it is fixed now. thanks for your help

Perfect glad you were able to progress.