diff --git a/README.rst b/README.rst index 6f8eed53..1d9d0eb0 100644 --- a/README.rst +++ b/README.rst @@ -11,10 +11,6 @@ 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 packages do not support video related functionality (not compiled with FFmpeg). - Installation and Usage ---------------------- @@ -49,7 +45,7 @@ A: The wheel package format and manylinux builds are pretty new things. Most lik **Q: I need contrib modules?** -A: Please install `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. +A: Please install `opencv-contrib-python `__ instead. However, note that commercial usage might be restricted in some countries since the contrib modules might contain some non-free/patented algorithms. **Q: Import fails on Windows to some DLL load error?** @@ -61,12 +57,6 @@ See also `this issue `__ if y A: Make sure you have removed old manual installations of OpenCV Python bindings (cv2.so or cv2.pyd in site-packages). -**Q: Why I can't open video files on GNU/Linux distribution X or on macOS?** - -A: OpenCV video I/O depends heavily on FFmpeg. Manylinux and macOS OpenCV binaries are not compiled against it. -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. -Adding FFmpeg as an additional dependency without a "universal" FFmpeg build (e.g. LGPL licensed build like in the Windows wheels) the goal is considerably harder to achieve. This might change in the future. - Documentation for opencv-python ------------------------------- @@ -139,7 +129,7 @@ OpenCV itself is available under `3-clause BSD License `__ (`LICENSE-3RD-PARTY.txt `__). -Windows wheels ship with `FFmpeg `__ licensed under the `LGPLv2.1 `__. +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 `__. diff --git a/README_CONTRIB.rst b/README_CONTRIB.rst index 11bf61e7..53f60e0b 100644 --- a/README_CONTRIB.rst +++ b/README_CONTRIB.rst @@ -3,7 +3,7 @@ OpenCV on Wheels **Unofficial** OpenCV packages for Python with contrib modules. -**Note: the usage of opencv-contrib-python might be restricted in some countries since the contrib package contains some patented algorithms/non-free modules.** +**Note: the (commercial) usage of opencv-contrib-python might be restricted in some countries since the contrib package might contain some patented algorithms/non-free modules.** If you are looking for a version without the contrib modules, please install `opencv-python `__ instead. @@ -12,10 +12,6 @@ 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 do not support video related functionality (not compiled with FFmpeg). - Installation and Usage ---------------------- @@ -57,12 +53,6 @@ See also `this issue `__ if y A: Make sure you have removed old manual installations of OpenCV Python bindings (cv2.so or cv2.pyd in site-packages). -**Q: Why I can't open video files on GNU/Linux distribution X or on macOS?** - -A: OpenCV video I/O depends heavily on FFmpeg. Manylinux and macOS OpenCV binaries provided withing these packages are not compiled against it. -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. -Adding FFmpeg as an additional dependency without a "universal" FFmpeg build (e.g. LGPL licensed build like in the Windows wheels) the goal is considerably harder to achieve. This might change in the future. - Documentation for opencv-python ------------------------------- @@ -135,7 +125,7 @@ OpenCV itself is available under `3-clause BSD License `__ (`LICENSE-3RD-PARTY.txt `__). -Windows wheels ship with `FFmpeg `__ licensed under the `LGPLv2.1 `__. +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 `__. diff --git a/tests/test.py b/tests/test.py index cd560763..e520814f 100644 --- a/tests/test.py +++ b/tests/test.py @@ -1,5 +1,6 @@ import unittest -import os +import sys + class OpenCVTest(unittest.TestCase): """ Simple functionality tests. """ @@ -10,8 +11,6 @@ def test_import(self): def test_video_capture(self): - if os.name != 'posix': - import cv2 - - cap = cv2.VideoCapture("SampleVideo_1280x720_1mb.mp4") - self.assertTrue(cap.isOpened()) \ No newline at end of file + import cv2 + cap = cv2.VideoCapture("SampleVideo_1280x720_1mb.mp4") + self.assertTrue(cap.isOpened()) diff --git a/travis/build-wheels.sh b/travis/build-wheels.sh index 4378d768..6a8dd0a7 100755 --- a/travis/build-wheels.sh +++ b/travis/build-wheels.sh @@ -26,8 +26,27 @@ echo "Python numpy version: $PYTHON_NUMPY_VERSION" # Begin build echo 'Begin build' cd opencv + +# FFmpeg version is too new. +# This is a temporary fix from upstream until we have a new OpenCV release. +git cherry-pick b1d208891b9f + mkdir build +export JPEG_INCLUDE_DIR="/opt/libjpeg-turbo/include" +export JPEG_LIBRARY="/opt/libjpeg-turbo/lib32/libjpeg.a" + +MACHINE_TYPE=$(uname -m) +if [[ ${MACHINE_TYPE} == 'x86_64' ]]; then + JPEG_LIBRARY="/opt/libjpeg-turbo/lib64/libjpeg.a" +fi + +export LDFLAGS=-L/root/ffmpeg_build/lib +export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/root/ffmpeg_build/lib/pkgconfig +export PATH=~/bin:$PATH + +ffmpeg -L + export QTDIR=/opt/Qt4.8.7 export PATH=$QTDIR/bin:$PATH @@ -45,7 +64,11 @@ if [[ $PYTHON_VERSION == 2* ]] && [[ $ENABLE_CONTRIB == 0 ]]; then -DPYTHON2_INCLUDE_PATH="$PYTHON_INCLUDE_PATH" \ -DPYTHON2_PACKAGES_PATH="$PYTHON_PACKAGES_PATH" \ -DPYTHON2_NUMPY_INCLUDE_DIRS="$PYTHON_NUMPY_INCLUDE_DIRS" \ - -DPYTHON2_NUMPY_VERSION="$PYTHON_NUMPY_VERSION" + -DPYTHON2_NUMPY_VERSION="$PYTHON_NUMPY_VERSION" \ + -DWITH_JPEG=ON \ + -DBUILD_JPEG=OFF \ + -DJPEG_INCLUDE_DIR="$JPEG_INCLUDE_DIR" \ + -DJPEG_LIBRARY="$JPEG_LIBRARY" fi @@ -61,7 +84,11 @@ if [[ $PYTHON_VERSION == 3* ]] && [[ $ENABLE_CONTRIB == 0 ]]; then -DPYTHON3_INCLUDE_PATH="$PYTHON_INCLUDE_PATH" \ -DPYTHON3_PACKAGES_PATH="$PYTHON_PACKAGES_PATH" \ -DPYTHON3_NUMPY_INCLUDE_DIRS="$PYTHON_NUMPY_INCLUDE_DIRS" \ - -DPYTHON3_NUMPY_VERSION="$PYTHON_NUMPY_VERSION" + -DPYTHON3_NUMPY_VERSION="$PYTHON_NUMPY_VERSION" \ + -DWITH_JPEG=ON \ + -DBUILD_JPEG=OFF \ + -DJPEG_INCLUDE_DIR="$JPEG_INCLUDE_DIR" \ + -DJPEG_LIBRARY="$JPEG_LIBRARY" fi @@ -77,7 +104,11 @@ if [[ $PYTHON_VERSION == 2* ]] && [[ $ENABLE_CONTRIB == 1 ]]; then -DPYTHON2_INCLUDE_PATH="$PYTHON_INCLUDE_PATH" \ -DPYTHON2_PACKAGES_PATH="$PYTHON_PACKAGES_PATH" \ -DPYTHON2_NUMPY_INCLUDE_DIRS="$PYTHON_NUMPY_INCLUDE_DIRS" \ - -DPYTHON2_NUMPY_VERSION="$PYTHON_NUMPY_VERSION" + -DPYTHON2_NUMPY_VERSION="$PYTHON_NUMPY_VERSION" \ + -DWITH_JPEG=ON \ + -DBUILD_JPEG=OFF \ + -DJPEG_INCLUDE_DIR="$JPEG_INCLUDE_DIR" \ + -DJPEG_LIBRARY="$JPEG_LIBRARY" fi @@ -93,7 +124,11 @@ if [[ $PYTHON_VERSION == 3* ]] && [[ $ENABLE_CONTRIB == 1 ]]; then -DPYTHON3_INCLUDE_PATH="$PYTHON_INCLUDE_PATH" \ -DPYTHON3_PACKAGES_PATH="$PYTHON_PACKAGES_PATH" \ -DPYTHON3_NUMPY_INCLUDE_DIRS="$PYTHON_NUMPY_INCLUDE_DIRS" \ - -DPYTHON3_NUMPY_VERSION="$PYTHON_NUMPY_VERSION" + -DPYTHON3_NUMPY_VERSION="$PYTHON_NUMPY_VERSION" \ + -DWITH_JPEG=ON \ + -DBUILD_JPEG=OFF \ + -DJPEG_INCLUDE_DIR="$JPEG_INCLUDE_DIR" \ + -DJPEG_LIBRARY="$JPEG_LIBRARY" fi