Completely lost on the "Install" OpenCV / ctypes-opencv for Python 3

edit: the real solution , now this is what OpenCV supports python 3. I leave the details below for those who accidentally get stuck with the old setup.


I am trying to get OpenCV by working with Python 3. A friend showed me ctypes-opencv , which seems to work with Python 3. The problem is that I cannot completely understand how to “install” or get any code. I followed all the instructions that I could find from a few people who mention google installations, and none of them worked, or I couldn’t even understand the basics they talked about.

I am simply hacking the version of IDLE that comes with Python 3. There is no IDE.

Start with OpenCV:

The only Windows installer for OpenCV 2.1 is the visual studio installer. I assume this means that it installs files that make it easier to use in Visual Studio. However, does this also mean that I cannot use this installer with Python 3? . I tried installing vs along with ctypes-opencv, as shown below, and I got errors that were not in my path (but my path variable included the OpenCV bin folder with dll). Is this the wrong direction?

An obvious alternative is to create OpenCV. I tried to follow here , and all I get is “project files may be invalid” from the GUIDE CMake application when you click the “Customize” button. The same goes for the following these tips from . I am suspicious that this is also the wrong direction, because currently I am not using any of the tools listed in the CMake setup. Is this also the wrong direction?

Next ctypes-opencv:

I installed this and the installer recognizes Python3.1 and is placed in the package sites folder. If I try to run demos, it tells me that the dlls are not on the way, although they are, as mentioned above.

Summary:

I think I usually understand every fragment here (code, compilation, dll, import, ...), but I don’t know how all the parts fit together and where I am wrong. Can someone please tell me what steps or understanding I am missing here?

I get the feeling that I need to read one or two books to fill the holes in my understanding of how all these parts fit together. I would not even know which area of ​​books to get, so any suggestions there will also be appreciated.

+4
source share
3 answers

Christoph Gohlke supports Windows binaries for many Python packages, including the production version of OpenCV 3.0 with Python 3.x bindings released on June 4, 2015:

http://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv

To install, simply download the 64-bit or 32-bit .whl file suitable for your system, then run pip install [filename] . Then the import cv2 should work in your Python 3.x interpreter.

+1
source

Python ctypes is the shell of opencv dll files, if you can point to compiled libraries, no matter what source code is configured for editing. For windows, I just run the installer, then try loading the dll with ctypes . If you can go this far, any other errors can be fixed by looking at the ctypes wrapper file and editing the boot section to look like your test file.

+2
source

Yakiimo san, OpenCV 2.1 DLL can be downloaded by ctypes. I tested it.

ps I installed C; \ OpenCV2.1 \ bin in Env Path.

0
source

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


All Articles