aboutsummaryrefslogtreecommitdiff
path: root/python/python3-opencv
diff options
context:
space:
mode:
Diffstat (limited to 'python/python3-opencv')
-rw-r--r--python/python3-opencv/README27
-rw-r--r--python/python3-opencv/no-ADE-download.diff37
-rwxr-xr-xpython/python3-opencv/ocv-test.py13
-rw-r--r--python/python3-opencv/python3-opencv.SlackBuild101
-rw-r--r--python/python3-opencv/python3-opencv.info12
-rw-r--r--python/python3-opencv/slack-desc19
-rw-r--r--python/python3-opencv/sync_with_sci-build-4.10.0.84.diff19
-rw-r--r--python/python3-opencv/sync_with_sci-build-4.5.5.64.diff25
8 files changed, 253 insertions, 0 deletions
diff --git a/python/python3-opencv/README b/python/python3-opencv/README
new file mode 100644
index 0000000000..32252311fd
--- /dev/null
+++ b/python/python3-opencv/README
@@ -0,0 +1,27 @@
+Python3 bindings for opencv matching system opencv version.
+
+Please note that python3-numpy is a runtime dependency as
+well as a build time dependency. Installing the resulting
+python3-opencv package without python3-numpy already installed
+will create unpredictable behaviour i.e.
+ first install python3-numpy
+ then install python3-opencv
+
+By default, additional "contrib" modules are included. If these
+are not wanted, set the CONTRIB environment variable to 0
+e.g.
+ CONTRIB=0 bash python3-opencv.SlackBuild
+
+A successful installation can be quickly tested by runnng the
+ocv-test.py script found in the documentation directory
+
+OPTIONAL EXTRAS
+ The following installations are automatically detected and
+used if available at build time:
+ - VTK visualization and image processing
+ - libdc1394 IIDC/DCAM/Firewire based camera control
+ - zulu-openjdk17 Java Development Kit
+ (other Java varieties probably also work)
+ - apache-ant Java build tool
+ (only relevant if Java is also detected)
+
diff --git a/python/python3-opencv/no-ADE-download.diff b/python/python3-opencv/no-ADE-download.diff
new file mode 100644
index 0000000000..8c72d9660f
--- /dev/null
+++ b/python/python3-opencv/no-ADE-download.diff
@@ -0,0 +1,37 @@
+--- opencv/modules/gapi/cmake/DownloadADE.cmake.orig 2022-03-04 16:48:17.000000000 +1000
++++ opencv/modules/gapi/cmake/DownloadADE.cmake 2024-08-19 23:51:02.079316762 +1000
+@@ -2,20 +2,20 @@
+ set(ade_filename "v0.1.1f.zip")
+ set(ade_subdir "ade-0.1.1f")
+ set(ade_md5 "b624b995ec9c439cbc2e9e6ee940d3a2")
+-ocv_download(FILENAME ${ade_filename}
+- HASH ${ade_md5}
+- URL
+- "${OPENCV_ADE_URL}"
+- "$ENV{OPENCV_ADE_URL}"
+- "https://github.com/opencv/ade/archive/"
+- DESTINATION_DIR ${ade_src_dir}
+- ID ADE
+- STATUS res
+- UNPACK RELATIVE_URL)
+-
+-if (NOT res)
+- return()
+-endif()
++#ocv_download(FILENAME ${ade_filename}
++# HASH ${ade_md5}
++# URL
++# "${OPENCV_ADE_URL}"
++# "$ENV{OPENCV_ADE_URL}"
++# "https://github.com/opencv/ade/archive/"
++# DESTINATION_DIR ${ade_src_dir}
++# ID ADE
++# STATUS res
++# UNPACK RELATIVE_URL)
++#
++#if (NOT res)
++# return()
++#endif()
+
+ set(ADE_root "${ade_src_dir}/${ade_subdir}/sources/ade")
+ file(GLOB_RECURSE ADE_sources "${ADE_root}/source/*.cpp")
diff --git a/python/python3-opencv/ocv-test.py b/python/python3-opencv/ocv-test.py
new file mode 100755
index 0000000000..39748c9d1f
--- /dev/null
+++ b/python/python3-opencv/ocv-test.py
@@ -0,0 +1,13 @@
+#!/usr/bin/python3
+
+import cv2
+
+#read image
+img = cv2.imread('/usr/share/wallpapers/Next/contents/images/360x720.png')
+
+#show image
+cv2.imshow('Example - Show image in window',img)
+
+cv2.waitKey(0) # waits until a key is pressed
+cv2.destroyAllWindows() # destroys the window showing image
+
diff --git a/python/python3-opencv/python3-opencv.SlackBuild b/python/python3-opencv/python3-opencv.SlackBuild
new file mode 100644
index 0000000000..487f7d2206
--- /dev/null
+++ b/python/python3-opencv/python3-opencv.SlackBuild
@@ -0,0 +1,101 @@
+#!/bin/bash
+
+# Slackware build script for python3-opencv
+
+# Copyright 2024 Christoph Willing Sydney, Australia
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PRGNAM=python3-opencv
+VERSION=${VERSION:-4.5.5.64}
+ADEVERSION=${ADEVERSION:-0.1.1f}
+SRCNAM=opencv-python
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+PKGTYPE=${PKGTYPE:-tgz}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
+ exit 0
+fi
+
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+PYVER=${PYVER:-$(python3 -c 'import sys; print("%d.%d" % sys.version_info[:2])')}
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $SRCNAM-$VERSION
+tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
+cd $SRCNAM-$VERSION
+
+patch -p0 < $CWD/sync_with_sci-build-$VERSION.diff
+
+# Provide local ADE rather than download during build
+patch -p0 < $CWD/no-ADE-download.diff
+ADE_DIR=_skbuild/linux-${ARCH/i586/i686}-$PYVER/cmake-build/3rdparty/ade
+mkdir -p $ADE_DIR
+cd $ADE_DIR
+ unzip $CWD/ade-$ADEVERSION.zip
+cd -
+
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+
+[ "${CONTRIB:-1}" = "1" ] && export ENABLE_CONTRIB=1
+export CMAKE_ARGS="-DWITH_IPP=OFF -DOPENCV_ENABLE_NONFREE=ON"
+pip3 wheel . --no-build-isolation --verbose
+
+pip3 install opencv_python-${VERSION}-*.whl --root $PKG
+unset ENABLE_CONTRIB
+
+find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a \
+ $CWD/ocv-test.py LICENSE-3RD-PARTY.txt LICENSE.txt README.md \
+ $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
diff --git a/python/python3-opencv/python3-opencv.info b/python/python3-opencv/python3-opencv.info
new file mode 100644
index 0000000000..2aba4680b2
--- /dev/null
+++ b/python/python3-opencv/python3-opencv.info
@@ -0,0 +1,12 @@
+PRGNAM="python3-opencv"
+VERSION="4.5.5.64"
+HOMEPAGE="https://pypi.org/project/opencv-python"
+DOWNLOAD="https://files.pythonhosted.org/packages/3c/61/ee4496192ed27f657532fdf0d814b05b9787e7fc5122ed3ca57282bae69c/opencv-python-4.5.5.64.tar.gz \
+ https://github.com/opencv/ade/archive/refs/tags/v0.1.1f/ade-0.1.1f.zip"
+MD5SUM="428bc4ea8ef33cb88b9b7c721fa92bb4 \
+ b624b995ec9c439cbc2e9e6ee940d3a2"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES="python3-numpy scikit-build"
+MAINTAINER="Christoph Willing"
+EMAIL="chris.willing@linux.com"
diff --git a/python/python3-opencv/slack-desc b/python/python3-opencv/slack-desc
new file mode 100644
index 0000000000..766e6f1d18
--- /dev/null
+++ b/python/python3-opencv/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+python3-opencv: python3-opencv (Python3 bindings for OpenCV)
+python3-opencv:
+python3-opencv: Python3 bindings for OpenCV
+python3-opencv:
+python3-opencv:
+python3-opencv:
+python3-opencv:
+python3-opencv:
+python3-opencv:
+python3-opencv:
+python3-opencv:
diff --git a/python/python3-opencv/sync_with_sci-build-4.10.0.84.diff b/python/python3-opencv/sync_with_sci-build-4.10.0.84.diff
new file mode 100644
index 0000000000..501230915a
--- /dev/null
+++ b/python/python3-opencv/sync_with_sci-build-4.10.0.84.diff
@@ -0,0 +1,19 @@
+--- setup.py.orig 2024-06-18 03:55:09.000000000 +1000
++++ setup.py 2024-08-17 14:58:24.426316098 +1000
+@@ -23,16 +23,6 @@
+ build_rolling = get_build_env_var_by_name("rolling")
+
+ install_requires = [
+- 'numpy>=1.13.3; python_version<"3.7"',
+- 'numpy>=1.17.0; python_version>="3.7"', # https://github.com/numpy/numpy/pull/13725
+- 'numpy>=1.17.3; python_version>="3.8"',
+- 'numpy>=1.19.3; python_version>="3.9"',
+- 'numpy>=1.21.2; python_version>="3.10"',
+- 'numpy>=1.19.3; python_version>="3.6" and platform_system=="Linux" and platform_machine=="aarch64"',
+- 'numpy>=1.21.0; python_version<="3.9" and platform_system=="Darwin" and platform_machine=="arm64"',
+- 'numpy>=1.21.4; python_version>="3.10" and platform_system=="Darwin"',
+- "numpy>=1.23.5; python_version>='3.11'",
+- "numpy>=1.26.0; python_version>='3.12'"
+ ]
+
+ python_version = cmaker.CMaker.get_python_version()
diff --git a/python/python3-opencv/sync_with_sci-build-4.5.5.64.diff b/python/python3-opencv/sync_with_sci-build-4.5.5.64.diff
new file mode 100644
index 0000000000..5c9788aee5
--- /dev/null
+++ b/python/python3-opencv/sync_with_sci-build-4.5.5.64.diff
@@ -0,0 +1,25 @@
+--- setup.py.orig 2022-03-04 16:47:38.000000000 +1000
++++ setup.py 2024-08-16 19:58:40.508399337 +1000
+@@ -23,13 +23,6 @@
+ build_java = "ON" if get_build_env_var_by_name("java") else "OFF"
+
+ install_requires = [
+- 'numpy>=1.13.3; python_version<"3.7"',
+- 'numpy>=1.14.5; python_version>="3.7"',
+- 'numpy>=1.17.3; python_version>="3.8"',
+- 'numpy>=1.19.3; python_version>="3.9"',
+- 'numpy>=1.21.2; python_version>="3.10"',
+- 'numpy>=1.19.3; python_version>="3.6" and platform_system=="Linux" and platform_machine=="aarch64"',
+- 'numpy>=1.21.2; python_version>="3.6" and platform_system=="Darwin" and platform_machine=="arm64"',
+ ]
+
+ python_version = cmaker.CMaker.get_python_version()
+@@ -451,7 +444,7 @@
+ data_files,
+ # To get around a check that prepends source dir to paths and breaks package detection code.
+ cmake_source_dir="",
+- cmake_install_dir=cmake_install_reldir,
++ _cmake_install_dir=cmake_install_reldir,
+ )
+
+