You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repository generates packages which contain pre-compiled OpenCV binary with Python bindings. This enables super fast (usually < 10 seconds) OpenCV installation for Python.
14
+
This package contains only the OpenCV core modules without the optional contrib modules.
15
+
If you are looking for a version which includes OpenCV contrib modules, please install `opencv-contrib-python <https://pypi.python.org/pypi/opencv-contrib-python>`__ instead.
15
16
16
-
If you need only OpenCV Python bindings, no separate OpenCV installation is required.
17
+
The packages contain pre-compiled OpenCV binary with Python bindings.
18
+
This enables super fast (usually < 10 seconds) OpenCV installation for Python.
19
+
20
+
If you need only OpenCV Python bindings, no separate OpenCV installation is required.
17
21
18
22
**IMPORTANT NOTE**
19
23
20
-
MacOS and Linux wheels have some limitations:
24
+
MacOS and Linux wheels have currently some limitations:
21
25
22
26
- video related functionality is not supported (not compiled with FFmpeg)
23
-
- for example ``cv.imshow()`` will not work (not compiled with GTK+ 2.x or Carbon support)
27
+
- for example ``cv2.imshow()`` will not work (not compiled with GTK+ 2.x or Carbon support)
24
28
25
29
Installation and Usage
26
30
----------------------
27
31
28
32
1. If you have previous/other version of OpenCV installed (e.g. cv2 module in the root of Python's site-packages), remove it before installation to avoid conflicts.
29
33
- To further avoid conflicts and to make development easier, Python's `virtual environments <https://docs.python.org/3/library/venv.html>`__ are highly recommended for development purposes.
30
-
2. Install this package:
34
+
35
+
2. If you have an existing ``opencv-contrib-python`` installation, run ``pip uninstall opencv-contrib-python``
6. Before opening a new issue, read the FAQ below and have a look at the other issues which are already open.
48
+
49
+
Frequently Asked Questions
50
+
--------------------------
51
+
52
+
**Q: Do I need to install also OpenCV separately?**
53
+
54
+
A: No, the packages are special wheel binary packages and they already contain statically built OpenCV binaries.
55
+
56
+
**Q: Pip does not find package ``opencv-python``?**
57
+
58
+
A: The wheel package format and manylinux builds are pretty new things. Most likely the issue is related to too old pip and can be fixed by running ``pip install --upgrade pip``.
59
+
60
+
**Q: I need contrib modules?**
61
+
62
+
A: Please install `opencv-contrib-python <https://pypi.python.org/pypi/opencv-contrib-python>`__ instead. However, note that commercial usage might be restricted in some countries since the contrib modules contain some non-free/patented algorithms.
63
+
64
+
**Q: Import fails on Windows to some DLL load error?**
65
+
66
+
A: If the import fails on Windows, make sure you have `Visual C++ redistributable 2015 <https://www.microsoft.com/en-us/download/details.aspx?id=48145>`__ installed. If you are using older Windows version than Windows 10 and latest system updates are not installed, `Universal C Runtime <https://support.microsoft.com/en-us/help/2999226/update-for-universal-c-runtime-in-windows>`__ might be also required.
67
+
68
+
**Q: I have some other import errors?**
69
+
70
+
A: Make sure you have removed old manual installations of OpenCV Python bindings (cv2.so or cv2.pyd in site-packages).
71
+
72
+
**Q: Why I can't open video files on GNU/Linux distribution X or on macOS?**
73
+
74
+
A: OpenCV video I/O depends heavily on FFmpeg. Manylinux and macOS OpenCV binaries are not compiled against it.
75
+
The purpose of these packages is to provide as easy as possible installation experience for OpenCV Python bindings and they should work directly out-of-the-box.
76
+
Adding FFmpeg as an additional dependency without a "universal" FFmpeg build (e.g. LGPL licensed static build like in the Windows wheels) the goal is considerably harder to achieve. This might change in the future.
77
+
78
+
**Q: Why I can't open GUI windows (``cv2.imshow()``) on GNU/Linux distribution X or on macOS?**
79
+
80
+
A: Like above, OpenCV was not compiled against GTK or Carbon. Support for these might be added in the future.
39
81
40
82
Documentation for opencv-python
41
83
-------------------------------
@@ -52,36 +94,46 @@ Build process
52
94
-------------
53
95
54
96
The project is structured like a normal Python package with a standard
55
-
``setup.py`` file. The build process is as follows (see for example
97
+
``setup.py`` file. The build process for a single entry in the build matrices is as follows (see for example
56
98
``appveyor.yml`` file):
57
99
58
100
1. Checkout repository and submodules
59
101
60
102
- OpenCV is included as submodule and the version is updated
61
103
manually by maintainers when a new OpenCV release has been made
104
+
- Contrib modules are also included as a submodule
62
105
63
106
2. Find OpenCV version from the sources
64
-
3. Upgrade pip and install numpy for each Python version
107
+
3. Install dependencies (numpy)
65
108
4. Build OpenCV
66
109
67
110
- tests are disabled, otherwise build time increases too much
111
+
- there are 2 build matrix entries for each build combination: with and without contrib modules
112
+
- Linux builds run in manylinux Docker containers (CentOS 5)
68
113
69
114
5. Copy each ``.pyd/.so`` file to cv2 folder of this project and
70
115
generate wheel
71
-
6. Install the generated wheels for each Python version
72
-
7. Test that the Python versions can import them
73
-
8. Use twine to upload all wheels to PyPI
116
+
117
+
- Linux and macOS wheels are checked with auditwheel and delocate
118
+
119
+
6. Install the generated wheel
120
+
7. Test that Python can import the library and run some sanity checks
121
+
8. Use twine to upload the generated wheel to PyPI (only in release builds)
74
122
75
123
Currently the ``find_version.py`` file parses OpenCV version information
76
124
from the OpenCV sources. OpenCV depends on numpy, so ``setup.py`` checks
77
-
the numpy version also with the help of pip.
125
+
the minimum required numpy version also with the help of pip.
78
126
79
-
The ``cv2.pyd`` file for example on Windows is normally copied to site-packages.
127
+
The ``cv2.pyd`` file is normally copied to site-packages.
80
128
To avoid polluting the root folder the ``__init__.py`` file in cv2 folder
81
129
handles the import logic correctly by importing the actual ``.pyd`` module
82
130
and replacing the imported cv2 package in ``sys.modudes`` with the
83
131
cv2 module to retain backward compatibility.
84
132
133
+
Since both ``opencv-python`` and ``opencv-contrib-python`` use the same namespace explained above,
134
+
it is highly recommended to uninstall the other package before switching from example from
135
+
``opencv-python`` to ``opencv-contrib-python`` package.
0 commit comments