GithubHelp home page GithubHelp logo

apclab / opencv-python Goto Github PK

View Code? Open in Web Editor NEW

This project forked from opencv/opencv-python

0.0 10.0 0.0 1.1 MB

OpenCV on wheels

Home Page: https://pypi.python.org/pypi/opencv-python

License: MIT License

Shell 65.54% Python 34.46%

opencv-python's Introduction

AppVeyor CI test status (Windows) Travis CI test status (Linux and OS X)

OpenCV on wheels

Unofficial OpenCV packages for Python.

This repository generates packages which contain pre-compiled OpenCV binary with Python bindings. This enables super fast (usually < 10 seconds) OpenCV installation for Python.

If you need only OpenCV Python bindings, no separate OpenCV installation is required.

IMPORTANT NOTE

MacOS and Linux wheels have some limitations:

  • video related functionality is not supported (not compiled with FFmpeg)
  • for example cv.imshow() will not work (not compiled with GTK+ 2.x or Carbon support)

Installation and Usage

  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.
  • To further avoid conflicts and to make development easier, Python's virtual environments are highly recommended for development purposes.
  1. Install this package:

pip install opencv-python

  1. Import the package:

import cv2

  1. Read OpenCV documentation

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.

At the same time it allows anyone to build a custom version of OpenCV for any Python version: just fork this repo and modify the build files and scripts to fit your needs.

Build process

The project is structured like a normal Python package with a standard setup.py file. The build process is as follows (see for example appveyor.yml file):

  1. 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
  2. Find OpenCV version from the sources
  3. Upgrade pip and install numpy for each Python version
  4. Build OpenCV
    • tests are disabled, otherwise build time increases too much
  5. Copy each .pyd/.so file to cv2 folder of this project and generate wheel
  6. Install the generated wheels for each Python version
  7. Test that the Python versions can import them
  8. Use twine to upload all wheels to PyPI

Currently the find_version.py file parses OpenCV version information from the OpenCV sources. OpenCV depends on numpy, so setup.py checks the numpy version also with the help of pip.

The cv2.pyd file for example on Windows is normally copied to site-packages. To avoid polluting the root folder the __init__.py file in cv2 folder handles the import logic correctly by importing the actual .pyd module and replacing the imported cv2 package in sys.modudes with the cv2 module to retain backward compatibility.

Licensing

Opencv-python package (scripts in this repository) is available under MIT license.

OpenCV itself is available under 3-clause BSD License (LICENSE-3RD-PARTY.txt).

Windows wheels ship with FFmpeg licensed under the LGPLv2.1.

Versioning

Currently the 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 master branch. 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

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.

To build opencv_contrib:

cd build
cmake -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules  ../opencv

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.

Supported Python versions

Python 2.7 is the only supported version in 2.x series. Python 3.x releases follow Numpy releases, for example Python 3.3 is no longer supported by Numpy so the 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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.