How to cross-compile to install OpenCV on iMX6UL ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to cross-compile to install OpenCV on iMX6UL ?

Jump to solution
2,367 Views
toanjunifer
Senior Contributor I

Hi NXPs,

My name is Toan. I installed opencv on python 2 successfully. I installed pt5-creator first and then I install opencv via source code. I successfully but it's take a long time. So how can I do cross-compile or anything else to reduce native-compile ? Use layer or recipe ?

Thank you again !

Best regards,

Toan

Labels (1)
1 Solution
2,026 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hi Toan,

    it is very easy if you have download Yocto BSP via repo sync, and compiled it successfully.

if not, you should setup environment for Yocto.

---downloading linux document from the link

Embedded Linux for i.MX Applications Processors | NXP 

Supporting informtion

pastedImage_2.png

Select one version of linux bsp, and download it's document. 

then download yocto BSP and compile it according to steps in "i.MX_Yocto_Project_User's_Guide.pdf",  opencv on python 2 have been included.

Have a nice day!

BR,

Weidong

View solution in original post

13 Replies
2,026 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hello Toan,

 NXP provides a way to compile it in yocto. Actually, it only takes a long time to compile for the first time, because it needs to download relevant software packages. After that, the compilation speed will be very fast.

Have a nice day!

BR,

Weidong

2,026 Views
toanjunifer
Senior Contributor I

Hi weidong.sun‌,

Thank you for your response. I think this way is better than I do, which take very long time to native-compile.

May you show me that way ? It's very meaningful.

Thank you so much,

Toan

0 Kudos
2,027 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hi Toan,

    it is very easy if you have download Yocto BSP via repo sync, and compiled it successfully.

if not, you should setup environment for Yocto.

---downloading linux document from the link

Embedded Linux for i.MX Applications Processors | NXP 

Supporting informtion

pastedImage_2.png

Select one version of linux bsp, and download it's document. 

then download yocto BSP and compile it according to steps in "i.MX_Yocto_Project_User's_Guide.pdf",  opencv on python 2 have been included.

Have a nice day!

BR,

Weidong

2,026 Views
toanjunifer
Senior Contributor I

Hi weidong.sun

As my main question above, I'm finding other way to execute cross-compile instead of native-compile on iMX6ULEVK. Because It's take a long time. So I think writing a recipe by myself may solved this problem. But I don't exactly what I need to do and does it's possible ?

Best regards,

Toan

0 Kudos
2,026 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hello Toan,

    I just tested meta-python2 in yocto , below is steps:

# cd ~/imx-yocto-bsp-L4.14.98-2.2.0/sources/meta-openembedded

# git clone https://git.openembedded.org/meta-python2

# cd meta-python2

# git checkout -b sumo origin/sumo

# cd ~/imx-yocto-bsp-L4.14.98-2.2.0/

# DISTRO=fsl-imx-fb MACHINE=imx6ulevk source fsl-setup-release.sh -b build-fb

(1) changing ./conf/bblayer.conf

...

#BBLAYERS += " ${BSPDIR}/sources/meta-openembedded/meta-python "
BBLAYERS += " ${BSPDIR}/sources/meta-openembedded/meta-python2 "

...

(2)changing networking's layer.conf

~/imx-yocto-bsp-L4.14.98-2.2.0/sources/meta-openembedded/meta-networking/conf/layer.conf

..
#LAYERDEPENDS_networking-layer += "meta-python"
LAYERDEPENDS_networking-layer += "meta-python2"
..

# bitbake python -c fetch

# bibake python -c compile

Have a nice day!

BR,

Weidong

2,026 Views
toanjunifer
Senior Contributor I

Hi weidong.sun‌,

Thank you for your response, but I think we have a mistake here. Maybe It's my wrong presentation.

Python is also can be added by modify "local.conf" file. It's easier than your way. Just adding "python" is enough. I mean I wanna install OpenCV on Python 2 by cross-compile. Using recipe, layer may be possible ?

Best regards,

Toan

0 Kudos
2,026 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hello Toan,

     I may have misunderstood the question you submitted before. Your goal is to call opencv Library in Python, so you want to achieve this goal when compiling in yocto.

    I looked up some materials, and did some tests in yocto. You can try it like this, which may help you.

Add these 2 lines to local.conf, please! 

......

IMAGE_INSTALL_append = " opencv python python-pip zbar"
PACKAGECONFIG_append_pn-opencv = " python"

......

good luck!

Have a nice day!

BR,

Weidong

2,026 Views
toanjunifer
Senior Contributor I

Hi weidong.sun‌,

I found that NXP has release a new kernel 4.19.35 which cantains python3-pyqt5 package. So this problem may not need to solve anymore.

Thank you for your support. 

Best regards, 

Toan

0 Kudos
2,026 Views
weidong_sun
NXP TechSupport
NXP TechSupport

You are welcome!

2,026 Views
toanjunifer
Senior Contributor I

Hi weidong.sun‌,

I tried follow your guide. But It's seem like not working. While building have no error but then I can not import cv2 from python 2 environment. I search some material It's say that opencv 4.0.1 is working good on python 2.7.

Note: While build I found a warning:

WARNING: opencv-4.0.1.imx+gitAUTOINC+737f8fad13_2522124473_32e315a5b1_34e4206aef_fccf7cd6a4_d29d003e00-r0 do_configure: QA Issue: opencv: invalid PACKAGECONFIG: python [invalid-packageconfig]

Best regards,

Toan

0 Kudos
2,026 Views
toanjunifer
Senior Contributor I

Hi weidong.sun‌,

Thank you for your response. It's very worth to try. I will response whenever I done this.

Best regards,

Toan

0 Kudos
2,026 Views
weidong_sun
NXP TechSupport
NXP TechSupport

Hi Toan,

   You mean Yocto BSP includes Python3, but you want to use Python2,  and you hope Python2 can be added to Yocto, right?

Have a nice day!

Weidong

2,026 Views
toanjunifer
Senior Contributor I

Hi weidong.sun‌,

Currently, I'm using BSP kernel v4.14.98_2.0.0 and I build a distro successfully. I install successfully OpenCV on Python 3 by adding "opencv" and other relevant packages on "local.conf" file. But I can not install OpenCV on Python 2 by this way. Did you mean "very easy way" is modify local.conf file ?

Best regards,

Toan

0 Kudos