OpenCV packaging with python application

So, I am considering which language to use in developing an application using OpenCV. As part of my decision, I am interested in knowing how easy / difficult it is to include the opencv library in the final application. I would really like to write this in python, because opencv bindings are great, simple python, etc.

But I couldnโ€™t find a clear answer to such things as โ€œpy2app automatically binds opencv when it sees the import string cvโ€ (I think not), and if not, is there a known way to do this

In general, I would like to know what is the best way to distribute a python desktop application with opencv.

+6
source share
2 answers

I have effectively packaged, deployed, and shipped a Python application using OpenCV with cxFreeze.

http://cx-freeze.sourceforge.net/

Yes, cxFreeze automatically raised python extensions on OpenCV. I had to manually copy the OpenCV DLL (Windows), but this was a small problem that could be solved at the post-processing stage in cxFreeze. It picks up other DLLs, so I'm not sure what the problem is.

In fact, it worked so well that I was surprised. The only thing he did not pick up properly is the QT library. Basically, here were my steps (I use QT, so ignore this part if you havenโ€™t done so):

  • cxfreeze App.py --target-dir App --base-name Win32GUI --include-modules PySide.QtNetwork
  • Copy the opencv \ build \ x86 \ vc9 \ bin files to the application directory.

What is it.

+1
source

You can take a look at http://www.pyinstaller.org/ This is great, and it packs the necessary dll for opencv.

For opencv to work, this py2exe is also a numpy package. Make sure you add a dependency for it if you are using py2exe.

0
source

Source: https://habr.com/ru/post/920455/


All Articles