Wrapper package for OpenCV python bindings.
Project description
OpenCV on Wheels
Unofficial pre-built OpenCV packages for Python.
Installation and Usage
-
If you have previous/other manually installed (= not installed via
pip
) version of OpenCV installed (e.g. cv2 module in the root of Python's site-packages), remove it before installation to avoid conflicts. -
Select the correct package for your environment:
There are four different packages and you should select only one of them. Do not install multiple different packages in the same environment. There is no plugin architecture: all the packages use the same namespace (
cv2
). If you installed multiple different packages in the same environment, uninstall them all withpip uninstall
and reinstall only one package.a. Packages for standard desktop environments (Windows, macOS, almost any GNU/Linux distribution)
- run
pip install opencv-python
if you need only main modules - run
pip install opencv-contrib-python
if you need both main and contrib modules (check extra modules listing from OpenCV documentation)
b. Packages for server (headless) environments
These packages do not contain any GUI functionality. They are smaller and suitable for more restricted environments.
- run
pip install opencv-python-headless
if you need only main modules - run
pip install opencv-contrib-python-headless
if you need both main and contrib modules (check extra modules listing from OpenCV documentation)
- run
-
Import the package:
import cv2
All packages contain haarcascade files.
cv2.data.haarcascades
can be used as a shortcut to the data folder. For example:cv2.CascadeClassifier(cv2.data.haarcascades + "haarcascade_frontalface_default.xml")
-
Read OpenCV documentation
-
Before opening a new issue, read the FAQ below and have a look at the other issues which are already open.
Frequently Asked Questions
Q: Do I need to install also OpenCV separately?
A: No, the packages are special wheel binary packages and they already contain statically built OpenCV binaries.
Q: Pip fails with Could not find a version that satisfies the requirement ...
?
A: Most likely the issue is related to too old pip and can be fixed by running pip install --upgrade pip
. Note that the wheel (especially manylinux) format does not currently support properly ARM architecture so there are no packages for ARM based platforms in PyPI. However, opencv-python
packages for Raspberry Pi can be found from https://www.piwheels.org/.
Q: Import fails on Windows: ImportError: DLL load failed: The specified module could not be found.
?
A: If the import fails on Windows, make sure you have Visual C++ redistributable 2015 installed. If you are using older Windows version than Windows 10 and latest system updates are not installed, Universal C Runtime might be also required.
Windows N and KN editions do not include Media Feature Pack which is required by OpenCV. If you are using Windows N or KN edition, please install also Windows Media Feature Pack.
If the above does not help, check if you are using Anaconda. Old Anaconda versions have a bug which causes the error, see this issue for a manual fix.
If you still encounter the error after you have checked all the previous solutions, download Dependencies and open the cv2.pyd
(located usually at C:\Users\username\AppData\Local\Programs\Python\PythonXX\Lib\site-packages\cv2
) file with it to debug missing DLL issues.
Q: I have some other import errors?
A: Make sure you have removed old manual installations of OpenCV Python bindings (cv2.so or cv2.pyd in site-packages).
Q: Why the packages do not include non-free algorithms?
A: Non-free algorithms such as SIFT and SURF are not included in these packages because they are patented and therefore cannot be distributed as built binaries. See this issue for more info: https://github.com/skvark/opencv-python/issues/126
Q: Why the package and import are different (opencv-python vs. cv2)?
A: It's easier for users to understand opencv-python
than cv2
and it makes it easier to find the package with search engines. cv2
(old interface in old OpenCV versions was named as cv
) is the name that OpenCV developers chose when they created the binding generators. This is kept as the import name to be consistent with different kind of tutorials around the internet. Changing the import name or behaviour would be also confusing to experienced users who are accustomed to the import cv2
.
Documentation for opencv-python
The aim of this repository is to provide means to package each new OpenCV release for the most used Python versions and platforms.
Build process
The project is structured like a normal Python package with a standard setup.py
file.
The build process for a single entry in the build matrices is as follows (see for example appveyor.yml
file):
-
In Linux and MacOS build: get OpenCV's optional C dependencies that we compile against
-
Checkout repository and submodules
- OpenCV is included as submodule and the version is updated manually by maintainers when a new OpenCV release has been made
- Contrib modules are also included as a submodule
-
Find OpenCV version from the sources
-
Install Python dependencies
setup.py
installs the dependencies itself, so you need to run it in an environment where you have the rights to install modules with Pip for the running Python
-
Build OpenCV
- tests are disabled, otherwise build time increases too much
- there are 4 build matrix entries for each build combination: with and without contrib modules, with and without GUI (headless)
- Linux builds run in manylinux Docker containers (CentOS 5)
-
Rearrange OpenCV's build result, add our custom files and generate wheel
-
Linux and macOS wheels are transformed with auditwheel and delocate, correspondingly
-
Install the generated wheel
-
Test that Python can import the library and run some sanity checks
-
Use twine to upload the generated wheel to PyPI (only in release builds)
Steps 1--5 are handled by setup.py bdist_wheel
.
The build can be customized with environment variables. In addition to any variables that OpenCV's build accepts, we recognize:
ENABLE_CONTRIB
andENABLE_HEADLESS
. Set to1
to build the contrib and/or headless versionCMAKE_ARGS
. Additional arguments for OpenCV's CMake invocation. You can use this to make a custom build.
Licensing
Opencv-python package (scripts in this repository) is available under MIT license.
OpenCV itself is available under 3-clause BSD License.
Third party package licenses are at LICENSE-3RD-PARTY.txt.
All wheels ship with FFmpeg licensed under the LGPLv2.1.
Linux and MacOS wheels ship with Qt 4.8.7 licensed under the LGPLv2.1.
Versioning
find_version.py
script searches for the version information from OpenCV sources and appends also a revision number specific to this repository to the version string.
Releases
A release is made and uploaded to PyPI when a new tag is pushed to the repo. These tags differentiate packages (this repo might have modifications but OpenCV version stays same) and should be incremented sequentially. In practice, release version numbers look like this:
cv_major.cv_minor.cv_revision.package_revision
e.g. 3.1.0.0
The master branch follows OpenCV master branch releases. 3.4 branch follows OpenCV 3.4 bugfix releases.
Development builds
Every commit to the master branch of this repo will be built. Possible build artifacts use local version identifiers:
cv_major.cv_minor.cv_revision+git_hash_of_this_repo
e.g. 3.1.0+14a8d39
These artifacts can't be and will not be uploaded to PyPI.
Manylinux wheels
Linux wheels are built using manylinux. These wheels should work out of the box for most of the distros (which use GNU C standard library) out there since they are built against an old version of glibc.
The default manylinux
images have been extended with some OpenCV dependencies. See Docker folder for more info.
Supported Python versions
Python 2.7 is the only supported version in 2.x series. Python 2.7 support will be dropped in the end of 2019.
Python 3.x releases follow Numpy releases. For example Python 3.3 is no longer supported by Numpy so support for it has been dropped in opencv-python
, too.
Currently, builds for following Python versions are provided:
- 2.7
- 3.4
- 3.5
- 3.6
- 3.7
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Hashes for opencv_python_headless-3.4.6.27-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3390605cf3304f17672c0e2d6b5c50e583c206b9eb365c6a968b1ffd220ed80f |
|
MD5 | cce7d1fc433c44a6e542f64fd5351698 |
|
BLAKE2b-256 | d7ef1b498a8902206d0abc190806af799fe75436f617ac1be322155f9a310dc1 |
Hashes for opencv_python_headless-3.4.6.27-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2489399836292fe07f834a2d6b2c797b0a717c3ddeba752eaf44f04976e0178 |
|
MD5 | b0290ff0371dda66d53d536adadfb06c |
|
BLAKE2b-256 | 8ce147f2858a04289d6411015725588f2e05bba72eafaad423530ce1016c4930 |
Hashes for opencv_python_headless-3.4.6.27-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 386abdd7dfbb46b8c5832040d10d6286a45356af49d237dd03257a2c38c11d42 |
|
MD5 | 675adb54d535c8d1efe10b6a62e96c7b |
|
BLAKE2b-256 | d112c98aef59ca1cc90d50769078491b62ffed05fd0d63d478501ffd0bcefe9f |
Hashes for opencv_python_headless-3.4.6.27-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7875957f89c313e69b9cf0735537e9113b9687734496f7c6ab5f3bdaf6ac6f9f |
|
MD5 | d48df11be4f4250c83302f5bcaa26d14 |
|
BLAKE2b-256 | da363b30ae0628116554259ee0d890648056208fd753a4d0e78c382dbc784599 |
Hashes for opencv_python_headless-3.4.6.27-cp37-cp37m-macosx_10_8_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36faddc620e2872ee2914630b89312acb38c0ce3a1698d33e61f6b1ae77f3692 |
|
MD5 | 004ddf8780bebe796f77ec35346e1b81 |
|
BLAKE2b-256 | ee8defae41cbf095b3a896ea6a75e3dc246785a693e60bed62d26bcbf069d105 |
Hashes for opencv_python_headless-3.4.6.27-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9329c318282c5044838b7183e5b6293ddb72489070f1588d094fe06984406a3 |
|
MD5 | e3add53ebca777a9788f185dd553520c |
|
BLAKE2b-256 | 6b48b79fb132358a94473d3dea423bb1c8efb480379b2381dd925582f4856bec |
Hashes for opencv_python_headless-3.4.6.27-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6887eb3bab836b758a5ead03ddff485770680ce2cfb501e8e36d5a6b89e8333b |
|
MD5 | 1d47f2c47e0bbb89dad75c66d67851e9 |
|
BLAKE2b-256 | ee00dc0d42b2090e9ecf697c17dc49b410db455a492a1eb851fa11fa6f865a60 |
Hashes for opencv_python_headless-3.4.6.27-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b5413d91ef63e27ea00453082cfa55d3edc55dadc49b7f38f277ec5eef11ce5 |
|
MD5 | 85fe70c77f7ae9bc47d735f49f07113b |
|
BLAKE2b-256 | cff5b684d46b46239e480c1d3c698e36d74f7dbb3755dc43ea8fb7d629cc9502 |
Hashes for opencv_python_headless-3.4.6.27-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 635a6bd381cfe66ac3284d985b5735d7e7e721427ee89f7a83374dc449b9fa70 |
|
MD5 | 4b3959d7afd1b356547cad90a68512fa |
|
BLAKE2b-256 | a93419192a27ce2f0b4e7d95c70bea56ae2d2156bb375f76b794497a98f1d9d4 |
Hashes for opencv_python_headless-3.4.6.27-cp36-cp36m-macosx_10_8_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46a93792dc8b9bb0f8e35e488631f29f5df963a0b904a0d2c14e8ada8430995d |
|
MD5 | 49347789a110549cff729c79d2a6e901 |
|
BLAKE2b-256 | f771720de92f6f81a52abc7480b4715854b7fcda40864767ba2a324895c7ccec |
Hashes for opencv_python_headless-3.4.6.27-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f5756f0905c10033b7328af3516d165a6e2934b28d47451dd0c6e8ddb143e53e |
|
MD5 | 9b8340721090dd20ae8fc029b70bb11d |
|
BLAKE2b-256 | 9751ba1944d61fec3583fb10126885e05a68e3dbcd21f752aaa1df6ff0ec009e |
Hashes for opencv_python_headless-3.4.6.27-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9ec5c8df58c64051481f04df91c23203fa901c3da2ae79666a7b73516e49573 |
|
MD5 | f280e30fd2ff93ca3789357337e2a4f3 |
|
BLAKE2b-256 | 86bc12e4ba8520954ad2db1f9fa690575a45ab7c15486103ff217826caf3c12a |
Hashes for opencv_python_headless-3.4.6.27-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 860c75ce4d62eff2142d9c6ff501f0a4e5c3ffc50063905664bd9853f7053d9e |
|
MD5 | 1be8f8cd52a85b77c125076de8211342 |
|
BLAKE2b-256 | a6722a6198d7b9c496555a5624762aca597447b6a5ef51d5e128b543d26a2347 |
Hashes for opencv_python_headless-3.4.6.27-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d12a1e9ffa7bbe81ff031c21482a53600e83a116364e5e82090e3317942e72f |
|
MD5 | 1a06de13a07a1c34185cd22c163a1a1c |
|
BLAKE2b-256 | e6db08a3b022a7243618cc7c50ad7dee730bb59faf3982ead94e7b8fadaa7ccc |
Hashes for opencv_python_headless-3.4.6.27-cp35-cp35m-macosx_10_8_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c135c5e09c02dfaa3df9b770f7d0f8fdd0804e67ca06619dcbc4ba3e6a68270 |
|
MD5 | 4e661f34a0135458eb8d707d3af4f185 |
|
BLAKE2b-256 | c1368847a071779dfe7eb3d1d03b7ec9a7312d00c6257cdb61b72d8757071cd4 |
Hashes for opencv_python_headless-3.4.6.27-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca1d9adcd8be12ae6ae1825e336f286405cd8b76aec431e47e34836a537e1444 |
|
MD5 | 05a31976c1c67c7e3e3c8adea12bc04f |
|
BLAKE2b-256 | 93a425f1b5ecacb8a8d846ba5ce1607c276d6255d49ad375f8ffe3162a9fa7df |
Hashes for opencv_python_headless-3.4.6.27-cp34-cp34m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e27cd4298956a72403f12b34fe68c7d34f63e12efa79c92cd44f410e00ea8d6 |
|
MD5 | ad5825cc82962087d404be3428f82dff |
|
BLAKE2b-256 | f26ff0f8ec64f48fd56e0e32304fa548fd9e529cf0b03f6b617449dd13e1d2bc |
Hashes for opencv_python_headless-3.4.6.27-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fffeefce2b5b2a5dddd4a6e168b76baf3665285e398b6d7dbaecc3c5502df776 |
|
MD5 | ef436e9156bec0c4d4bc1371cca68961 |
|
BLAKE2b-256 | 144237bd4480affe42355316e0249c518b442509fd08b2ba52a797d6612ad628 |
Hashes for opencv_python_headless-3.4.6.27-cp34-cp34m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8057c7249be7760bb6a12a560279dd6e9ea2fc775af56db05d9559f89aa81eab |
|
MD5 | cee4db2067deba113c27032192eb1342 |
|
BLAKE2b-256 | 3be848a7f9ffeb5f6c3ddcd6a25e91f972aea0bf2bf5d0343b4f33a0ecc7a001 |
Hashes for opencv_python_headless-3.4.6.27-cp34-cp34m-macosx_10_8_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36e9b914a07fa28f7a4f78850eab67b2db62ec28a9576036cc73d05bb97f041c |
|
MD5 | beb935e1a78e6aa4159aac3636002c4c |
|
BLAKE2b-256 | d06403d912f3cab72a2001c23e2c2395480b41fae7d32a5d43dfa970a27f39f3 |
Hashes for opencv_python_headless-3.4.6.27-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e48b51096afdc3b71418b50dbdb9b3d6bdb8446db7d94d0d298a5afa9cc841a |
|
MD5 | 8b23eb373ffd22ffa26447d45dfe9294 |
|
BLAKE2b-256 | c3854d2a4b318f7fb9335e4621332a17cdb29085b363f1976b47d7091c5504c9 |
Hashes for opencv_python_headless-3.4.6.27-cp27-cp27mu-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7a72288c685090e2afdd05fe067fb40f76108aebd89dbd2cf573cb2ac56a194 |
|
MD5 | b6e81993ebc4e96f450a303a5e24c759 |
|
BLAKE2b-256 | e502879adad7bf6d5b52b6cc6ac87df635f7fa43d99820bca8ee2c3991184230 |
Hashes for opencv_python_headless-3.4.6.27-cp27-cp27m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 226758471c2aa2331b5f4ef9ea786020b670697ffa579390c263389668bd08bf |
|
MD5 | 7cf7e01c25999a75f7d4656dca8193e1 |
|
BLAKE2b-256 | 8c6bd9852ba9f5747abb681320ba92380fdf75d337ab24af65b6df1fe3ff73ac |
Hashes for opencv_python_headless-3.4.6.27-cp27-cp27m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a5491bb83c187404e19672d869d73a0565b41fe8c56cd98115879a62c8d5409 |
|
MD5 | e0009d3edbec6f3e169bfcd93dae87be |
|
BLAKE2b-256 | bae64a1462b970f39c1c8a449ff5993f996c6c6c2674619bba000ca13e8ecc46 |
Hashes for opencv_python_headless-3.4.6.27-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b7ec7772bbe09ccf17a71870985443ba6af7a0442438d66ed0604812e761ddf |
|
MD5 | 5912ca34552da4c489eaeec2a3422e57 |
|
BLAKE2b-256 | 541c9c33138c1e396eeee20aa5ed9a8063c72eefb8b95e4ccfe75d3c88449585 |
Hashes for opencv_python_headless-3.4.6.27-cp27-cp27m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 028541966abd99a5c9cdb6d2ecba2f4c0ba0ca5a533a633652fb1ce3570d23e8 |
|
MD5 | 19fb340d09d80297c40d9019a55442d7 |
|
BLAKE2b-256 | ef977da3449ad47ad1f1c44da2da39d7ae6ecf7fd1503324cc486d2abb160764 |
Hashes for opencv_python_headless-3.4.6.27-cp27-cp27m-macosx_10_8_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b2c6c1aa8295036653fbe2b0788e4ee03ff97fba5742faf6c6be258ac34ad5c |
|
MD5 | 2d9c44592c3b0ab27a3a0c99db969b85 |
|
BLAKE2b-256 | 4ee03f295b03b87f8c3dbb29f5e6ef842ea76820a056519175a569c2e96844c1 |