From 7b10157d8cc8bac6089e181a52f2dd50edffa979 Mon Sep 17 00:00:00 2001
From: Andrey Senyaev <76472231+asenyaev@users.noreply.github.com>
Date: Fri, 29 Jul 2022 18:13:48 +0300
Subject: [PATCH 01/59] Updated submodules to the latest in 5.x (#696)

---
 opencv         | 2 +-
 opencv_contrib | 2 +-
 opencv_extra   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/opencv b/opencv
index b0dc4741..638a0788 160000
--- a/opencv
+++ b/opencv
@@ -1 +1 @@
-Subproject commit b0dc474160e389b9c9045da5db49d03ae17c6a6b
+Subproject commit 638a0788fe8ba58d735ac0eddbc8297bb3105da0
diff --git a/opencv_contrib b/opencv_contrib
index db16caf6..b9ccfebf 160000
--- a/opencv_contrib
+++ b/opencv_contrib
@@ -1 +1 @@
-Subproject commit db16caf6ceee76b43b94c846be276e92a43e9700
+Subproject commit b9ccfebf24d993ce5009c1b28c2bcbbdb3721a2c
diff --git a/opencv_extra b/opencv_extra
index 936854e2..a13afb81 160000
--- a/opencv_extra
+++ b/opencv_extra
@@ -1 +1 @@
-Subproject commit 936854e2b666853d6d0732a8eabc2d699f4fa3d8
+Subproject commit a13afb81a66b95c25d83bcc4d661ae516bdfedde

From 3336f6717fa24a74d59e6116593d3acdcb247576 Mon Sep 17 00:00:00 2001
From: Andrey Senyaev <76472231+asenyaev@users.noreply.github.com>
Date: Mon, 1 Aug 2022 09:21:27 +0300
Subject: [PATCH 02/59] Run pipelines on 4.x and 5.x branches (#697)

---
 .github/workflows/build_wheels_linux.yml     | 2 ++
 .github/workflows/build_wheels_linux_arm.yml | 2 ++
 .github/workflows/build_wheels_macos.yml     | 2 ++
 .github/workflows/build_wheels_macos_m1.yml  | 2 ++
 .github/workflows/build_wheels_windows.yml   | 2 ++
 5 files changed, 10 insertions(+)

diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml
index 98ad3dc8..76a6d649 100644
--- a/.github/workflows/build_wheels_linux.yml
+++ b/.github/workflows/build_wheels_linux.yml
@@ -5,6 +5,8 @@ on:
     branches:
       - master
       - 3.4
+      - 4.x
+      - 5.x
     paths-ignore:
       - '.github/workflows/build_wheels_linux_arm.yml'
       - '.github/workflows/build_wheels_windows*'
diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml
index 4d0c3daf..0a4dadbc 100644
--- a/.github/workflows/build_wheels_linux_arm.yml
+++ b/.github/workflows/build_wheels_linux_arm.yml
@@ -5,6 +5,8 @@ on:
     branches:
       - master
       - 3.4
+      - 4.x
+      - 5.x
     paths-ignore:
       - '.github/workflows/build_wheels_linux.yml'
       - '.github/workflows/build_wheels_windows*'
diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml
index af892101..438373bb 100644
--- a/.github/workflows/build_wheels_macos.yml
+++ b/.github/workflows/build_wheels_macos.yml
@@ -5,6 +5,8 @@ on:
     branches:
       - master
       - 3.4
+      - 4.x
+      - 5.x
     paths-ignore:
       - '.github/workflows/build_wheels_linux*'
       - '.github/workflows/build_wheels_windows*'
diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml
index a1d7c924..134d5450 100644
--- a/.github/workflows/build_wheels_macos_m1.yml
+++ b/.github/workflows/build_wheels_macos_m1.yml
@@ -5,6 +5,8 @@ on:
     branches:
       - master
       - 3.4
+      - 4.x
+      - 5.x
     paths-ignore:
       - '.github/workflows/build_wheels_linux*'
       - '.github/workflows/build_wheels_windows*'
diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index 087efc04..f7d2c408 100644
--- a/.github/workflows/build_wheels_windows.yml
+++ b/.github/workflows/build_wheels_windows.yml
@@ -5,6 +5,8 @@ on:
     branches:
       - master
       - 3.4
+      - 4.x
+      - 5.x
     paths-ignore:
       - '.github/workflows/build_wheels_linux*'
       - '.github/workflows/build_wheels_macos*'

From 5aad8e1c6a131ae08e240973ed58fd49c48ee05c Mon Sep 17 00:00:00 2001
From: Andrey Senyaev <andrey.senyaev@gmail.com>
Date: Mon, 1 Aug 2022 09:45:37 +0300
Subject: [PATCH 03/59] Fix path to opencv 5.x for haarcascades

---
 setup.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/setup.py b/setup.py
index 11014d6b..3a1a7cfd 100644
--- a/setup.py
+++ b/setup.py
@@ -109,7 +109,7 @@ def main():
             r"python/cv2/.*config.*.py"
         ],
         "cv2.data": [  # OPENCV_OTHER_INSTALL_PATH
-            ("etc" if os.name == "nt" else "share/opencv4") + r"/haarcascades/.*\.xml"
+            ("etc" if os.name == "nt" else "share/opencv5") + r"/haarcascades/.*\.xml"
         ],
         "cv2.gapi": [
             "python/cv2" + r"/gapi/.*\.py"

From 3d0b585fc1b83761a2d2d3d83f1ad55c1266831c Mon Sep 17 00:00:00 2001
From: Andrey Senyaev <76472231+asenyaev@users.noreply.github.com>
Date: Wed, 3 Aug 2022 15:12:49 +0300
Subject: [PATCH 04/59] Scheduled rolling workflows (#699)

* Scheduled rolling workflows

* Fixed a bug in commit/date for package version

* Changed the name of Windows pipelines
---
 .github/workflows/build_wheels_linux.yml     | 96 ++++++++++++++------
 .github/workflows/build_wheels_linux_arm.yml | 80 ++++++++++++----
 .github/workflows/build_wheels_macos.yml     | 78 +++++++++++-----
 .github/workflows/build_wheels_macos_m1.yml  | 81 +++++++++++++----
 .github/workflows/build_wheels_windows.yml   | 76 ++++++++++++----
 find_version.py                              | 13 ++-
 scripts/build.sh                             |  1 +
 scripts/install.sh                           |  1 +
 setup.py                                     | 39 +++++---
 9 files changed, 345 insertions(+), 120 deletions(-)

diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml
index 76a6d649..a0933da5 100644
--- a/.github/workflows/build_wheels_linux.yml
+++ b/.github/workflows/build_wheels_linux.yml
@@ -1,4 +1,4 @@
-name: Build PYPI wheels for opencv-python on Linux x86_64
+name: Linux x86_64
 
 on:
   pull_request:
@@ -13,10 +13,13 @@ on:
       - '.github/workflows/build_wheels_macos*'
   release:
     types: [published, edited]
+  schedule:
+    - cron: '0 3 * * 6'
+  workflow_dispatch:
 
 
 jobs:
-  build:
+  Build:
     runs-on: ubuntu-20.04
     defaults:
       run:
@@ -32,7 +35,7 @@ jobs:
     env:
       ACTIONS_ALLOW_UNSECURE_COMMANDS: true
       REPO_DIR: .
-      BUILD_COMMIT: master
+      BUILD_COMMIT: ${{ github.ref }}
       PROJECT_SPEC: opencv-python
       MB_PYTHON_VERSION: ${{ matrix.python-version }}
       TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }}
@@ -50,29 +53,33 @@ jobs:
     - name: Cleanup
       run: find . -mindepth 1 -delete
       working-directory: ${{ github.workspace }}
+    - name: Setup environment
+      run: |
+        if [[ "${{ github.event.pull_request }}" == "true" ]]; then
+          echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV
+        elif [[ "${{ github.event_name }}" == "schedule" ]]; then
+          echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
+        fi
     - name: Checkout
-      uses: actions/checkout@v2
+      uses: actions/checkout@v3
       with:
         submodules: false
         fetch-depth: 0
-    - name: Update submodules
-      if: github.event_name == 'pull_request'
-      run: git submodule update --remote
     - name: Build a package
       run: source scripts/build.sh
     - name: Saving all wheels
-      uses: actions/upload-artifact@v2
+      uses: actions/upload-artifact@v3
       with:
         name: wheels
         path: wheelhouse/opencv*.whl
     - name: Saving a wheel accordingly to matrix
-      uses: actions/upload-artifact@v2
+      uses: actions/upload-artifact@v3
       with:
         name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
         path: wheelhouse/opencv*.whl
 
-  test:
-    needs: [build]
+  Test:
+    needs: [Build]
     runs-on: ubuntu-20.04
     defaults:
       run:
@@ -97,21 +104,21 @@ jobs:
       run: find . -mindepth 1 -delete
       working-directory: ${{ github.workspace }}
     - name: Checkout
-      uses: actions/checkout@v2
+      uses: actions/checkout@v3
       with:
         submodules: true
         fetch-depth: 0
     - name: Setup Environment variables
       run: if [ "3.10" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
     - name: Download a wheel accordingly to matrix
-      uses: actions/download-artifact@v2
+      uses: actions/download-artifact@v3
       with:
         name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
         path: wheelhouse/
     - name: Package installation and run tests
       run: source scripts/install.sh
 
-  build_sdist:
+  Build_sdist:
     runs-on: ubuntu-20.04
     defaults:
       run:
@@ -127,7 +134,7 @@ jobs:
     env:
       ACTIONS_ALLOW_UNSECURE_COMMANDS: true
       REPO_DIR: .
-      BUILD_COMMIT: master
+      BUILD_COMMIT: ${{ github.ref }}
       PROJECT_SPEC: opencv-python
       PLAT: x86_64
       MB_PYTHON_VERSION: ${{ matrix.python-version }}
@@ -142,20 +149,25 @@ jobs:
       SDIST: ${{ matrix.build_sdist || 0 }}
       ENABLE_HEADLESS: ${{ matrix.without_gui || 0 }}
       ENABLE_CONTRIB: ${{ matrix.with_contrib || 0 }}
+      ENABLE_ROLLING: 1
     steps:
     - name: Cleanup
       run: find . -mindepth 1 -delete
       working-directory: ${{ github.workspace }}
+    - name: Setup environment
+      run: |
+        if [[ "${{ github.event.pull_request }}" == "true" ]]; then
+          echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV
+        elif [[ "${{ github.event_name }}" == "schedule" ]]; then
+          echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
+        fi
     - name: Checkout
-      uses: actions/checkout@v2
+      uses: actions/checkout@v3
       with:
         submodules: false
         fetch-depth: 0
-    - name: Update submodules
-      if: github.event_name == 'pull_request'
-      run: git submodule update --remote
     - name: Set up Python ${{ matrix.python-version }}
-      uses: actions/setup-python@v2
+      uses: actions/setup-python@v4
       with:
         python-version: ${{ matrix.python-version }}
         architecture: ${{ matrix.platform }}
@@ -172,21 +184,51 @@ jobs:
         set -x
         echo "skipping tests because of sdist"
     - name: saving artifacts
-      uses: actions/upload-artifact@v2
+      uses: actions/upload-artifact@v3
       with:
         name: wheels
         path: dist/opencv*.tar.gz
 
-  test_release_opencv_python:
+  Release_rolling:
+    if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
+    needs: [Build, Build_sdist, Test]
+    runs-on: ubuntu-20.04
+    environment: opencv-python-rolling-release
+    defaults:
+      run:
+        shell: bash
+    steps:
+      - uses: actions/download-artifact@v3
+        with:
+          name: wheels
+          path: wheelhouse/
+      - name: Upload wheels for opencv_python_rolling
+        run: |
+          python -m pip install twine
+          python -m twine upload -u ${{ secrets.OPENCV_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_rolling-* wheelhouse/opencv-python-rolling-[^h]*
+      - name: Upload wheels for opencv_contrib_python_rolling
+        run: |
+          python -m pip install twine
+          python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_rolling-* wheelhouse/opencv-contrib-python-rolling-[^h]*
+      - name: Upload wheels for opencv_python_headless_rolling
+        run: |
+          python -m pip install twine
+          python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless_rolling-* wheelhouse/opencv-python-headless-rolling-*
+      - name: Upload wheels for opencv_contrib_python_headless_rolling
+        run: |
+          python -m pip install twine
+          python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless_rolling-* wheelhouse/opencv-contrib-python-headless-rolling-*
+
+  Pre-release:
     if: github.event_name == 'release' && github.event.release.prerelease
-    needs: [build, build_sdist, test]
+    needs: [Build, Build_sdist, Test]
     runs-on: ubuntu-20.04
     environment: test-opencv-python-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v2
+      - uses: actions/download-artifact@v3
         with:
           name: wheels
           path: wheelhouse/
@@ -195,16 +237,16 @@ jobs:
           python -m pip install twine
           python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/opencv_* wheelhouse/opencv-*
 
-  release_opencv_python:
+  Release:
     if: github.event_name == 'release' && !github.event.release.prerelease
-    needs: [build, build_sdist, test]
+    needs: [Build, Build_sdist, Test]
     runs-on: ubuntu-20.04
     environment: opencv-python-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v2
+      - uses: actions/download-artifact@v3
         with:
           name: wheels
           path: wheelhouse/
diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml
index 0a4dadbc..d2c5ea35 100644
--- a/.github/workflows/build_wheels_linux_arm.yml
+++ b/.github/workflows/build_wheels_linux_arm.yml
@@ -1,4 +1,4 @@
-name: Build PYPI wheels for opencv-python on Linux ARM
+name: Linux ARM64
 
 on:
   pull_request:
@@ -13,10 +13,13 @@ on:
       - '.github/workflows/build_wheels_macos*'
   release:
     types: [published, edited]
+  schedule:
+    - cron: '0 3 * * 6'
+  workflow_dispatch:
 
 
 jobs:
-  build_arm:
+  Build:
     runs-on: opencv-cn-lin-arm64
     defaults:
       run:
@@ -32,7 +35,7 @@ jobs:
     env:
       ACTIONS_ALLOW_UNSECURE_COMMANDS: true
       REPO_DIR: .
-      BUILD_COMMIT: master
+      BUILD_COMMIT: ${{ github.ref }}
       PROJECT_SPEC: opencv-python
       MB_PYTHON_VERSION: ${{ matrix.python-version }}
       TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }}
@@ -47,31 +50,36 @@ jobs:
       ENABLE_HEADLESS: ${{ matrix.without_gui }}
       ENABLE_CONTRIB: ${{ matrix.with_contrib }}
     steps:
-    - name: UID
-      run: id -u
     - name: Cleanup
       run: find . -mindepth 1 -delete
       working-directory: ${{ github.workspace }}
+    - name: Setup environment
+      run: |
+        if [[ "${{ github.event.pull_request }}" == "true" ]]; then
+          echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV
+        elif [[ "${{ github.event_name }}" == "schedule" ]]; then
+          echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
+        fi
     - name: Checkout
-      uses: actions/checkout@v2
+      uses: actions/checkout@v3
       with:
         submodules: false
         fetch-depth: 0
     - name: Build a package
       run: source scripts/build.sh
     - name: Saving all wheels
-      uses: actions/upload-artifact@v2
+      uses: actions/upload-artifact@v3
       with:
         name: wheels
         path: wheelhouse/opencv*.whl
     - name: Saving a wheel accordingly to matrix
-      uses: actions/upload-artifact@v2
+      uses: actions/upload-artifact@v3
       with:
         name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
         path: wheelhouse/opencv*.whl
 
-  test:
-    needs: [build_arm]
+  Test:
+    needs: [Build]
     runs-on: opencv-cn-lin-arm64
     defaults:
       run:
@@ -88,6 +96,7 @@ jobs:
       ACTIONS_ALLOW_UNSECURE_COMMANDS: true
       MB_PYTHON_VERSION: ${{ matrix.python-version }}
       PLAT: aarch64
+      BUILD_COMMIT: ${{ github.ref }}
       NP_TEST_DEP: numpy==1.19.4
       NP_TEST_DEP_LATEST: numpy==1.21.4
       CONFIG_PATH: travis_config.sh
@@ -97,31 +106,66 @@ jobs:
     - name: Cleanup
       run: find . -mindepth 1 -delete
       working-directory: ${{ github.workspace }}
+    - name: Setup environment
+      run: |
+        if [[ "${{ github.event.pull_request }}" == "true" ]]; then
+          echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV
+        fi
     - name: Checkout
-      uses: actions/checkout@v2
+      uses: actions/checkout@v3
       with:
         submodules: true
         fetch-depth: 0
     - name: Setup Environment variables
       run: if [ "3.10" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
     - name: Download a wheel accordingly to matrix
-      uses: actions/download-artifact@v2
+      uses: actions/download-artifact@v3
       with:
         name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
         path: wheelhouse/
     - name: Package installation and run tests
       run: source scripts/install.sh
 
-  test_release_opencv_python:
+  Release_rolling:
+    if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
+    needs: [Build, Test]
+    runs-on: ubuntu-20.04
+    environment: opencv-python-rolling-release
+    defaults:
+      run:
+        shell: bash
+    steps:
+      - uses: actions/download-artifact@v3
+        with:
+          name: wheels
+          path: wheelhouse/
+      - name: Upload wheels for opencv_python_rolling
+        run: |
+          python -m pip install twine
+          python -m twine upload -u ${{ secrets.OPENCV_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_rolling-*
+      - name: Upload wheels for opencv_contrib_python_rolling
+        run: |
+          python -m pip install twine
+          python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_rolling-*
+      - name: Upload wheels for opencv_python_headless_rolling
+        run: |
+          python -m pip install twine
+          python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless_rolling-*
+      - name: Upload wheels for opencv_contrib_python_headless_rolling
+        run: |
+          python -m pip install twine
+          python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless_rolling-*
+
+  Pre-release:
     if: github.event_name == 'release' && github.event.release.prerelease
-    needs: [build_arm, test]
+    needs: [Build, Test]
     runs-on: ubuntu-20.04
     environment: test-opencv-python-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v2
+      - uses: actions/download-artifact@v3
         with:
           name: wheels
           path: wheelhouse/
@@ -130,16 +174,16 @@ jobs:
           python -m pip install twine
           python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/opencv_*
 
-  release_opencv_python:
+  Release:
     if: github.event_name == 'release' && !github.event.release.prerelease
-    needs: [build_arm, test]
+    needs: [Build, Test]
     runs-on: ubuntu-20.04
     environment: opencv-python-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v2
+      - uses: actions/download-artifact@v3
         with:
           name: wheels
           path: wheelhouse/
diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml
index 438373bb..5b110fb7 100644
--- a/.github/workflows/build_wheels_macos.yml
+++ b/.github/workflows/build_wheels_macos.yml
@@ -1,4 +1,4 @@
-name: Build PYPI wheels for opencv-python on Macos
+name: macOS x86_64
 
 on:
   pull_request:
@@ -13,10 +13,13 @@ on:
       - '.github/workflows/build_wheels_macos_m1.yml'
   release:
     types: [published, edited]
+  schedule:
+    - cron: '0 3 * * 6'
+  workflow_dispatch:
 
 
 jobs:
-  build:
+  Build:
     runs-on: ${{ matrix.os }}
     defaults:
       run:
@@ -44,7 +47,7 @@ jobs:
     env:
       ACTIONS_ALLOW_UNSECURE_COMMANDS: true
       REPO_DIR: .
-      BUILD_COMMIT: master
+      BUILD_COMMIT: ${{ github.ref }}
       PROJECT_SPEC: opencv-python
       MB_PYTHON_VERSION: ${{ matrix.python-version }}
       TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }}
@@ -52,7 +55,6 @@ jobs:
       TRAVIS_BUILD_DIR: ${{ github.workspace }}
       TRAVIS_OS_NAME: osx
       CONFIG_PATH: travis_config.sh
-      DOCKER_IMAGE: quay.io/asenyaev/manylinux2014_${PLAT}
       USE_CCACHE: 1
       UNICODE_WIDTH: 32
       PLAT: x86_64
@@ -64,14 +66,18 @@ jobs:
     - name: Cleanup
       run: find . -mindepth 1 -delete
       working-directory: ${{ github.workspace }}
+    - name: Setup environment
+      run: |
+        if [[ "${{ github.event.pull_request }}" == "true" ]]; then
+          echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV
+        elif [[ "${{ github.event_name }}" == "schedule" ]]; then
+          echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
+        fi
     - name: Checkout
-      uses: actions/checkout@v2
+      uses: actions/checkout@v3
       with:
         submodules: false
         fetch-depth: 0
-    - name: Update submodules
-      if: github.event_name == 'pull_request'
-      run: git submodule update --remote
     - name: Build a package
       run: |
         set -e
@@ -90,18 +96,18 @@ jobs:
         set -x
         build_wheel $REPO_DIR $PLAT
     - name: Saving all wheels
-      uses: actions/upload-artifact@v2
+      uses: actions/upload-artifact@v3
       with:
         name: wheels
         path: wheelhouse/opencv*.whl
     - name: Saving a wheel accordingly to matrix
-      uses: actions/upload-artifact@v2
+      uses: actions/upload-artifact@v3
       with:
         name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
         path: wheelhouse/opencv*.whl
 
-  test:
-    needs: [build]
+  Test:
+    needs: [Build]
     runs-on: ${{ matrix.os }}
     defaults:
       run:
@@ -140,19 +146,19 @@ jobs:
       run: find . -mindepth 1 -delete
       working-directory: ${{ github.workspace }}
     - name: Checkout
-      uses: actions/checkout@v2
+      uses: actions/checkout@v3
       with:
         submodules: true
         fetch-depth: 0
     - name: Set up Python ${{ matrix.python-version }}
-      uses: actions/setup-python@v2
+      uses: actions/setup-python@v4
       with:
         python-version: ${{ matrix.python-version }}
         architecture: ${{ matrix.platform }}
     - name: Setup Environment variables
       run: if [ "3.10" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
     - name: Download a wheel accordingly to matrix
-      uses: actions/download-artifact@v2
+      uses: actions/download-artifact@v3
       with:
         name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
         path: wheelhouse/
@@ -171,16 +177,46 @@ jobs:
         cd ${{ github.workspace }}/tests
         python -m pylint $PYLINT_TEST_FILE
 
-  test_release_opencv_python:
+  Release_rolling:
+    if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
+    needs: [Build, Test]
+    runs-on: ubuntu-20.04
+    environment: opencv-python-rolling-release
+    defaults:
+      run:
+        shell: bash
+    steps:
+      - uses: actions/download-artifact@v3
+        with:
+          name: wheels
+          path: wheelhouse/
+      - name: Upload wheels for opencv_python_rolling
+        run: |
+          python -m pip install twine
+          python -m twine upload -u ${{ secrets.OPENCV_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_rolling-*
+      - name: Upload wheels for opencv_contrib_python_rolling
+        run: |
+          python -m pip install twine
+          python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_rolling-*
+      - name: Upload wheels for opencv_python_headless_rolling
+        run: |
+          python -m pip install twine
+          python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless_rolling-*
+      - name: Upload wheels for opencv_contrib_python_headless_rolling
+        run: |
+          python -m pip install twine
+          python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless_rolling-*
+
+  Pre-release:
     if: github.event_name == 'release' && github.event.release.prerelease
-    needs: [build, test]
+    needs: [Build, Test]
     runs-on: ubuntu-20.04
     environment: test-opencv-python-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v2
+      - uses: actions/download-artifact@v3
         with:
           name: wheels
           path: wheelhouse/
@@ -189,16 +225,16 @@ jobs:
           python -m pip install twine
           python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/opencv_*
 
-  release_opencv_python:
+  Release:
     if: github.event_name == 'release' && !github.event.release.prerelease
-    needs: [build, test]
+    needs: [Build, Test]
     runs-on: ubuntu-20.04
     environment: opencv-python-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v2
+      - uses: actions/download-artifact@v3
         with:
           name: wheels
           path: wheelhouse/
diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml
index 134d5450..91d70ff3 100644
--- a/.github/workflows/build_wheels_macos_m1.yml
+++ b/.github/workflows/build_wheels_macos_m1.yml
@@ -1,4 +1,4 @@
-name: Build PYPI wheels for opencv-python on Macos M1
+name: macOS ARM64
 
 on:
   pull_request:
@@ -13,10 +13,13 @@ on:
       - '.github/workflows/build_wheels_macos.yml'
   release:
     types: [published, edited]
+  schedule:
+    - cron: '0 3 * * 6'
+  workflow_dispatch:
 
 
 jobs:
-  build:
+  Build:
     runs-on: opencv-cn-mac-arm64
     strategy:
       fail-fast: false
@@ -27,6 +30,7 @@ jobs:
         without_gui: [0, 1]
         build_sdist: [0]
     env:
+      BUILD_COMMIT: ${{ github.ref }}
       CI_BUILD: 1
       SDIST: ${{ matrix.build_sdist || 0 }}
       ENABLE_HEADLESS: ${{ matrix.without_gui }}
@@ -35,14 +39,18 @@ jobs:
     - name: Cleanup
       run: find . -mindepth 1 -delete
       working-directory: ${{ github.workspace }}
+    - name: Setup environment
+      run: |
+        if [[ "${{ github.event.pull_request }}" == "true" ]]; then
+          echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV
+        elif [[ "${{ github.event_name }}" == "schedule" ]]; then
+          echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
+        fi
     - name: Checkout
-      uses: actions/checkout@v2
+      uses: actions/checkout@v3
       with:
         submodules: false
         fetch-depth: 0
-    - name: Update submodules
-      if: github.event_name == 'pull_request'
-      run: git submodule update --remote
     - name: Build a package
       run: |
         git submodule update --init multibuild
@@ -53,18 +61,18 @@ jobs:
         arch -arm64 python${{ matrix.python-version }} setup.py bdist_wheel --py-limited-api=cp37 --dist-dir=wheelhouse -v
         delocate-wheel ${{ github.workspace }}/wheelhouse/opencv*
     - name: Saving all wheels
-      uses: actions/upload-artifact@v2
+      uses: actions/upload-artifact@v3
       with:
         name: wheels
         path: wheelhouse/opencv*.whl
     - name: Saving a wheel accordingly to matrix
-      uses: actions/upload-artifact@v2
+      uses: actions/upload-artifact@v3
       with:
         name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
         path: wheelhouse/opencv*.whl
 
-  test:
-    needs: [build]
+  Test:
+    needs: [Build]
     runs-on: opencv-cn-mac-arm64-tests
     strategy:
       fail-fast: false
@@ -75,19 +83,25 @@ jobs:
         without_gui: [0, 1]
         build_sdist: [0]
     env:
+      BUILD_COMMIT: ${{ github.ref }}
       OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata
       PYLINT_TEST_FILE: ${{ github.workspace }}/opencv/samples/python/squares.py
     steps:
     - name: Cleanup
       run: find . -mindepth 1 -delete
       working-directory: ${{ github.workspace }}
+    - name: Setup environment
+      run: |
+        if [[ "${{ github.event.pull_request }}" == "true" ]]; then
+          echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV
+        fi
     - name: Checkout
-      uses: actions/checkout@v2
+      uses: actions/checkout@v3
       with:
         submodules: true
         fetch-depth: 0
     - name: Download a wheel accordingly to matrix
-      uses: actions/download-artifact@v2
+      uses: actions/download-artifact@v3
       with:
         name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
         path: wheelhouse/
@@ -106,35 +120,64 @@ jobs:
         cd ${{ github.workspace }}/tests
         arch -arm64 python${{ matrix.python-version }} -m pylint $PYLINT_TEST_FILE
 
-  test_release_opencv_python:
+  Release_rolling:
+    if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
+    needs: [Build, Test]
+    runs-on: ubuntu-20.04
+    environment: opencv-python-rolling-release
+    defaults:
+      run:
+        shell: bash
+    steps:
+      - uses: actions/download-artifact@v3
+        with:
+          name: wheels
+          path: wheelhouse/
+      - name: Upload wheels for opencv_python_rolling
+        run: |
+          python -m pip install twine
+          python -m twine upload -u ${{ secrets.OPENCV_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_rolling-*
+      - name: Upload wheels for opencv_contrib_python_rolling
+        run: |
+          python -m pip install twine
+          python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_rolling-*
+      - name: Upload wheels for opencv_python_headless_rolling
+        run: |
+          python -m pip install twine
+          python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless_rolling-*
+      - name: Upload wheels for opencv_contrib_python_headless_rolling
+        run: |
+          python -m pip install twine
+          python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless_rolling-*
+
+  Pre-release:
     if: github.event_name == 'release' && github.event.release.prerelease
-    needs: [build, test]
+    needs: [Build, Test]
     runs-on: ubuntu-20.04
     environment: test-opencv-python-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v2
+      - uses: actions/download-artifact@v3
         with:
           name: wheels
           path: wheelhouse/
-
       - name: Upload all wheels
         run: |
           python -m pip install twine
           python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/opencv_*
 
-  release_opencv_python:
+  Release:
     if: github.event_name == 'release' && !github.event.release.prerelease
-    needs: [build, test]
+    needs: [Build, Test]
     runs-on: ubuntu-20.04
     environment: opencv-python-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v2
+      - uses: actions/download-artifact@v3
         with:
           name: wheels
           path: wheelhouse/
diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index f7d2c408..f8970768 100644
--- a/.github/workflows/build_wheels_windows.yml
+++ b/.github/workflows/build_wheels_windows.yml
@@ -1,4 +1,4 @@
-name: Build PYPI wheels for opencv-python on Windows
+name: Windows x86_64
 
 on:
   pull_request:
@@ -12,10 +12,13 @@ on:
       - '.github/workflows/build_wheels_macos*'
   release:
     types: [published, edited]
+  schedule:
+    - cron: '0 3 * * 6'
+  workflow_dispatch:
 
 
 jobs:
-  build-windows-x86_64:
+  Build:
     runs-on: windows-2019
     strategy:
       fail-fast: false
@@ -38,16 +41,19 @@ jobs:
         rm -rf ./* || true
         rm -rf ./.??* || true
       working-directory: ${{ github.workspace }}
+    - name: Setup environment
+      shell: bash
+      run: |
+        if [[ "${{ github.event_name }}" == "schedule" ]]; then
+          echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
+        fi
     - name: Checkout
-      uses: actions/checkout@v2
+      uses: actions/checkout@v3
       with:
         submodules: false
         fetch-depth: 0
-    - name: Update submodules
-      if: github.event_name == 'pull_request'
-      run: git submodule update --remote
     - name: Set up Python ${{ matrix.python-version }}
-      uses: actions/setup-python@v2
+      uses: actions/setup-python@v4
       with:
         python-version: ${{ matrix.python-version }}
         architecture: ${{ matrix.platform }}
@@ -62,18 +68,18 @@ jobs:
         set "CI_BUILD=1" && python setup.py bdist_wheel --py-limited-api=cp36 --dist-dir=%cd%\wheelhouse -v
       shell: cmd
     - name: Saving all wheels
-      uses: actions/upload-artifact@v2
+      uses: actions/upload-artifact@v3
       with:
         name: wheels
         path: wheelhouse/opencv*.whl
     - name: Saving a wheel accordingly to matrix
-      uses: actions/upload-artifact@v2
+      uses: actions/upload-artifact@v3
       with:
         name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}
         path: wheelhouse/opencv*
 
-  test:
-    needs: [build-windows-x86_64]
+  Test:
+    needs: [Build]
     runs-on: windows-2019
     defaults:
       run:
@@ -98,17 +104,17 @@ jobs:
         rm -rf ./.??* || true
       working-directory: ${{ github.workspace }}
     - name: Checkout
-      uses: actions/checkout@v2
+      uses: actions/checkout@v3
       with:
         submodules: true
         fetch-depth: 0
     - name: Set up Python ${{ matrix.python-version }}
-      uses: actions/setup-python@v2
+      uses: actions/setup-python@v4
       with:
         python-version: ${{ matrix.python-version }}
         architecture: ${{ matrix.platform }}
     - name: Download a wheel accordingly to matrix
-      uses: actions/download-artifact@v2
+      uses: actions/download-artifact@v3
       with:
         name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}
         path: wheelhouse/
@@ -129,16 +135,46 @@ jobs:
         cd ${{ github.workspace }}\tests
         python -m pylint $PYLINT_TEST_FILE
 
-  test_release_opencv_python:
+  Release_rolling:
+    if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
+    needs: [Build, Test]
+    runs-on: ubuntu-20.04
+    environment: opencv-python-rolling-release
+    defaults:
+      run:
+        shell: bash
+    steps:
+      - uses: actions/download-artifact@v3
+        with:
+          name: wheels
+          path: wheelhouse/
+      - name: Upload wheels for opencv_python_rolling
+        run: |
+          python -m pip install twine
+          python -m twine upload -u ${{ secrets.OPENCV_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_rolling-*
+      - name: Upload wheels for opencv_contrib_python_rolling
+        run: |
+          python -m pip install twine
+          python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_rolling-*
+      - name: Upload wheels for opencv_python_headless_rolling
+        run: |
+          python -m pip install twine
+          python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless_rolling-*
+      - name: Upload wheels for opencv_contrib_python_headless_rolling
+        run: |
+          python -m pip install twine
+          python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless_rolling-*
+
+  Pre-release:
     if: github.event_name == 'release' && github.event.release.prerelease
-    needs: [build-windows-x86_64, test]
+    needs: [Build, Test]
     runs-on: ubuntu-20.04
     environment: test-opencv-python-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v2
+      - uses: actions/download-artifact@v3
         with:
           name: wheels
           path: wheelhouse/
@@ -147,16 +183,16 @@ jobs:
           python -m pip install twine
           python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/opencv_*
 
-  release_opencv_python:
+  Release:
     if: github.event_name == 'release' && !github.event.release.prerelease
-    needs: [build-windows-x86_64, test]
+    needs: [Build, Test]
     runs-on: ubuntu-20.04
     environment: opencv-python-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v2
+      - uses: actions/download-artifact@v3
         with:
           name: wheels
           path: wheelhouse/
diff --git a/find_version.py b/find_version.py
index 6c676b23..274c93e6 100644
--- a/find_version.py
+++ b/find_version.py
@@ -1,11 +1,12 @@
 import sys
-import os
 import subprocess
+from datetime import date
 
 if __name__ == "__main__":
     contrib = sys.argv[1]
     headless = sys.argv[2]
-    ci_build = sys.argv[3]
+    rolling = sys.argv[3]
+    ci_build = sys.argv[4]
 
     opencv_version = ""
     # dig out the version from OpenCV sources
@@ -56,13 +57,19 @@
         # tag identifies the build and should be a sequential revision number
         version = tag[0]
         opencv_version += ".{}".format(version)
+    # rolling has converted into string using get_and_set_info() function in setup.py
+    elif rolling == "True":
+        # rolling version identifier, will be published in a dedicated rolling PyPI repository
+        version = date.today().strftime('%Y%m%d')
+        opencv_version += ".{}".format(version)
     else:
         # local version identifier, not to be published on PyPI
         version = git_hash
-        opencv_version += "+{}".format(version)
+        opencv_version += ".{}".format(version)
 
     with open("cv2/version.py", "w") as f:
         f.write('opencv_version = "{}"\n'.format(opencv_version))
         f.write("contrib = {}\n".format(contrib))
         f.write("headless = {}\n".format(headless))
+        f.write("rolling = {}\n".format(rolling))
         f.write("ci_build = {}".format(ci_build))
diff --git a/scripts/build.sh b/scripts/build.sh
index f48ca066..e5c83d83 100755
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -13,5 +13,6 @@ source multibuild/travis_steps.sh
 # source travis_multibuild_customize.sh
 echo $ENABLE_CONTRIB > contrib.enabled
 echo $ENABLE_HEADLESS > headless.enabled
+echo $ENABLE_ROLLING > rolling.enabled
 set -x
 build_wheel $REPO_DIR $PLAT
diff --git a/scripts/install.sh b/scripts/install.sh
index 6e019d1c..f20080ae 100755
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -13,6 +13,7 @@ source multibuild/travis_steps.sh
 # source travis_multibuild_customize.sh
 echo $ENABLE_CONTRIB > contrib.enabled
 echo $ENABLE_HEADLESS > headless.enabled
+echo $ENABLE_ROLLING > rolling.enabled
 set -x
 install_run $PLAT
 set +x
diff --git a/setup.py b/setup.py
index 3a1a7cfd..9b937e59 100644
--- a/setup.py
+++ b/setup.py
@@ -21,6 +21,7 @@ def main():
     build_contrib = get_build_env_var_by_name("contrib")
     build_headless = get_build_env_var_by_name("headless")
     build_java = "ON" if get_build_env_var_by_name("java") else "OFF"
+    build_rolling = get_build_env_var_by_name("rolling")
 
     install_requires = [
         'numpy>=1.13.3; python_version<"3.7"',
@@ -46,17 +47,28 @@ def main():
         g = git.Git()  # NOTE: pip API's are internal, this has to be refactored
 
         g.run_command(["submodule", "sync"])
-        g.run_command(
-            ["submodule", "update", "--init", "--recursive", cmake_source_dir]
-        )
 
-        if build_contrib:
+        if build_rolling:
+            g.run_command(
+                ["submodule", "update", "--init", "--recursive", "--remote", cmake_source_dir]
+            )
+
+            if build_contrib:
+                g.run_command(
+                    ["submodule", "update", "--init", "--recursive", "--remote", "opencv_contrib"]
+                )
+        else:
             g.run_command(
-                ["submodule", "update", "--init", "--recursive", "opencv_contrib"]
+                ["submodule", "update", "--init", "--recursive", cmake_source_dir]
             )
 
-    package_version, build_contrib, build_headless = get_and_set_info(
-        build_contrib, build_headless, is_CI_build
+            if build_contrib:
+                g.run_command(
+                    ["submodule", "update", "--init", "--recursive", "opencv_contrib"]
+                )
+
+    package_version, build_contrib, build_headless, build_rolling = get_and_set_info(
+        build_contrib, build_headless, build_rolling, is_CI_build
     )
 
     # https://stackoverflow.com/questions/1405913/python-32bit-or-64bit-mode
@@ -73,6 +85,9 @@ def main():
     if build_headless and not build_contrib:
         package_name = "opencv-python-headless"
 
+    if build_rolling:
+        package_name += "-rolling"
+
     long_description = io.open("README.md", encoding="utf-8").read()
 
     packages = ["cv2", "cv2.data"]
@@ -245,14 +260,14 @@ def main():
     skbuild.setup(
         name=package_name,
         version=package_version,
-        url="https://github.com/skvark/opencv-python",
+        url="https://github.com/opencv/opencv-python",
         license="MIT",
         description="Wrapper package for OpenCV python bindings.",
         long_description=long_description,
         long_description_content_type="text/markdown",
         packages=packages,
         package_data=package_data,
-        maintainer="Olli-Pekka Heinisuo",
+        maintainer="OpenCV Team",
         ext_modules=EmptyListWithLength(),
         install_requires=install_requires,
         python_requires=">=3.6",
@@ -446,7 +461,7 @@ def _classify_installed_files_override(
         )
 
 
-def get_and_set_info(contrib, headless, ci_build):
+def get_and_set_info(contrib, headless, rolling, ci_build):
     # cv2/version.py should be generated by running find_version.py
     version = {}
     here = os.path.abspath(os.path.dirname(__file__))
@@ -456,14 +471,14 @@ def get_and_set_info(contrib, headless, ci_build):
     # (in sdists the version.py file already exists)
     if os.path.exists(".git"):
         old_args = sys.argv.copy()
-        sys.argv = ["", str(contrib), str(headless), str(ci_build)]
+        sys.argv = ["", str(contrib), str(headless), str(rolling), str(ci_build)]
         runpy.run_path("find_version.py", run_name="__main__")
         sys.argv = old_args
 
     with open(version_file) as fp:
         exec(fp.read(), version)
 
-    return version["opencv_version"], version["contrib"], version["headless"]
+    return version["opencv_version"], version["contrib"], version["headless"], version["rolling"]
 
 
 def get_build_env_var_by_name(flag_name):

From f9c40212eb060f5b56a7545b2dbaea2fa62a94b3 Mon Sep 17 00:00:00 2001
From: Andrey Senyaev <76472231+asenyaev@users.noreply.github.com>
Date: Fri, 5 Aug 2022 18:43:33 +0300
Subject: [PATCH 05/59] macOS x86_64 runner change to macos-11 (#701)

---
 .github/workflows/build_wheels_macos.yml | 29 +++---------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml
index 5b110fb7..adc3724d 100644
--- a/.github/workflows/build_wheels_macos.yml
+++ b/.github/workflows/build_wheels_macos.yml
@@ -20,30 +20,18 @@ on:
 
 jobs:
   Build:
-    runs-on: ${{ matrix.os }}
+    runs-on: macos-11
     defaults:
       run:
         shell: bash
     strategy:
       fail-fast: false
       matrix:
-        os: [macos-10.15, macos-11]
         python-version: ['3.6']
         platform: [x64]
         with_contrib: [0, 1]
         without_gui: [0, 1]
         build_sdist: [0]
-        exclude:
-          - os: macos-10.15
-            python-version: '3.10'
-          - os: macos-11
-            python-version: '3.6'
-          - os: macos-11
-            python-version: '3.7'
-          - os: macos-11
-            python-version: '3.8'
-          - os: macos-11
-            python-version: '3.9'
     env:
       ACTIONS_ALLOW_UNSECURE_COMMANDS: true
       REPO_DIR: .
@@ -62,6 +50,7 @@ jobs:
       SDIST: ${{ matrix.build_sdist || 0 }}
       ENABLE_HEADLESS: ${{ matrix.without_gui }}
       ENABLE_CONTRIB: ${{ matrix.with_contrib }}
+      MACOSX_DEPLOYMENT_TARGET: 10.15
     steps:
     - name: Cleanup
       run: find . -mindepth 1 -delete
@@ -108,30 +97,18 @@ jobs:
 
   Test:
     needs: [Build]
-    runs-on: ${{ matrix.os }}
+    runs-on: macos-11
     defaults:
       run:
         shell: bash
     strategy:
       fail-fast: false
       matrix:
-        os: [macos-10.15, macos-11]
         python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
         platform: [x64]
         with_contrib: [0, 1]
         without_gui: [0, 1]
         build_sdist: [0]
-        exclude:
-          - os: macos-10.15
-            python-version: '3.10'
-          - os: macos-11
-            python-version: '3.6'
-          - os: macos-11
-            python-version: '3.7'
-          - os: macos-11
-            python-version: '3.8'
-          - os: macos-11
-            python-version: '3.9'
     env:
       ACTIONS_ALLOW_UNSECURE_COMMANDS: true
       MB_PYTHON_VERSION: ${{ matrix.python-version }}

From 710c89ec0263f0a1fa882dd66891a11e46ff4e46 Mon Sep 17 00:00:00 2001
From: Andrey Senyaev <76472231+asenyaev@users.noreply.github.com>
Date: Sun, 21 Aug 2022 13:07:50 +0300
Subject: [PATCH 06/59] Adapted rolling releases to workflow_dispatch event
 (#709)

---
 .github/workflows/build_wheels_linux.yml     | 7 ++++---
 .github/workflows/build_wheels_linux_arm.yml | 3 ++-
 .github/workflows/build_wheels_macos.yml     | 3 ++-
 .github/workflows/build_wheels_macos_m1.yml  | 3 ++-
 .github/workflows/build_wheels_windows.yml   | 2 +-
 5 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml
index a0933da5..5a09e933 100644
--- a/.github/workflows/build_wheels_linux.yml
+++ b/.github/workflows/build_wheels_linux.yml
@@ -57,7 +57,8 @@ jobs:
       run: |
         if [[ "${{ github.event.pull_request }}" == "true" ]]; then
           echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV
-        elif [[ "${{ github.event_name }}" == "schedule" ]]; then
+        fi
+        if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
           echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
         fi
     - name: Checkout
@@ -149,7 +150,6 @@ jobs:
       SDIST: ${{ matrix.build_sdist || 0 }}
       ENABLE_HEADLESS: ${{ matrix.without_gui || 0 }}
       ENABLE_CONTRIB: ${{ matrix.with_contrib || 0 }}
-      ENABLE_ROLLING: 1
     steps:
     - name: Cleanup
       run: find . -mindepth 1 -delete
@@ -158,7 +158,8 @@ jobs:
       run: |
         if [[ "${{ github.event.pull_request }}" == "true" ]]; then
           echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV
-        elif [[ "${{ github.event_name }}" == "schedule" ]]; then
+        fi
+        if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
           echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
         fi
     - name: Checkout
diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml
index d2c5ea35..c6b9b4c5 100644
--- a/.github/workflows/build_wheels_linux_arm.yml
+++ b/.github/workflows/build_wheels_linux_arm.yml
@@ -57,7 +57,8 @@ jobs:
       run: |
         if [[ "${{ github.event.pull_request }}" == "true" ]]; then
           echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV
-        elif [[ "${{ github.event_name }}" == "schedule" ]]; then
+        fi
+        if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
           echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
         fi
     - name: Checkout
diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml
index adc3724d..1ac459cd 100644
--- a/.github/workflows/build_wheels_macos.yml
+++ b/.github/workflows/build_wheels_macos.yml
@@ -59,7 +59,8 @@ jobs:
       run: |
         if [[ "${{ github.event.pull_request }}" == "true" ]]; then
           echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV
-        elif [[ "${{ github.event_name }}" == "schedule" ]]; then
+        fi
+        if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
           echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
         fi
     - name: Checkout
diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml
index 91d70ff3..3d8f9b62 100644
--- a/.github/workflows/build_wheels_macos_m1.yml
+++ b/.github/workflows/build_wheels_macos_m1.yml
@@ -43,7 +43,8 @@ jobs:
       run: |
         if [[ "${{ github.event.pull_request }}" == "true" ]]; then
           echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV
-        elif [[ "${{ github.event_name }}" == "schedule" ]]; then
+        fi
+        if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
           echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
         fi
     - name: Checkout
diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index f8970768..e6874ffe 100644
--- a/.github/workflows/build_wheels_windows.yml
+++ b/.github/workflows/build_wheels_windows.yml
@@ -44,7 +44,7 @@ jobs:
     - name: Setup environment
       shell: bash
       run: |
-        if [[ "${{ github.event_name }}" == "schedule" ]]; then
+        if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
           echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
         fi
     - name: Checkout

From c9a96a60fc0bc25272f48ad27b48a985a547bd0f Mon Sep 17 00:00:00 2001
From: Andrey Senyaev <76472231+asenyaev@users.noreply.github.com>
Date: Sun, 21 Aug 2022 17:51:26 +0300
Subject: [PATCH 07/59] Defined 5.x branch for submodules (#710)

---
 .gitmodules | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/.gitmodules b/.gitmodules
index 7193d3b9..99476363 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,12 +1,15 @@
 [submodule "opencv"]
 	path = opencv
 	url = https://github.com/opencv/opencv.git
+	branch = 5.x
 [submodule "opencv_contrib"]
 	path = opencv_contrib
 	url = https://github.com/opencv/opencv_contrib.git
+	branch = 5.x
 [submodule "multibuild"]
 	path = multibuild
 	url = https://github.com/multi-build/multibuild.git
 [submodule "opencv_extra"]
 	path = opencv_extra
 	url = https://github.com/opencv/opencv_extra.git
+	branch = 5.x

From ebd7b5aa14ac79dfc650370ed200e31a2a8aa045 Mon Sep 17 00:00:00 2001
From: Andrey Senyaev <76472231+asenyaev@users.noreply.github.com>
Date: Mon, 22 Aug 2022 13:37:19 +0300
Subject: [PATCH 08/59] Remove source packages for rolling packages (#712)

---
 .github/workflows/build_wheels_linux.yml | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml
index 5a09e933..a8cdd34e 100644
--- a/.github/workflows/build_wheels_linux.yml
+++ b/.github/workflows/build_wheels_linux.yml
@@ -192,7 +192,7 @@ jobs:
 
   Release_rolling:
     if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
-    needs: [Build, Build_sdist, Test]
+    needs: [Build, Test]
     runs-on: ubuntu-20.04
     environment: opencv-python-rolling-release
     defaults:
@@ -206,19 +206,19 @@ jobs:
       - name: Upload wheels for opencv_python_rolling
         run: |
           python -m pip install twine
-          python -m twine upload -u ${{ secrets.OPENCV_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_rolling-* wheelhouse/opencv-python-rolling-[^h]*
+          python -m twine upload -u ${{ secrets.OPENCV_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_rolling-*
       - name: Upload wheels for opencv_contrib_python_rolling
         run: |
           python -m pip install twine
-          python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_rolling-* wheelhouse/opencv-contrib-python-rolling-[^h]*
+          python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_rolling-*
       - name: Upload wheels for opencv_python_headless_rolling
         run: |
           python -m pip install twine
-          python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless_rolling-* wheelhouse/opencv-python-headless-rolling-*
+          python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless_rolling-*
       - name: Upload wheels for opencv_contrib_python_headless_rolling
         run: |
           python -m pip install twine
-          python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless_rolling-* wheelhouse/opencv-contrib-python-headless-rolling-*
+          python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless_rolling-*
 
   Pre-release:
     if: github.event_name == 'release' && github.event.release.prerelease

From ec5c8b55b61cbc18d2e38cf7ac260dc72f15b516 Mon Sep 17 00:00:00 2001
From: Andrey Senyaev <76472231+asenyaev@users.noreply.github.com>
Date: Mon, 29 Aug 2022 09:34:59 +0300
Subject: [PATCH 09/59] Build zlib from the source on Linux with the latest
 version (#715) (#718)

* Added zlib build from the source on Linux, handling auditwheel issues

* Removed unused variable

* Removed bzip2 from dependencies for OpenCV Python packages
---
 .github/workflows/build_wheels_linux.yml     | 10 +----
 .github/workflows/build_wheels_linux_arm.yml | 12 +-----
 .github/workflows/build_wheels_macos.yml     |  4 --
 .github/workflows/build_wheels_macos_m1.yml  | 10 -----
 docker/manylinux2014/Dockerfile_aarch64      | 29 +++++++++-----
 docker/manylinux2014/Dockerfile_x86_64       | 29 +++++++++-----
 patch_auditwheel_whitelist.py                | 40 ++++++++++++++++----
 7 files changed, 75 insertions(+), 59 deletions(-)

diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml
index a8cdd34e..ab377325 100644
--- a/.github/workflows/build_wheels_linux.yml
+++ b/.github/workflows/build_wheels_linux.yml
@@ -35,14 +35,13 @@ jobs:
     env:
       ACTIONS_ALLOW_UNSECURE_COMMANDS: true
       REPO_DIR: .
-      BUILD_COMMIT: ${{ github.ref }}
       PROJECT_SPEC: opencv-python
       MB_PYTHON_VERSION: ${{ matrix.python-version }}
       TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }}
       MB_ML_VER: 2014
       TRAVIS_BUILD_DIR: ${{ github.workspace }}
       CONFIG_PATH: travis_config.sh
-      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20220628
+      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20220824
       USE_CCACHE: 0
       UNICODE_WIDTH: 32
       PLAT: x86_64
@@ -55,9 +54,6 @@ jobs:
       working-directory: ${{ github.workspace }}
     - name: Setup environment
       run: |
-        if [[ "${{ github.event.pull_request }}" == "true" ]]; then
-          echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV
-        fi
         if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
           echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
         fi
@@ -135,7 +131,6 @@ jobs:
     env:
       ACTIONS_ALLOW_UNSECURE_COMMANDS: true
       REPO_DIR: .
-      BUILD_COMMIT: ${{ github.ref }}
       PROJECT_SPEC: opencv-python
       PLAT: x86_64
       MB_PYTHON_VERSION: ${{ matrix.python-version }}
@@ -156,9 +151,6 @@ jobs:
       working-directory: ${{ github.workspace }}
     - name: Setup environment
       run: |
-        if [[ "${{ github.event.pull_request }}" == "true" ]]; then
-          echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV
-        fi
         if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
           echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
         fi
diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml
index c6b9b4c5..079efbe1 100644
--- a/.github/workflows/build_wheels_linux_arm.yml
+++ b/.github/workflows/build_wheels_linux_arm.yml
@@ -35,7 +35,6 @@ jobs:
     env:
       ACTIONS_ALLOW_UNSECURE_COMMANDS: true
       REPO_DIR: .
-      BUILD_COMMIT: ${{ github.ref }}
       PROJECT_SPEC: opencv-python
       MB_PYTHON_VERSION: ${{ matrix.python-version }}
       TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }}
@@ -43,7 +42,7 @@ jobs:
       MB_ML_VER: 2014
       TRAVIS_BUILD_DIR: ${{ github.workspace }}
       CONFIG_PATH: travis_config.sh
-      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64:20220628
+      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64:20220824
       USE_CCACHE: 0
       UNICODE_WIDTH: 32
       SDIST: ${{ matrix.build_sdist || 0 }}
@@ -55,9 +54,6 @@ jobs:
       working-directory: ${{ github.workspace }}
     - name: Setup environment
       run: |
-        if [[ "${{ github.event.pull_request }}" == "true" ]]; then
-          echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV
-        fi
         if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
           echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
         fi
@@ -97,7 +93,6 @@ jobs:
       ACTIONS_ALLOW_UNSECURE_COMMANDS: true
       MB_PYTHON_VERSION: ${{ matrix.python-version }}
       PLAT: aarch64
-      BUILD_COMMIT: ${{ github.ref }}
       NP_TEST_DEP: numpy==1.19.4
       NP_TEST_DEP_LATEST: numpy==1.21.4
       CONFIG_PATH: travis_config.sh
@@ -107,11 +102,6 @@ jobs:
     - name: Cleanup
       run: find . -mindepth 1 -delete
       working-directory: ${{ github.workspace }}
-    - name: Setup environment
-      run: |
-        if [[ "${{ github.event.pull_request }}" == "true" ]]; then
-          echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV
-        fi
     - name: Checkout
       uses: actions/checkout@v3
       with:
diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml
index 1ac459cd..1c2a1614 100644
--- a/.github/workflows/build_wheels_macos.yml
+++ b/.github/workflows/build_wheels_macos.yml
@@ -35,7 +35,6 @@ jobs:
     env:
       ACTIONS_ALLOW_UNSECURE_COMMANDS: true
       REPO_DIR: .
-      BUILD_COMMIT: ${{ github.ref }}
       PROJECT_SPEC: opencv-python
       MB_PYTHON_VERSION: ${{ matrix.python-version }}
       TRAVIS_PYTHON_VERSION: ${{ matrix.python-version }}
@@ -57,9 +56,6 @@ jobs:
       working-directory: ${{ github.workspace }}
     - name: Setup environment
       run: |
-        if [[ "${{ github.event.pull_request }}" == "true" ]]; then
-          echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV
-        fi
         if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
           echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
         fi
diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml
index 3d8f9b62..b51801ab 100644
--- a/.github/workflows/build_wheels_macos_m1.yml
+++ b/.github/workflows/build_wheels_macos_m1.yml
@@ -30,7 +30,6 @@ jobs:
         without_gui: [0, 1]
         build_sdist: [0]
     env:
-      BUILD_COMMIT: ${{ github.ref }}
       CI_BUILD: 1
       SDIST: ${{ matrix.build_sdist || 0 }}
       ENABLE_HEADLESS: ${{ matrix.without_gui }}
@@ -41,9 +40,6 @@ jobs:
       working-directory: ${{ github.workspace }}
     - name: Setup environment
       run: |
-        if [[ "${{ github.event.pull_request }}" == "true" ]]; then
-          echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV
-        fi
         if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
           echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
         fi
@@ -84,18 +80,12 @@ jobs:
         without_gui: [0, 1]
         build_sdist: [0]
     env:
-      BUILD_COMMIT: ${{ github.ref }}
       OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata
       PYLINT_TEST_FILE: ${{ github.workspace }}/opencv/samples/python/squares.py
     steps:
     - name: Cleanup
       run: find . -mindepth 1 -delete
       working-directory: ${{ github.workspace }}
-    - name: Setup environment
-      run: |
-        if [[ "${{ github.event.pull_request }}" == "true" ]]; then
-          echo "BUILD_COMMIT=${{ github.base_ref }}" >> $GITHUB_ENV
-        fi
     - name: Checkout
       uses: actions/checkout@v3
       with:
diff --git a/docker/manylinux2014/Dockerfile_aarch64 b/docker/manylinux2014/Dockerfile_aarch64
index 2679cbbf..48ad3f98 100644
--- a/docker/manylinux2014/Dockerfile_aarch64
+++ b/docker/manylinux2014/Dockerfile_aarch64
@@ -1,4 +1,4 @@
-# Version: 20220628
+# Version: 20220824
 # Image name: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64
 
 FROM quay.io/pypa/manylinux2014_aarch64:latest
@@ -11,16 +11,28 @@ ARG NASM_VERSION=2.15.04
 ARG OPENSSL_VERSION=1_1_1o
 ARG QT_VERSION=5.15.0
 ARG YASM_VERSION=1.3.0
+ARG ZLIB_VERSION=1.2.12
 
 ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH
 
 # epel-release need for aarch64 to get openblas packages
-RUN yum install bzip2-devel curl-devel zlib-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel lapack-devel epel-release -y && \
+RUN yum install bzip2-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel lapack-devel epel-release -y && \
     yum install openblas-devel -y && \
     cp /usr/include/lapacke/lapacke*.h /usr/include/ && \
     curl https://raw.githubusercontent.com/xianyi/OpenBLAS/v0.3.3/cblas.h -o /usr/include/cblas.h && \
     # libpng will be built from source
-    yum remove libpng -y
+    yum remove libpng zlib-devel bzip2-devel -y
+
+RUN mkdir ~/zlib_sources && \
+    cd ~/zlib_sources && \
+    curl -O -L https://www.zlib.net/zlib-${ZLIB_VERSION}.tar.gz && \
+    tar -xf zlib-${ZLIB_VERSION}.tar.gz && \
+    cd zlib-${ZLIB_VERSION} && \
+    ./configure --prefix=/usr/local && \
+    make && \
+    make install && \
+    cd .. && \
+    rm -rf ~/zlib_sources
 
 RUN mkdir ~/libpng_sources && \
     cd ~/libpng_sources && \
@@ -71,8 +83,8 @@ RUN mkdir ~/openssl_sources && \
 
 RUN mkdir ~/nasm_sources && \
     cd ~/nasm_sources && \
-    curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/${NASM_VERSION}/nasm-${NASM_VERSION}.tar.bz2 && \
-    tar -xf nasm-${NASM_VERSION}.tar.bz2 && cd nasm-${NASM_VERSION} && ./autogen.sh && \
+    curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/${NASM_VERSION}/nasm-${NASM_VERSION}.tar.gz && \
+    tar -xf nasm-${NASM_VERSION}.tar.gz && cd nasm-${NASM_VERSION} && ./autogen.sh && \
     ./configure --prefix="/ffmpeg_build" --bindir="$HOME/bin" && \
     make -j$(getconf _NPROCESSORS_ONLN) && \
     make install && \
@@ -102,8 +114,8 @@ RUN mkdir ~/libvpx_sources && \
 
 RUN mkdir ~/ffmpeg_sources && \
     cd ~/ffmpeg_sources && \
-    curl -O -L https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \
-    tar -xf ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \
+    curl -O -L https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz && \
+    tar -xf ffmpeg-${FFMPEG_VERSION}.tar.gz && \
     cd ffmpeg-${FFMPEG_VERSION} && \
     PATH=~/bin:$PATH && \
     PKG_CONFIG_PATH="/ffmpeg_build/lib/pkgconfig" ./configure --prefix="/ffmpeg_build" --extra-cflags="-I/ffmpeg_build/include" --extra-ldflags="-L/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \
@@ -111,8 +123,7 @@ RUN mkdir ~/ffmpeg_sources && \
     make install && \
     echo "/ffmpeg_build/lib/" >> /etc/ld.so.conf && \
     ldconfig && \
-    rm -rf ~/ffmpeg_sources && \
-    yum remove bzip2-devel -y
+    rm -rf ~/ffmpeg_sources
 
 RUN curl -O -L https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/ccache-${CCACHE_VERSION}.tar.gz && \
     tar -xf ccache-${CCACHE_VERSION}.tar.gz && \
diff --git a/docker/manylinux2014/Dockerfile_x86_64 b/docker/manylinux2014/Dockerfile_x86_64
index 8bb77341..85fc22fd 100644
--- a/docker/manylinux2014/Dockerfile_x86_64
+++ b/docker/manylinux2014/Dockerfile_x86_64
@@ -1,4 +1,4 @@
-# Version: 20220628
+# Version: 20220824
 # Image name: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64
 
 FROM quay.io/pypa/manylinux2014_x86_64:latest
@@ -11,16 +11,28 @@ ARG NASM_VERSION=2.15.04
 ARG OPENSSL_VERSION=1_1_1o
 ARG QT_VERSION=5.15.0
 ARG YASM_VERSION=1.3.0
+ARG ZLIB_VERSION=1.2.12
 
 ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH
 
 # epel-release need for aarch64 to get openblas packages
-RUN yum install bzip2-devel curl-devel zlib-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel lapack-devel epel-release -y && \
+RUN yum install bzip2-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel lapack-devel epel-release -y && \
     yum install openblas-devel -y && \
     cp /usr/include/lapacke/lapacke*.h /usr/include/ && \
     curl https://raw.githubusercontent.com/xianyi/OpenBLAS/v0.3.3/cblas.h -o /usr/include/cblas.h && \
     # libpng will be built from source
-    yum remove libpng -y
+    yum remove libpng zlib-devel bzip2-devel -y
+
+RUN mkdir ~/zlib_sources && \
+    cd ~/zlib_sources && \
+    curl -O -L https://www.zlib.net/zlib-${ZLIB_VERSION}.tar.gz && \
+    tar -xf zlib-${ZLIB_VERSION}.tar.gz && \
+    cd zlib-${ZLIB_VERSION} && \
+    ./configure --prefix=/usr/local && \
+    make && \
+    make install && \
+    cd .. && \
+    rm -rf ~/zlib_sources
 
 RUN mkdir ~/libpng_sources && \
     cd ~/libpng_sources && \
@@ -71,8 +83,8 @@ RUN mkdir ~/openssl_sources && \
 
 RUN mkdir ~/nasm_sources && \
     cd ~/nasm_sources && \
-    curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/${NASM_VERSION}/nasm-${NASM_VERSION}.tar.bz2 && \
-    tar -xf nasm-${NASM_VERSION}.tar.bz2 && cd nasm-${NASM_VERSION} && ./autogen.sh && \
+    curl -O -L http://www.nasm.us/pub/nasm/releasebuilds/${NASM_VERSION}/nasm-${NASM_VERSION}.tar.gz && \
+    tar -xf nasm-${NASM_VERSION}.tar.gz && cd nasm-${NASM_VERSION} && ./autogen.sh && \
     ./configure --prefix="/ffmpeg_build" --bindir="$HOME/bin" && \
     make -j$(getconf _NPROCESSORS_ONLN) && \
     make install && \
@@ -102,8 +114,8 @@ RUN mkdir ~/libvpx_sources && \
 
 RUN mkdir ~/ffmpeg_sources && \
     cd ~/ffmpeg_sources && \
-    curl -O -L https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \
-    tar -xf ffmpeg-${FFMPEG_VERSION}.tar.bz2 && \
+    curl -O -L https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz && \
+    tar -xf ffmpeg-${FFMPEG_VERSION}.tar.gz && \
     cd ffmpeg-${FFMPEG_VERSION} && \
     PATH=~/bin:$PATH && \
     PKG_CONFIG_PATH="/ffmpeg_build/lib/pkgconfig" ./configure --prefix="/ffmpeg_build" --extra-cflags="-I/ffmpeg_build/include" --extra-ldflags="-L/ffmpeg_build/lib" --enable-openssl --enable-libvpx --enable-shared --enable-pic --bindir="$HOME/bin" && \
@@ -111,8 +123,7 @@ RUN mkdir ~/ffmpeg_sources && \
     make install && \
     echo "/ffmpeg_build/lib/" >> /etc/ld.so.conf && \
     ldconfig && \
-    rm -rf ~/ffmpeg_sources && \
-    yum remove bzip2-devel -y
+    rm -rf ~/ffmpeg_sources
 
 RUN curl -O -L https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/ccache-${CCACHE_VERSION}.tar.gz && \
     tar -xf ccache-${CCACHE_VERSION}.tar.gz && \
diff --git a/patch_auditwheel_whitelist.py b/patch_auditwheel_whitelist.py
index b32da17a..150f97ca 100644
--- a/patch_auditwheel_whitelist.py
+++ b/patch_auditwheel_whitelist.py
@@ -3,13 +3,39 @@
 
 from auditwheel import policy
 
-policies = None
 
-with open(join(dirname(abspath(policy.__file__)), "manylinux-policy.json")) as f:
-    policies = json.load(f)
+def add_zlib_versions():
+    with open(join(dirname(abspath(policy.__file__)), "manylinux-policy.json"), 'r') as manylinux_policy:
+        manylinux_policy_lines = manylinux_policy.readlines()
 
-for p in policies:
-    p["lib_whitelist"].append("libxcb.so.1")
+    manylinux_policy_data = ""
+    for line in manylinux_policy_lines:
+        if "ZLIB" in line:
+            if len(line) > 22:
+                updated_line = line[:-2] + ', "1.2.9", "1.2.12"]'
+            else:
+                updated_line = line[:-2] + '"1.2.9", "1.2.12"]'
+            manylinux_policy_replacement = line.replace(line, updated_line)
+        else:
+            manylinux_policy_replacement = line
+        manylinux_policy_data = manylinux_policy_data + manylinux_policy_replacement
 
-with open(join(dirname(abspath(policy.__file__)), "manylinux-policy.json"), "w") as f:
-    f.write(json.dumps(policies))
+    with open(join(dirname(abspath(policy.__file__)), "manylinux-policy.json"), 'w') as manylinux_final_policy:
+        manylinux_final_policy.write(manylinux_policy_data)
+
+def add_whitelisted_libs():
+    policies = None
+
+    with open(join(dirname(abspath(policy.__file__)), "manylinux-policy.json")) as f:
+        policies = json.load(f)
+
+    for p in policies:
+        p["lib_whitelist"].append("libxcb.so.1")
+
+    with open(join(dirname(abspath(policy.__file__)), "manylinux-policy.json"), "w") as f:
+        f.write(json.dumps(policies))
+
+
+if __name__ == '__main__':
+    add_zlib_versions()
+    add_whitelisted_libs()

From 66bbd9d95cb03cb36f9a3f5c1e7a78e4ef7c64c2 Mon Sep 17 00:00:00 2001
From: Joey Ballentine <34788790+joeyballentine@users.noreply.github.com>
Date: Mon, 29 Aug 2022 02:36:17 -0400
Subject: [PATCH 10/59] Build x64 macOS wheels for 10.13 build target (#716)

---
 .github/workflows/build_wheels_macos.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml
index 1c2a1614..584520b2 100644
--- a/.github/workflows/build_wheels_macos.yml
+++ b/.github/workflows/build_wheels_macos.yml
@@ -49,7 +49,7 @@ jobs:
       SDIST: ${{ matrix.build_sdist || 0 }}
       ENABLE_HEADLESS: ${{ matrix.without_gui }}
       ENABLE_CONTRIB: ${{ matrix.with_contrib }}
-      MACOSX_DEPLOYMENT_TARGET: 10.15
+      MACOSX_DEPLOYMENT_TARGET: 10.13
     steps:
     - name: Cleanup
       run: find . -mindepth 1 -delete

From b0b7f9f7f29a9de17131be5b68a983a3f86e1d27 Mon Sep 17 00:00:00 2001
From: Andrey Senyaev <76472231+asenyaev@users.noreply.github.com>
Date: Mon, 29 Aug 2022 15:00:15 +0300
Subject: [PATCH 11/59] Bump numpy version to 1.21.4 for macOS builds (#720)

---
 pyproject.toml | 3 ++-
 setup.py       | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/pyproject.toml b/pyproject.toml
index ff535e86..5993a2ac 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -8,5 +8,6 @@ requires = [
   "numpy==1.19.3; python_version<='3.9' and sys_platform == 'linux' and platform_machine == 'aarch64'",
   "numpy==1.21.0; python_version<='3.9' and sys_platform == 'darwin' and platform_machine == 'arm64'",
   "numpy==1.19.3; python_version=='3.9' and platform_machine != 'aarch64' and platform_machine != 'arm64'",
-  "numpy==1.21.2; python_version>='3.10'"
+  "numpy==1.21.2; python_version>='3.10'",
+  "numpy==1.21.4; python_version>='3.10' and platform_system=='Darwin'"
 ]
diff --git a/setup.py b/setup.py
index 9b937e59..11d2cb0f 100644
--- a/setup.py
+++ b/setup.py
@@ -30,7 +30,8 @@ def main():
         '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"',
+        '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"',
     ]
 
     python_version = cmaker.CMaker.get_python_version()

From 5308d0bf5274e07fe306fba411db265341cd0248 Mon Sep 17 00:00:00 2001
From: Nicholas Nadeau <nicholas.nadeau@gmail.com>
Date: Mon, 7 Aug 2023 13:16:30 -0400
Subject: [PATCH 12/59] docs: added TOC to README for easier navigation

---
 README.md | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/README.md b/README.md
index 95e56be3..771fa3dc 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,21 @@
 [![Downloads](http://pepy.tech/badge/opencv-python)](http://pepy.tech/project/opencv-python)
 
+- [OpenCV on Wheels](#opencv-on-wheels)
+  - [Installation and Usage](#installation-and-usage)
+- [Frequently Asked Questions](#frequently-asked-questions)
+- [Documentation for opencv-python](#documentation-for-opencv-python)
+  - [CI build process](#ci-build-process)
+  - [Manual builds](#manual-builds)
+    - [Manual debug builds](#manual-debug-builds)
+    - [Source distributions](#source-distributions)
+  - [Licensing](#licensing)
+  - [Versioning](#versioning)
+  - [Releases](#releases)
+  - [Development builds](#development-builds)
+  - [Manylinux wheels](#manylinux-wheels)
+  - [Supported Python versions](#supported-python-versions)
+  - [Backward compatibility](#backward-compatibility)
+
 ## OpenCV on Wheels
 
 Pre-built CPU-only OpenCV packages for Python.

From ca13925ac4f6536cca3edcb7bdd525bdc09d5f58 Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
Date: Wed, 27 Sep 2023 15:29:32 +0300
Subject: [PATCH 13/59] Update to OpenCV 4.8.1.

---
 opencv | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/opencv b/opencv
index f9a59f25..51998500 160000
--- a/opencv
+++ b/opencv
@@ -1 +1 @@
-Subproject commit f9a59f2592993d3dcc080e495f4f5e02dd8ec7ef
+Subproject commit 5199850039ad23f1f0e6cccea5061a9fea5efca6

From 44939451722fd28f4ecd874d306dc0cd71d15517 Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
Date: Thu, 12 Oct 2023 11:57:06 +0300
Subject: [PATCH 14/59] Docker images update for Python 3.12 and security
 fixes.

---
 .github/workflows/build_wheels_linux.yml     |  4 ++--
 .github/workflows/build_wheels_linux_arm.yml |  2 +-
 docker/manylinux2014/Dockerfile_aarch64      | 11 ++++++-----
 docker/manylinux2014/Dockerfile_x86_64       |  6 +++---
 4 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml
index 3176df1a..0bfb6ba3 100644
--- a/.github/workflows/build_wheels_linux.yml
+++ b/.github/workflows/build_wheels_linux.yml
@@ -41,7 +41,7 @@ jobs:
       MB_ML_VER: 2014
       TRAVIS_BUILD_DIR: ${{ github.workspace }}
       CONFIG_PATH: travis_config.sh
-      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20230628
+      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20231006
       USE_CCACHE: 0
       UNICODE_WIDTH: 32
       PLAT: x86_64
@@ -139,7 +139,7 @@ jobs:
       NP_TEST_DEP: numpy==1.19.4
       TRAVIS_BUILD_DIR: ${{ github.workspace }}
       CONFIG_PATH: travis_config.sh
-      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20230628
+      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20231006
       USE_CCACHE: 1
       UNICODE_WIDTH: 32
       SDIST: ${{ matrix.build_sdist || 0 }}
diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml
index 5a9de23f..0db992cc 100644
--- a/.github/workflows/build_wheels_linux_arm.yml
+++ b/.github/workflows/build_wheels_linux_arm.yml
@@ -42,7 +42,7 @@ jobs:
       MB_ML_VER: 2014
       TRAVIS_BUILD_DIR: ${{ github.workspace }}
       CONFIG_PATH: travis_config.sh
-      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64:20230628
+      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64:20231006
       USE_CCACHE: 0
       UNICODE_WIDTH: 32
       SDIST: ${{ matrix.build_sdist || 0 }}
diff --git a/docker/manylinux2014/Dockerfile_aarch64 b/docker/manylinux2014/Dockerfile_aarch64
index 26c45e80..dc4909f3 100644
--- a/docker/manylinux2014/Dockerfile_aarch64
+++ b/docker/manylinux2014/Dockerfile_aarch64
@@ -1,14 +1,14 @@
-# Version: 20230628
+# Version: 20231006
 # Image name: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64
 
 FROM quay.io/pypa/manylinux2014_aarch64:latest
 
 ARG CCACHE_VERSION=3.7.9
 ARG FFMPEG_VERSION=5.1.3
-ARG FREETYPE_VERSION=2.13.1
+ARG FREETYPE_VERSION=2.13.2
 ARG LIBPNG_VERSION=1.6.40
 ARG NASM_VERSION=2.15.04
-ARG OPENSSL_VERSION=1_1_1u
+ARG OPENSSL_VERSION=1_1_1w
 ARG QT_VERSION=5.15.0
 ARG YASM_VERSION=1.3.0
 
@@ -33,9 +33,10 @@ RUN mkdir ~/libpng_sources && \
     cd .. && \
     rm -rf ~/libpng_sources
 
+# looks like download.savannah.gnu.org suffers from https://savannah.gnu.org/bugs/?48150 in Manylinux 2014 env on aarch64
 RUN mkdir ~/freetype_sources && \
     cd ~/freetype_sources && \
-    curl -O -L https://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \
+    curl -O -L https://download-mirror.savannah.gnu.org/releases/freetype/freetype-${FREETYPE_VERSION}.tar.gz && \
     tar -xf freetype-${FREETYPE_VERSION}.tar.gz && \
     cd freetype-${FREETYPE_VERSION} && \
     ./configure --prefix="/ffmpeg_build" --enable-freetype-config && \
@@ -44,7 +45,7 @@ RUN mkdir ~/freetype_sources && \
     cd .. && \
     rm -rf ~/freetype_sources
 
-RUN curl -O -L https://download.qt.io/official_releases/qt/5.15/${QT_VERSION}/single/qt-everywhere-src-${QT_VERSION}.tar.xz && \
+RUN curl -C - -O -L https://download.qt.io/official_releases/qt/5.15/${QT_VERSION}/single/qt-everywhere-src-${QT_VERSION}.tar.xz && \
     tar -xf qt-everywhere-src-${QT_VERSION}.tar.xz && \
     cd qt-everywhere-src-${QT_VERSION} && \
     export MAKEFLAGS=-j$(nproc) && \
diff --git a/docker/manylinux2014/Dockerfile_x86_64 b/docker/manylinux2014/Dockerfile_x86_64
index d34f19f5..9fd6f0fb 100644
--- a/docker/manylinux2014/Dockerfile_x86_64
+++ b/docker/manylinux2014/Dockerfile_x86_64
@@ -1,14 +1,14 @@
-# Version: 20230628
+# Version: 20231006
 # Image name: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64
 
 FROM quay.io/pypa/manylinux2014_x86_64:latest
 
 ARG CCACHE_VERSION=3.7.9
 ARG FFMPEG_VERSION=5.1.3
-ARG FREETYPE_VERSION=2.13.1
+ARG FREETYPE_VERSION=2.13.2
 ARG LIBPNG_VERSION=1.6.40
 ARG NASM_VERSION=2.15.04
-ARG OPENSSL_VERSION=1_1_1u
+ARG OPENSSL_VERSION=1_1_1w
 ARG QT_VERSION=5.15.0
 ARG YASM_VERSION=1.3.0
 

From c9145d909193ad3b06b5d300be1e97bd7bb34acf Mon Sep 17 00:00:00 2001
From: Dmitry Kurtaev <dmitry.kurtaev@gmail.com>
Date: Wed, 18 Oct 2023 15:32:00 +0300
Subject: [PATCH 15/59] Update downloads badge

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 771fa3dc..0984e421 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-[![Downloads](http://pepy.tech/badge/opencv-python)](http://pepy.tech/project/opencv-python)
+[![Downloads](https://static.pepy.tech/badge/opencv-python)](http://pepy.tech/project/opencv-python)
 
 - [OpenCV on Wheels](#opencv-on-wheels)
   - [Installation and Usage](#installation-and-usage)

From 98573cebac8fd08b55d95041fcd9bb77fbe621ce Mon Sep 17 00:00:00 2001
From: Dmitry Kurtaev <dmitry.kurtaev@gmail.com>
Date: Sat, 9 Dec 2023 10:55:25 +0300
Subject: [PATCH 16/59] Change setup.py to trigger GitHub show dependents

---
 setup.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/setup.py b/setup.py
index f6056969..78998a03 100644
--- a/setup.py
+++ b/setup.py
@@ -7,8 +7,7 @@
 import re
 import sysconfig
 import platform
-import skbuild
-from skbuild import cmaker
+from skbuild import cmaker, setup
 
 
 def main():
@@ -264,7 +263,7 @@ def main():
         rearrange_cmake_output_data, files_outside_package_dir, package_data.keys()
     )
 
-    skbuild.setup(
+    setup(
         name=package_name,
         version=package_version,
         url="https://github.com/opencv/opencv-python",

From 0da732e80d492c61170ee43ea76c74bf265bce24 Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
Date: Tue, 3 Oct 2023 13:41:12 +0300
Subject: [PATCH 17/59] Python 3.12 support.

---
 .github/workflows/build_wheels_linux.yml     | 6 +++---
 .github/workflows/build_wheels_linux_arm.yml | 8 ++++----
 .github/workflows/build_wheels_macos.yml     | 6 +++---
 .github/workflows/build_wheels_macos_m1.yml  | 2 +-
 .github/workflows/build_wheels_windows.yml   | 2 +-
 docker/manylinux2014/Dockerfile_x86_64       | 2 +-
 multibuild                                   | 2 +-
 setup.py                                     | 4 +++-
 8 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml
index 0bfb6ba3..b880c1f7 100644
--- a/.github/workflows/build_wheels_linux.yml
+++ b/.github/workflows/build_wheels_linux.yml
@@ -84,7 +84,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
+        python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
         platform: [x64]
         with_contrib: [0, 1]
         without_gui: [0, 1]
@@ -93,7 +93,7 @@ jobs:
       ACTIONS_ALLOW_UNSECURE_COMMANDS: true
       MB_PYTHON_VERSION: ${{ matrix.python-version }}
       NP_TEST_DEP: numpy==1.19.4
-      NP_TEST_DEP_LATEST: numpy==1.24.0
+      NP_TEST_DEP_LATEST: numpy==1.26.0
       CONFIG_PATH: travis_config.sh
       PLAT: x86_64
     steps:
@@ -106,7 +106,7 @@ jobs:
         submodules: true
         fetch-depth: 0
     - name: Setup Environment variables
-      run: if [ "3.10" == "${{ matrix.python-version }}" -o "3.11" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
+      run: if [ "3.10" == "${{ matrix.python-version }}" -o "3.11" == "${{ matrix.python-version }}" -o "3.12" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
     - name: Download a wheel accordingly to matrix
       uses: actions/download-artifact@v3
       with:
diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml
index 0db992cc..7edb0c91 100644
--- a/.github/workflows/build_wheels_linux_arm.yml
+++ b/.github/workflows/build_wheels_linux_arm.yml
@@ -42,7 +42,7 @@ jobs:
       MB_ML_VER: 2014
       TRAVIS_BUILD_DIR: ${{ github.workspace }}
       CONFIG_PATH: travis_config.sh
-      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64:20231006
+      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64:20231109
       USE_CCACHE: 0
       UNICODE_WIDTH: 32
       SDIST: ${{ matrix.build_sdist || 0 }}
@@ -84,7 +84,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
+        python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
         platform: [x64]
         with_contrib: [0, 1]
         without_gui: [0, 1]
@@ -94,7 +94,7 @@ jobs:
       MB_PYTHON_VERSION: ${{ matrix.python-version }}
       PLAT: aarch64
       NP_TEST_DEP: numpy==1.19.4
-      NP_TEST_DEP_LATEST: numpy==1.24.0
+      NP_TEST_DEP_LATEST: numpy==1.26.0
       CONFIG_PATH: travis_config.sh
       DOCKER_TEST_IMAGE: multibuild/focal_arm64v8
       UNICODE_WIDTH: 32
@@ -108,7 +108,7 @@ jobs:
         submodules: true
         fetch-depth: 0
     - name: Setup Environment variables
-      run: if [ "3.10" == "${{ matrix.python-version }}" -o "3.11" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
+      run: if [ "3.10" == "${{ matrix.python-version }}" -o "3.11" == "${{ matrix.python-version }}" -o "3.12" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
     - name: Download a wheel accordingly to matrix
       uses: actions/download-artifact@v3
       with:
diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml
index 1defd1e5..d40c4697 100644
--- a/.github/workflows/build_wheels_macos.yml
+++ b/.github/workflows/build_wheels_macos.yml
@@ -105,7 +105,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
+        python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
         platform: [x64]
         with_contrib: [0, 1]
         without_gui: [0, 1]
@@ -114,7 +114,7 @@ jobs:
       ACTIONS_ALLOW_UNSECURE_COMMANDS: true
       MB_PYTHON_VERSION: ${{ matrix.python-version }}
       NP_TEST_DEP: numpy==1.19.4
-      NP_TEST_DEP_LATEST: numpy==1.24.0
+      NP_TEST_DEP_LATEST: numpy==1.26.0
       CONFIG_PATH: travis_config.sh
       PLAT: x86_64
       OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata
@@ -134,7 +134,7 @@ jobs:
         python-version: ${{ matrix.python-version }}
         architecture: ${{ matrix.platform }}
     - name: Setup Environment variables
-      run: if [ "3.10" == "${{ matrix.python-version }}" -o "3.11" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
+      run: if [ "3.10" == "${{ matrix.python-version }}" -o "3.11" == "${{ matrix.python-version }}" -o "3.12" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
     - name: Download a wheel accordingly to matrix
       uses: actions/download-artifact@v3
       with:
diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml
index 2aed7d4b..5d638fd8 100644
--- a/.github/workflows/build_wheels_macos_m1.yml
+++ b/.github/workflows/build_wheels_macos_m1.yml
@@ -75,7 +75,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
+        python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
         platform: [x64]
         with_contrib: [0, 1]
         without_gui: [0, 1]
diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index b1a98d26..19470a5d 100644
--- a/.github/workflows/build_wheels_windows.yml
+++ b/.github/workflows/build_wheels_windows.yml
@@ -89,7 +89,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
+        python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
         platform: [x86, x64]
         with_contrib: [0, 1]
         without_gui: [0, 1]
diff --git a/docker/manylinux2014/Dockerfile_x86_64 b/docker/manylinux2014/Dockerfile_x86_64
index 9fd6f0fb..9233bffa 100644
--- a/docker/manylinux2014/Dockerfile_x86_64
+++ b/docker/manylinux2014/Dockerfile_x86_64
@@ -1,4 +1,4 @@
-# Version: 20231006
+# Version: 20231109
 # Image name: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64
 
 FROM quay.io/pypa/manylinux2014_x86_64:latest
diff --git a/multibuild b/multibuild
index 15fd8770..0714f52e 160000
--- a/multibuild
+++ b/multibuild
@@ -1 +1 @@
-Subproject commit 15fd8770abe6b12e94c2362ae8f21cd876bd998e
+Subproject commit 0714f52ea1ea57a0bc33c7f8b74bae457e1fa8e0
diff --git a/setup.py b/setup.py
index f6056969..d8e3c920 100644
--- a/setup.py
+++ b/setup.py
@@ -32,7 +32,8 @@ def main():
         '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.23.5; python_version>='3.11'",
+        "numpy>=1.26.0; python_version>='3.12'"
     ]
 
     python_version = cmaker.CMaker.get_python_version()
@@ -299,6 +300,7 @@ def main():
             "Programming Language :: Python :: 3.9",
             "Programming Language :: Python :: 3.10",
             "Programming Language :: Python :: 3.11",
+            "Programming Language :: Python :: 3.12",
             "Programming Language :: C++",
             "Programming Language :: Python :: Implementation :: CPython",
             "Topic :: Scientific/Engineering",

From 984ff7378a3132c35cc52f24645c31f6cd00cac0 Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
Date: Thu, 21 Dec 2023 13:17:01 +0300
Subject: [PATCH 18/59] Include Intel IPP license text to 3rd party licenses
 list.

---
 LICENSE-3RD-PARTY.txt | 78 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 78 insertions(+)

diff --git a/LICENSE-3RD-PARTY.txt b/LICENSE-3RD-PARTY.txt
index e64ea511..f7d91a4f 100644
--- a/LICENSE-3RD-PARTY.txt
+++ b/LICENSE-3RD-PARTY.txt
@@ -2985,3 +2985,81 @@ 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.
+
+------------------------------------------------------------------------------
+Intel(R) IPP ICV library statically linked within x86 and x86_64 opencv-python packages.
+
+Intel(R) Integrated Performance Primitives 2021 Update 10
+
+Intel Simplified Software License (Version October 2022)
+
+Intel(R) Integrated Performance Primitives (Intel(R) IPP) : Copyright (C) 1997 Intel Corporation
+
+Use and Redistribution. You may use and redistribute the software, which is
+provided in binary form only, (the "Software"), without modification,
+provided the following conditions are met:
+
+* Redistributions must reproduce the above copyright notice and these
+  terms of use in the Software and in the documentation and/or other materials
+  provided with the distribution.
+* Neither the name of Intel nor the names of its suppliers may be used to
+  endorse or promote products derived from this Software without specific
+  prior written permission.
+* No reverse engineering, decompilation, or disassembly of the Software is
+  permitted, nor any modification or alteration of the Software or its operation
+  at any time, including during execution.
+
+No other licenses. Except as provided in the preceding section, Intel grants no
+licenses or other rights by implication, estoppel or otherwise to, patent,
+copyright, trademark, trade name, service mark or other intellectual property
+licenses or rights of Intel.
+
+Third party software.  "Third Party Software" means the files (if any) listed
+in the "third-party-software.txt" or other similarly-named text file that may
+be included with the Software. Third Party Software, even if included with the
+distribution of the Software, may be governed by separate license terms, including
+without limitation, third party license terms, open source software notices and
+terms, and/or other Intel software license terms. These separate license terms
+solely govern Your use of the Third Party Software.
+
+DISCLAIMER. THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT ARE
+DISCLAIMED. THIS SOFTWARE IS NOT INTENDED FOR USE IN SYSTEMS OR APPLICATIONS
+WHERE FAILURE OF THE SOFTWARE MAY CAUSE PERSONAL INJURY OR DEATH AND YOU AGREE
+THAT YOU ARE FULLY RESPONSIBLE FOR ANY CLAIMS, COSTS, DAMAGES, EXPENSES, AND
+ATTORNEYS' FEES ARISING OUT OF ANY SUCH USE, EVEN IF ANY CLAIM ALLEGES THAT
+INTEL WAS NEGLIGENT REGARDING THE DESIGN OR MANUFACTURE OF THE SOFTWARE.
+
+LIMITATION OF LIABILITY. IN NO EVENT WILL INTEL 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.
+
+No support. Intel may make changes to the Software, at any time without notice,
+and is not obligated to support, update or provide training for the Software.
+
+Termination. Your right to use the Software is terminated in the event of your
+breach of this license.
+
+Feedback. Should you provide Intel with comments, modifications, corrections,
+enhancements or other input ("Feedback") related to the Software, Intel will be
+free to use, disclose, reproduce, license or otherwise distribute or exploit the
+Feedback in its sole discretion without any obligations or restrictions of any
+kind, including without limitation, intellectual property rights or licensing
+obligations.
+
+Compliance with laws. You agree to comply with all relevant laws and regulations
+governing your use, transfer, import or export (or prohibition thereof) of the
+Software.
+
+Governing law. All disputes will be governed by the laws of the United States of
+America and the State of Delaware without reference to conflict of law
+principles and subject to the exclusive jurisdiction of the state or federal
+courts sitting in the State of Delaware, and each party agrees that it submits
+to the personal jurisdiction and venue of those courts and waives any
+objections. THE UNITED NATIONS CONVENTION ON CONTRACTS FOR THE INTERNATIONAL
+SALE OF GOODS (1980) IS SPECIFICALLY EXCLUDED AND WILL NOT APPLY TO THE SOFTWARE.

From f5c47b367e3f0e3d1546c8192aae21c6ae52a73d Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
Date: Mon, 25 Dec 2023 16:18:41 +0300
Subject: [PATCH 19/59] Linux environment update for release 4.9.0

Fixes https://github.com/opencv/opencv-python/issues/926

- FFmpeg update to 5.1.4.
- Stick to lates vpx release 1.13.1 with security fixes.
---
 .github/workflows/build_wheels_linux.yml     | 4 ++--
 .github/workflows/build_wheels_linux_arm.yml | 2 +-
 docker/manylinux2014/Dockerfile_aarch64      | 7 ++++---
 docker/manylinux2014/Dockerfile_i686         | 4 ++--
 docker/manylinux2014/Dockerfile_x86_64       | 7 ++++---
 5 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml
index b880c1f7..45a38d06 100644
--- a/.github/workflows/build_wheels_linux.yml
+++ b/.github/workflows/build_wheels_linux.yml
@@ -41,7 +41,7 @@ jobs:
       MB_ML_VER: 2014
       TRAVIS_BUILD_DIR: ${{ github.workspace }}
       CONFIG_PATH: travis_config.sh
-      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20231006
+      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20231225
       USE_CCACHE: 0
       UNICODE_WIDTH: 32
       PLAT: x86_64
@@ -139,7 +139,7 @@ jobs:
       NP_TEST_DEP: numpy==1.19.4
       TRAVIS_BUILD_DIR: ${{ github.workspace }}
       CONFIG_PATH: travis_config.sh
-      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20231006
+      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20231225
       USE_CCACHE: 1
       UNICODE_WIDTH: 32
       SDIST: ${{ matrix.build_sdist || 0 }}
diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml
index 7edb0c91..6371e360 100644
--- a/.github/workflows/build_wheels_linux_arm.yml
+++ b/.github/workflows/build_wheels_linux_arm.yml
@@ -42,7 +42,7 @@ jobs:
       MB_ML_VER: 2014
       TRAVIS_BUILD_DIR: ${{ github.workspace }}
       CONFIG_PATH: travis_config.sh
-      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64:20231109
+      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64:20231225
       USE_CCACHE: 0
       UNICODE_WIDTH: 32
       SDIST: ${{ matrix.build_sdist || 0 }}
diff --git a/docker/manylinux2014/Dockerfile_aarch64 b/docker/manylinux2014/Dockerfile_aarch64
index dc4909f3..196c97bb 100644
--- a/docker/manylinux2014/Dockerfile_aarch64
+++ b/docker/manylinux2014/Dockerfile_aarch64
@@ -1,12 +1,13 @@
-# Version: 20231006
+# Version: 20231225
 # Image name: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64
 
 FROM quay.io/pypa/manylinux2014_aarch64:latest
 
 ARG CCACHE_VERSION=3.7.9
-ARG FFMPEG_VERSION=5.1.3
+ARG FFMPEG_VERSION=5.1.4
 ARG FREETYPE_VERSION=2.13.2
 ARG LIBPNG_VERSION=1.6.40
+ARG VPX_VERSION=v1.13.1
 ARG NASM_VERSION=2.15.04
 ARG OPENSSL_VERSION=1_1_1w
 ARG QT_VERSION=5.15.0
@@ -93,7 +94,7 @@ RUN mkdir ~/yasm_sources && \
 
 RUN mkdir ~/libvpx_sources && \
     cd ~/libvpx_sources && \
-    git clone --depth 1 https://github.com/webmproject/libvpx.git && \
+    git clone --depth 1 -b ${VPX_VERSION} https://github.com/webmproject/libvpx.git && \
     cd libvpx && \
     ./configure --prefix="/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \
     make -j$(getconf _NPROCESSORS_ONLN) && \
diff --git a/docker/manylinux2014/Dockerfile_i686 b/docker/manylinux2014/Dockerfile_i686
index c11f6a4d..1c94b1fc 100644
--- a/docker/manylinux2014/Dockerfile_i686
+++ b/docker/manylinux2014/Dockerfile_i686
@@ -2,9 +2,9 @@ FROM quay.io/pypa/manylinux2014_i686:latest
 
 ARG CCACHE_VERSION=3.7.9
 ARG CMAKE_VERSION=3.17.0
-ARG FFMPEG_VERSION=5.1.2
+ARG FFMPEG_VERSION=5.1.4
 ARG NASM_VERSION=2.15.04
-ARG OPENSSL_VERSION=1_1_1s
+ARG OPENSSL_VERSION=1_1_1w
 ARG QT_VERSION=5.15.0
 ARG YASM_VERSION=1.3.0
 
diff --git a/docker/manylinux2014/Dockerfile_x86_64 b/docker/manylinux2014/Dockerfile_x86_64
index 9233bffa..ac28b689 100644
--- a/docker/manylinux2014/Dockerfile_x86_64
+++ b/docker/manylinux2014/Dockerfile_x86_64
@@ -1,12 +1,13 @@
-# Version: 20231109
+# Version: 20231225
 # Image name: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64
 
 FROM quay.io/pypa/manylinux2014_x86_64:latest
 
 ARG CCACHE_VERSION=3.7.9
-ARG FFMPEG_VERSION=5.1.3
+ARG FFMPEG_VERSION=5.1.4
 ARG FREETYPE_VERSION=2.13.2
 ARG LIBPNG_VERSION=1.6.40
+ARG VPX_VERSION=v1.13.1
 ARG NASM_VERSION=2.15.04
 ARG OPENSSL_VERSION=1_1_1w
 ARG QT_VERSION=5.15.0
@@ -92,7 +93,7 @@ RUN mkdir ~/yasm_sources && \
 
 RUN mkdir ~/libvpx_sources && \
     cd ~/libvpx_sources && \
-    git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git && \
+    git clone --depth 1 -b ${VPX_VERSION} https://chromium.googlesource.com/webm/libvpx.git && \
     cd libvpx && \
     ./configure --prefix="/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm --enable-pic --enable-shared && \
     make -j$(getconf _NPROCESSORS_ONLN) && \

From e7a86f982713d565c211f6059d52d5f200d97813 Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
Date: Tue, 26 Dec 2023 18:44:55 +0300
Subject: [PATCH 20/59] Use native Mac M1 Github Runner for the configuration.

---
 .github/workflows/build_wheels_macos_m1.yml | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml
index 5d638fd8..85f42fb9 100644
--- a/.github/workflows/build_wheels_macos_m1.yml
+++ b/.github/workflows/build_wheels_macos_m1.yml
@@ -55,8 +55,8 @@ jobs:
         echo $ENABLE_CONTRIB > contrib.enabled
         echo $ENABLE_HEADLESS > headless.enabled
         export MACOSX_DEPLOYMENT_TARGET=11.0
-        arch -arm64 python${{ matrix.python-version }} -m pip install toml && python${{ matrix.python-version }} -c 'import toml; c = toml.load("pyproject.toml"); print("\n".join(c["build-system"]["requires"]))' | python${{ matrix.python-version }} -m pip install -r /dev/stdin
-        arch -arm64 python${{ matrix.python-version }} setup.py bdist_wheel --py-limited-api=cp37 --dist-dir=wheelhouse -v
+        python${{ matrix.python-version }} -m pip install toml && python${{ matrix.python-version }} -c 'import toml; c = toml.load("pyproject.toml"); print("\n".join(c["build-system"]["requires"]))' | python${{ matrix.python-version }} -m pip install -r /dev/stdin
+        python${{ matrix.python-version }} setup.py bdist_wheel --py-limited-api=cp37 --dist-dir=wheelhouse -v
         delocate-wheel ${{ github.workspace }}/wheelhouse/opencv*
     - name: Saving all wheels
       uses: actions/upload-artifact@v3
@@ -100,18 +100,18 @@ jobs:
         path: wheelhouse/
     - name: Package installation
       run: |
-        arch -arm64 python${{ matrix.python-version }} -m pip install --user --no-cache --force-reinstall wheelhouse/opencv*.whl
+        python${{ matrix.python-version }} -m pip install --user --no-cache --force-reinstall wheelhouse/opencv*.whl
         cd ${{ github.workspace }}/tests
-        arch -arm64 python${{ matrix.python-version }} get_build_info.py
+        python${{ matrix.python-version }} get_build_info.py
     - name: Run tests
       run: |
         cd ${{ github.workspace }}/opencv
-        arch -arm64 python${{ matrix.python-version }} modules/python/test/test.py -v --repo .
+        python${{ matrix.python-version }} modules/python/test/test.py -v --repo .
     - name: Pylint test
       run: |
-        arch -arm64 python${{ matrix.python-version }} -m pip install pylint==2.15.9
+        python${{ matrix.python-version }} -m pip install pylint==2.15.9
         cd ${{ github.workspace }}/tests
-        arch -arm64 python${{ matrix.python-version }} -m pylint $PYLINT_TEST_FILE
+        python${{ matrix.python-version }} -m pylint $PYLINT_TEST_FILE
 
   Release_rolling:
     if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}

From 1e1b0ca86ffcbeb9261378707279c4a116381f3b Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
Date: Tue, 26 Dec 2023 21:23:09 +0300
Subject: [PATCH 21/59] Migrate Mac OS Intel to OSX 12.

---
 .github/workflows/build_wheels_macos.yml |  4 ++--
 travis_osx_brew_cache.sh                 | 20 ++++++++++----------
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml
index d40c4697..dd3bc654 100644
--- a/.github/workflows/build_wheels_macos.yml
+++ b/.github/workflows/build_wheels_macos.yml
@@ -20,7 +20,7 @@ on:
 
 jobs:
   Build:
-    runs-on: macos-11
+    runs-on: macos-12
     defaults:
       run:
         shell: bash
@@ -98,7 +98,7 @@ jobs:
 
   Test:
     needs: [Build]
-    runs-on: macos-11
+    runs-on: macos-12
     defaults:
       run:
         shell: bash
diff --git a/travis_osx_brew_cache.sh b/travis_osx_brew_cache.sh
index 1a2a1c6c..42e71446 100644
--- a/travis_osx_brew_cache.sh
+++ b/travis_osx_brew_cache.sh
@@ -265,14 +265,14 @@ function _brew_parse_bottle_json {
 
     local JSON; JSON="${1:?}"; shift
 
-    local JSON_DATA; JSON_DATA=$(python2.7 -c 'if True:
+    local JSON_DATA; JSON_DATA=$(python3 -c 'if True:
     import sys,json; j=json.load(open(sys.argv[1],"rb")); [name]=j.keys(); [pdata]=j.values()
-    print name
-    print pdata["formula"]["pkg_version"]
-    print pdata["bottle"]["rebuild"]
+    print(name)
+    print(pdata["formula"]["pkg_version"])
+    print(pdata["bottle"]["rebuild"])
     [(tag_name, tag_dict)]=pdata["bottle"]["tags"].items()
-    print tag_name
-    print tag_dict["sha256"]
+    print(tag_name)
+    print(tag_dict["sha256"])
     ' "$JSON")
 
     unset JSON
@@ -292,15 +292,15 @@ function _brew_parse_package_info {
     PACKAGE="${1:?}"; shift
     OS_CODENAME="${1:?}"; shift
 
-    local JSON_DATA; JSON_DATA=$(python2.7 -c 'if True:
+    local JSON_DATA; JSON_DATA=$(python3 -c 'if True:
     import sys, json, subprocess; j=json.loads(subprocess.check_output(("brew","info","--json=v1",sys.argv[1])))
     data=j[0]
     revision=data["revision"]
     # in bottle''s json, revision is included into version; here, they are separate
-    print data["versions"]["stable"]+("_"+str(revision) if revision else "")
+    print(data["versions"]["stable"]+("_"+str(revision) if revision else ""))
     bottle_data=data["bottle"].get("stable",{"rebuild":"","files":{}})
-    print bottle_data["rebuild"]
-    print bottle_data["files"].get(sys.argv[2],{"sha256":"!?"})["sha256"]     #prevent losing trailing blank line to command substitution
+    print(bottle_data["rebuild"])
+    print(bottle_data["files"].get(sys.argv[2],{"sha256":"!?"})["sha256"])     #prevent losing trailing blank line to command substitution
     ' \
     "$PACKAGE" "$OS_CODENAME"); JSON_DATA="${JSON_DATA%\!\?}"  #!? can't occur in a hash
 

From 042e0e04a5e39ddfc6582d13787269916a3f4c06 Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
Date: Wed, 27 Dec 2023 13:35:35 +0300
Subject: [PATCH 22/59] Submodules update to tag 4.9.0.

---
 opencv         | 2 +-
 opencv_contrib | 2 +-
 opencv_extra   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/opencv b/opencv
index 51998500..dad8af6b 160000
--- a/opencv
+++ b/opencv
@@ -1 +1 @@
-Subproject commit 5199850039ad23f1f0e6cccea5061a9fea5efca6
+Subproject commit dad8af6b17f8e60d7b95a1203a1b4d22f56574cf
diff --git a/opencv_contrib b/opencv_contrib
index f10c84d4..c7602a8f 160000
--- a/opencv_contrib
+++ b/opencv_contrib
@@ -1 +1 @@
-Subproject commit f10c84d48b0714f2b408c9e5cccfac1277c8e6cc
+Subproject commit c7602a8f74205e44389bd6a4e8d727d32e7e27b4
diff --git a/opencv_extra b/opencv_extra
index fdd66bfc..7f0ba7ad 160000
--- a/opencv_extra
+++ b/opencv_extra
@@ -1 +1 @@
-Subproject commit fdd66bfcc3ced243d682fe03f0858bf43867656c
+Subproject commit 7f0ba7adefcbbbe3df7d939f5246ba0382c7c629

From eaa9512a04c8f1c1f7aeb9f093fa948d3542561b Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
Date: Fri, 29 Dec 2023 13:53:52 +0300
Subject: [PATCH 23/59] Added donation notification.

---
 README.md | 4 ++++
 setup.py  | 1 +
 2 files changed, 5 insertions(+)

diff --git a/README.md b/README.md
index 0984e421..514143c6 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,9 @@
 [![Downloads](https://static.pepy.tech/badge/opencv-python)](http://pepy.tech/project/opencv-python)
 
+### Keep OpenCV Free
+
+OpenCV is raising funds to keep the library free for everyone, and we need the support of the entire community to do it. [Donate to OpenCV on IndieGoGo](http://igg.me/at/opencv5) to show your support.
+
 - [OpenCV on Wheels](#opencv-on-wheels)
   - [Installation and Usage](#installation-and-usage)
 - [Frequently Asked Questions](#frequently-asked-questions)
diff --git a/setup.py b/setup.py
index 907e3329..766b4bb4 100644
--- a/setup.py
+++ b/setup.py
@@ -310,6 +310,7 @@ def main():
         cmake_source_dir=cmake_source_dir,
     )
 
+    print("OpenCV is raising funds to keep the library free for everyone, and we need the support of the entire community to do it. Donate to OpenCV on IndieGoGo:\nhttps://www.indiegogo.com/projects/opencv-5-support-non-profit-open-source-cv-ai#/")
 
 class RearrangeCMakeOutput:
     """

From 080da76b1534607cb648b07a6dd5df30beb61f8d Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
Date: Fri, 29 Dec 2023 14:03:50 +0300
Subject: [PATCH 24/59] Run Python test on Mac M1 in virtual environment to
 prevent "error: externally-managed-environment".

---
 .github/workflows/build_wheels_macos_m1.yml | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml
index 85f42fb9..4f1f214c 100644
--- a/.github/workflows/build_wheels_macos_m1.yml
+++ b/.github/workflows/build_wheels_macos_m1.yml
@@ -98,17 +98,24 @@ jobs:
       with:
         name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
         path: wheelhouse/
+    - name: Create Venv for test
+      run: |
+        test -d "${{ github.workspace }}/opencv_test" && rm -rf "${{ github.workspace }}/opencv_test"
+        python${{ matrix.python-version }} -m venv ${{ github.workspace }}/opencv_test
     - name: Package installation
       run: |
-        python${{ matrix.python-version }} -m pip install --user --no-cache --force-reinstall wheelhouse/opencv*.whl
+        source ${{ github.workspace }}/opencv_test/bin/activate
+        python${{ matrix.python-version }} -m pip install --no-cache --force-reinstall wheelhouse/opencv*.whl
         cd ${{ github.workspace }}/tests
         python${{ matrix.python-version }} get_build_info.py
     - name: Run tests
       run: |
+        source ${{ github.workspace }}/opencv_test/bin/activate
         cd ${{ github.workspace }}/opencv
         python${{ matrix.python-version }} modules/python/test/test.py -v --repo .
     - name: Pylint test
       run: |
+        source ${{ github.workspace }}/opencv_test/bin/activate
         python${{ matrix.python-version }} -m pip install pylint==2.15.9
         cd ${{ github.workspace }}/tests
         python${{ matrix.python-version }} -m pylint $PYLINT_TEST_FILE

From 949b65ea40f5141bdf46f738f7751a16d6309e04 Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
Date: Sat, 30 Dec 2023 13:13:41 +0300
Subject: [PATCH 25/59] Upgrade pip on Mac M1 before package installation.

---
 .github/workflows/build_wheels_macos_m1.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml
index 4f1f214c..f0e41d3a 100644
--- a/.github/workflows/build_wheels_macos_m1.yml
+++ b/.github/workflows/build_wheels_macos_m1.yml
@@ -105,6 +105,7 @@ jobs:
     - name: Package installation
       run: |
         source ${{ github.workspace }}/opencv_test/bin/activate
+        python${{ matrix.python-version }} -m pip install --upgrade pip
         python${{ matrix.python-version }} -m pip install --no-cache --force-reinstall wheelhouse/opencv*.whl
         cd ${{ github.workspace }}/tests
         python${{ matrix.python-version }} get_build_info.py

From fcf02c69070c7b6ee58ceef00e6a54ca8f0e1bc0 Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
Date: Sun, 31 Dec 2023 11:09:48 +0300
Subject: [PATCH 26/59] Readme update for 4.9.0.

---
 README.md | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/README.md b/README.md
index 514143c6..7f1e3a4c 100644
--- a/README.md
+++ b/README.md
@@ -241,6 +241,7 @@ Python 3.x compatible pre-built wheels are provided for the officially supported
 - 3.9
 - 3.10
 - 3.11
+- 3.12
 
 ### Backward compatibility
 
@@ -249,3 +250,5 @@ Starting from 4.2.0 and 3.4.9 builds the macOS Travis build environment was upda
 Starting from 4.3.0 and 3.4.10 builds the Linux build environment was updated from `manylinux1` to `manylinux2014`. This dropped support for old Linux distributions.
 
 Starting from version 4.7.0 the Mac OS GitHub Actions build environment was update to version 11. Mac OS 10.x support depricated. See https://github.com/actions/runner-images/issues/5583
+
+Starting from version 4.9.0 the Mac OS GitHub Actions build environment was update to version 12. Mac OS 10.x support depricated by Brew and most of used packages.

From ebd0aee2004dc4e53a2c8b8b70231c718b313769 Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
Date: Tue, 21 May 2024 09:49:15 +0300
Subject: [PATCH 27/59] Use Github sponsor link.

---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 7f1e3a4c..aa19f439 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
 
 ### Keep OpenCV Free
 
-OpenCV is raising funds to keep the library free for everyone, and we need the support of the entire community to do it. [Donate to OpenCV on IndieGoGo](http://igg.me/at/opencv5) to show your support.
+OpenCV is raising funds to keep the library free for everyone, and we need the support of the entire community to do it. [Donate to OpenCV on Github](https://github.com/sponsors/opencv) to show your support.
 
 - [OpenCV on Wheels](#opencv-on-wheels)
   - [Installation and Usage](#installation-and-usage)

From 542cf06b308cdcf3d5e0a32e33482fe6b22997d6 Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <2536374+asmorkalov@users.noreply.github.com>
Date: Thu, 30 May 2024 15:46:29 +0300
Subject: [PATCH 28/59] Dependencies update for 4.10.0 release. (#984)

* Dependences update for 4.10 release.

* Updated docker tags.

* New docker tags in pipelines.

* Fixed Qt version.

* Added QT to LD_LIBRARY_PATH
---
 .github/workflows/build_wheels_linux.yml     |  4 ++--
 .github/workflows/build_wheels_linux_arm.yml |  2 +-
 docker/manylinux2014/Dockerfile_aarch64      | 12 ++++++------
 docker/manylinux2014/Dockerfile_x86_64       | 12 ++++++------
 patches/patchQtPlugins                       |  2 +-
 travis_config.sh                             |  2 +-
 6 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml
index 45a38d06..0e202f63 100644
--- a/.github/workflows/build_wheels_linux.yml
+++ b/.github/workflows/build_wheels_linux.yml
@@ -41,7 +41,7 @@ jobs:
       MB_ML_VER: 2014
       TRAVIS_BUILD_DIR: ${{ github.workspace }}
       CONFIG_PATH: travis_config.sh
-      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20231225
+      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20240524
       USE_CCACHE: 0
       UNICODE_WIDTH: 32
       PLAT: x86_64
@@ -139,7 +139,7 @@ jobs:
       NP_TEST_DEP: numpy==1.19.4
       TRAVIS_BUILD_DIR: ${{ github.workspace }}
       CONFIG_PATH: travis_config.sh
-      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20231225
+      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20240524
       USE_CCACHE: 1
       UNICODE_WIDTH: 32
       SDIST: ${{ matrix.build_sdist || 0 }}
diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml
index 6371e360..4c1fc48e 100644
--- a/.github/workflows/build_wheels_linux_arm.yml
+++ b/.github/workflows/build_wheels_linux_arm.yml
@@ -42,7 +42,7 @@ jobs:
       MB_ML_VER: 2014
       TRAVIS_BUILD_DIR: ${{ github.workspace }}
       CONFIG_PATH: travis_config.sh
-      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64:20231225
+      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64:20240524
       USE_CCACHE: 0
       UNICODE_WIDTH: 32
       SDIST: ${{ matrix.build_sdist || 0 }}
diff --git a/docker/manylinux2014/Dockerfile_aarch64 b/docker/manylinux2014/Dockerfile_aarch64
index 196c97bb..e19492ff 100644
--- a/docker/manylinux2014/Dockerfile_aarch64
+++ b/docker/manylinux2014/Dockerfile_aarch64
@@ -1,4 +1,4 @@
-# Version: 20231225
+# Version: 20240524
 # Image name: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64
 
 FROM quay.io/pypa/manylinux2014_aarch64:latest
@@ -6,11 +6,11 @@ FROM quay.io/pypa/manylinux2014_aarch64:latest
 ARG CCACHE_VERSION=3.7.9
 ARG FFMPEG_VERSION=5.1.4
 ARG FREETYPE_VERSION=2.13.2
-ARG LIBPNG_VERSION=1.6.40
-ARG VPX_VERSION=v1.13.1
+ARG LIBPNG_VERSION=1.6.43
+ARG VPX_VERSION=v1.14.0
 ARG NASM_VERSION=2.15.04
 ARG OPENSSL_VERSION=1_1_1w
-ARG QT_VERSION=5.15.0
+ARG QT_VERSION=5.15.13
 ARG YASM_VERSION=1.3.0
 
 ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH
@@ -46,8 +46,8 @@ RUN mkdir ~/freetype_sources && \
     cd .. && \
     rm -rf ~/freetype_sources
 
-RUN curl -C - -O -L https://download.qt.io/official_releases/qt/5.15/${QT_VERSION}/single/qt-everywhere-src-${QT_VERSION}.tar.xz && \
-    tar -xf qt-everywhere-src-${QT_VERSION}.tar.xz && \
+RUN curl -C - -O -L https://download.qt.io/archive/qt/5.15/${QT_VERSION}/single/qt-everywhere-opensource-src-${QT_VERSION}.tar.xz && \
+    tar -xf qt-everywhere-opensource-src-${QT_VERSION}.tar.xz && \
     cd qt-everywhere-src-${QT_VERSION} && \
     export MAKEFLAGS=-j$(nproc) && \
     ./configure -prefix /opt/Qt${QT_VERSION} -release -opensource -confirm-license -qtnamespace QtOpenCVPython -xcb -xcb-xlib -bundled-xcb-xinput -no-openssl -no-dbus -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtdatavis3d -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtmultimedia -skip qtpurchasing -skip qtqa -skip qtremoteobjects -skip qtrepotools -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qttranslations -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip xmlpatterns -skip declarative -make libs && \
diff --git a/docker/manylinux2014/Dockerfile_x86_64 b/docker/manylinux2014/Dockerfile_x86_64
index ac28b689..eceae25e 100644
--- a/docker/manylinux2014/Dockerfile_x86_64
+++ b/docker/manylinux2014/Dockerfile_x86_64
@@ -1,4 +1,4 @@
-# Version: 20231225
+# Version: 20240524
 # Image name: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64
 
 FROM quay.io/pypa/manylinux2014_x86_64:latest
@@ -6,11 +6,11 @@ FROM quay.io/pypa/manylinux2014_x86_64:latest
 ARG CCACHE_VERSION=3.7.9
 ARG FFMPEG_VERSION=5.1.4
 ARG FREETYPE_VERSION=2.13.2
-ARG LIBPNG_VERSION=1.6.40
-ARG VPX_VERSION=v1.13.1
+ARG LIBPNG_VERSION=1.6.43
+ARG VPX_VERSION=v1.14.0
 ARG NASM_VERSION=2.15.04
 ARG OPENSSL_VERSION=1_1_1w
-ARG QT_VERSION=5.15.0
+ARG QT_VERSION=5.15.13
 ARG YASM_VERSION=1.3.0
 
 ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH
@@ -45,8 +45,8 @@ RUN mkdir ~/freetype_sources && \
     cd .. && \
     rm -rf ~/freetype_sources
 
-RUN curl -O -L https://download.qt.io/official_releases/qt/5.15/${QT_VERSION}/single/qt-everywhere-src-${QT_VERSION}.tar.xz && \
-    tar -xf qt-everywhere-src-${QT_VERSION}.tar.xz && \
+RUN curl -O -L https://download.qt.io/archive/qt/5.15/${QT_VERSION}/single/qt-everywhere-opensource-src-${QT_VERSION}.tar.xz && \
+    tar -xf qt-everywhere-opensource-src-${QT_VERSION}.tar.xz && \
     cd qt-everywhere-src-${QT_VERSION} && \
     export MAKEFLAGS=-j$(nproc) && \
     ./configure -prefix /opt/Qt${QT_VERSION} -release -opensource -confirm-license -qtnamespace QtOpenCVPython -xcb -xcb-xlib -bundled-xcb-xinput -no-openssl -no-dbus -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtdatavis3d -skip qtdoc -skip qtgamepad -skip qtgraphicaleffects -skip qtimageformats -skip qtlocation -skip qtmultimedia -skip qtpurchasing -skip qtqa -skip qtremoteobjects -skip qtrepotools -skip qtscript -skip qtscxml -skip qtsensors -skip qtserialbus -skip qtserialport -skip qtspeech -skip qttranslations -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip xmlpatterns -skip declarative -make libs && \
diff --git a/patches/patchQtPlugins b/patches/patchQtPlugins
index a05a5f83..70c6975a 100644
--- a/patches/patchQtPlugins
+++ b/patches/patchQtPlugins
@@ -9,7 +9,7 @@ index 4c0b3880fc..dffa0a4caa 100644
 +      install(DIRECTORY ${Qt5_DIR}/../../../plugins DESTINATION lib/qt)
 +    endif()
 +    if(UNIX AND NOT APPLE)
-+      install(DIRECTORY /opt/Qt5.15.0/plugins DESTINATION lib/qt)
++      install(DIRECTORY /opt/Qt5.15.13/plugins DESTINATION lib/qt)
 +      install(DIRECTORY /usr/share/fonts DESTINATION lib/qt)
 +    endif()
      if(HAVE_QT_OPENGL)
diff --git a/travis_config.sh b/travis_config.sh
index b91d63c4..903ceafb 100644
--- a/travis_config.sh
+++ b/travis_config.sh
@@ -34,7 +34,7 @@ if [ -n "$IS_OSX" ]; then
   export MAKEFLAGS="-j$(sysctl -n hw.ncpu)"
 else
   echo "    > Linux environment "
-  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/Qt5.15.0/lib
+  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/Qt5.15.13/lib
   export MAKEFLAGS="-j$(grep -E '^processor[[:space:]]*:' /proc/cpuinfo | wc -l)"
   CURRENT_ARCH=$(uname -m)
   if [[ $CURRENT_ARCH == 'aarch64' ]]; then

From d261ecbd0f4f937dc9cf99ef37be8278534e370e Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
Date: Mon, 3 Jun 2024 11:14:10 +0300
Subject: [PATCH 29/59] Added license text for OrbbecSDK needed on MacOS ARM64.

---
 LICENSE-3RD-PARTY.txt | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/LICENSE-3RD-PARTY.txt b/LICENSE-3RD-PARTY.txt
index f7d91a4f..0462eee3 100644
--- a/LICENSE-3RD-PARTY.txt
+++ b/LICENSE-3RD-PARTY.txt
@@ -3063,3 +3063,28 @@ courts sitting in the State of Delaware, and each party agrees that it submits
 to the personal jurisdiction and venue of those courts and waives any
 objections. THE UNITED NATIONS CONVENTION ON CONTRACTS FOR THE INTERNATIONAL
 SALE OF GOODS (1980) IS SPECIFICALLY EXCLUDED AND WILL NOT APPLY TO THE SOFTWARE.
+
+------------------------------------------------------------------------------
+Orbbec SDK distributed with arm64 MacOS packages.
+
+MIT License
+
+Copyright (c) 2023 OrbbecDeveloper
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.

From 63eed93e6d372795f6b6ca3d90c5d9cefc1b5a77 Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <2536374+asmorkalov@users.noreply.github.com>
Date: Mon, 3 Jun 2024 15:28:02 +0300
Subject: [PATCH 30/59] Update submodules to 4.10.0-pre for testing. (#990)

* Submodules update to tag 4.10.0.
* Update donation link.
* Use 4 digits in OpenCV version since 4.10.0
* Add OrbbecSDK library to package for MacOS ARM. It's aways enabled during library build.
---
 opencv         |  2 +-
 opencv_contrib |  2 +-
 opencv_extra   |  2 +-
 setup.py       | 10 ++++++++--
 4 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/opencv b/opencv
index dad8af6b..71d3237a 160000
--- a/opencv
+++ b/opencv
@@ -1 +1 @@
-Subproject commit dad8af6b17f8e60d7b95a1203a1b4d22f56574cf
+Subproject commit 71d3237a093b60a27601c20e9ee6c3e52154e8b1
diff --git a/opencv_contrib b/opencv_contrib
index c7602a8f..1ed3dd2c 160000
--- a/opencv_contrib
+++ b/opencv_contrib
@@ -1 +1 @@
-Subproject commit c7602a8f74205e44389bd6a4e8d727d32e7e27b4
+Subproject commit 1ed3dd2c53888e3289afdb22ec4e9ebbff3dba87
diff --git a/opencv_extra b/opencv_extra
index 7f0ba7ad..dd1fbd07 160000
--- a/opencv_extra
+++ b/opencv_extra
@@ -1 +1 @@
-Subproject commit 7f0ba7adefcbbbe3df7d939f5246ba0382c7c629
+Subproject commit dd1fbd0717ef4d83f86899b4144fdd9bc0364a5f
diff --git a/setup.py b/setup.py
index 766b4bb4..48d5a65f 100644
--- a/setup.py
+++ b/setup.py
@@ -110,11 +110,17 @@ def main():
     # Path regexes with forward slashes relative to CMake install dir.
     rearrange_cmake_output_data = {
         "cv2": (
-            [r"bin/opencv_videoio_ffmpeg\d{3}%s\.dll" % ("_64" if is64 else "")]
+            [r"bin/opencv_videoio_ffmpeg\d{4}%s\.dll" % ("_64" if is64 else "")]
             if os.name == "nt"
             else []
         )
         +
+        (
+            [r"lib/libOrbbecSDK.dylib", r"lib/libOrbbecSDK.\d.\d.dylib", r"lib/libOrbbecSDK.\d.\d.\d.dylib"]
+            if platform.system() == "Darwin" and platform.machine() == "arm64"
+            else []
+        )
+        +
         # In Windows, in python/X.Y/<arch>/; in Linux, in just python/X.Y/.
         # Naming conventions vary so widely between versions and OSes
         # had to give up on checking them.
@@ -310,7 +316,7 @@ def main():
         cmake_source_dir=cmake_source_dir,
     )
 
-    print("OpenCV is raising funds to keep the library free for everyone, and we need the support of the entire community to do it. Donate to OpenCV on IndieGoGo:\nhttps://www.indiegogo.com/projects/opencv-5-support-non-profit-open-source-cv-ai#/")
+    print("OpenCV is raising funds to keep the library free for everyone, and we need the support of the entire community to do it. Donate to OpenCV on GitHub:\nhttps://github.com/sponsors/opencv\n")
 
 class RearrangeCMakeOutput:
     """

From 512209a631c9e4a3b10b17d853de31a89c449612 Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
Date: Mon, 3 Jun 2024 15:38:59 +0300
Subject: [PATCH 31/59] Update Numpy requirements in the project.

---
 pyproject.toml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pyproject.toml b/pyproject.toml
index 00176366..7486f132 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -9,7 +9,8 @@ requires = [
   "numpy==1.19.3; python_version=='3.9' and platform_machine != 'aarch64' and platform_machine != 'arm64'",
   "numpy==1.21.2; python_version=='3.10' and platform_system!='Darwin'",
   "numpy==1.21.4; python_version=='3.10' and platform_system=='Darwin'",
-  "numpy==1.22.2; python_version>='3.11'",
+  "numpy==1.23.5; python_version=='3.11'",
+  "numpy>=1.26.4; python_version>='3.12'",
   "pip",
   "scikit-build>=0.14.0",
   "setuptools==59.2.0",

From 00e120989b55ba1734db211766344e0237dbd477 Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
Date: Mon, 17 Jun 2024 12:09:37 +0300
Subject: [PATCH 32/59] Alternative solution to use Numpy 2.0 for Python 3.9+
 packages.

---
 .github/workflows/build_wheels_linux.yml     |  4 ++--
 .github/workflows/build_wheels_linux_arm.yml |  4 ++--
 .github/workflows/build_wheels_macos.yml     |  4 ++--
 .github/workflows/build_wheels_macos_m1.yml  |  2 +-
 .github/workflows/build_wheels_windows.yml   |  2 +-
 pyproject.toml                               | 10 +++-------
 6 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml
index 0e202f63..746395e4 100644
--- a/.github/workflows/build_wheels_linux.yml
+++ b/.github/workflows/build_wheels_linux.yml
@@ -27,7 +27,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        python-version: ['3.7']
+        python-version: ['3.9']
         platform: [x64]
         with_contrib: [0, 1]
         without_gui: [0, 1]
@@ -93,7 +93,7 @@ jobs:
       ACTIONS_ALLOW_UNSECURE_COMMANDS: true
       MB_PYTHON_VERSION: ${{ matrix.python-version }}
       NP_TEST_DEP: numpy==1.19.4
-      NP_TEST_DEP_LATEST: numpy==1.26.0
+      NP_TEST_DEP_LATEST: numpy==2.0.0
       CONFIG_PATH: travis_config.sh
       PLAT: x86_64
     steps:
diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml
index 4c1fc48e..928ded7d 100644
--- a/.github/workflows/build_wheels_linux_arm.yml
+++ b/.github/workflows/build_wheels_linux_arm.yml
@@ -27,7 +27,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        python-version: ['3.7']
+        python-version: ['3.9']
         platform: [x64]
         with_contrib: [0, 1]
         without_gui: [0, 1]
@@ -94,7 +94,7 @@ jobs:
       MB_PYTHON_VERSION: ${{ matrix.python-version }}
       PLAT: aarch64
       NP_TEST_DEP: numpy==1.19.4
-      NP_TEST_DEP_LATEST: numpy==1.26.0
+      NP_TEST_DEP_LATEST: numpy==2.0.0
       CONFIG_PATH: travis_config.sh
       DOCKER_TEST_IMAGE: multibuild/focal_arm64v8
       UNICODE_WIDTH: 32
diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml
index dd3bc654..97df456e 100644
--- a/.github/workflows/build_wheels_macos.yml
+++ b/.github/workflows/build_wheels_macos.yml
@@ -27,7 +27,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        python-version: ['3.7']
+        python-version: ['3.9']
         platform: [x64]
         with_contrib: [0, 1]
         without_gui: [0, 1]
@@ -114,7 +114,7 @@ jobs:
       ACTIONS_ALLOW_UNSECURE_COMMANDS: true
       MB_PYTHON_VERSION: ${{ matrix.python-version }}
       NP_TEST_DEP: numpy==1.19.4
-      NP_TEST_DEP_LATEST: numpy==1.26.0
+      NP_TEST_DEP_LATEST: numpy==2.0.0
       CONFIG_PATH: travis_config.sh
       PLAT: x86_64
       OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata
diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml
index f0e41d3a..a3bcac63 100644
--- a/.github/workflows/build_wheels_macos_m1.yml
+++ b/.github/workflows/build_wheels_macos_m1.yml
@@ -24,7 +24,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        python-version: ['3.7']
+        python-version: ['3.9']
         platform: [x64]
         with_contrib: [0, 1]
         without_gui: [0, 1]
diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index 19470a5d..d69f17ec 100644
--- a/.github/workflows/build_wheels_windows.yml
+++ b/.github/workflows/build_wheels_windows.yml
@@ -23,7 +23,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        python-version: ['3.7']
+        python-version: ['3.9']
         platform: [x86, x64]
         with_contrib: [0, 1]
         without_gui: [0, 1]
diff --git a/pyproject.toml b/pyproject.toml
index 7486f132..71de7f9b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,13 +4,9 @@ requires = [
   "numpy==1.13.3; python_version=='3.6' and platform_machine != 'aarch64' and platform_machine != 'arm64'",
   "numpy==1.17.0; python_version=='3.7' and platform_machine != 'aarch64' and platform_machine != 'arm64'",
   "numpy==1.17.5; python_version=='3.8' and platform_machine != 'aarch64' and platform_machine != 'arm64'",
-  "numpy==1.19.3; python_version<='3.9' and sys_platform == 'linux' and platform_machine == 'aarch64'",
-  "numpy==1.21.0; python_version<='3.9' and sys_platform == 'darwin' and platform_machine == 'arm64'",
-  "numpy==1.19.3; python_version=='3.9' and platform_machine != 'aarch64' and platform_machine != 'arm64'",
-  "numpy==1.21.2; python_version=='3.10' and platform_system!='Darwin'",
-  "numpy==1.21.4; python_version=='3.10' and platform_system=='Darwin'",
-  "numpy==1.23.5; python_version=='3.11'",
-  "numpy>=1.26.4; python_version>='3.12'",
+  "numpy==1.19.3; python_version<'3.9' and sys_platform == 'linux' and platform_machine == 'aarch64'",
+  "numpy==1.21.0; python_version<'3.9' and sys_platform == 'darwin' and platform_machine == 'arm64'",
+  "numpy>=2.0.0;  python_version>='3.9'",
   "pip",
   "scikit-build>=0.14.0",
   "setuptools==59.2.0",

From 92204bda0e8cca6a8e76aa25005ca7af5d220131 Mon Sep 17 00:00:00 2001
From: Lukas Hennies <45569834+Gornoka@users.noreply.github.com>
Date: Tue, 16 Jul 2024 16:40:52 +0200
Subject: [PATCH 33/59] chore: minor text fixes in readme

found typo while waiting for clone, maybe it saves someone else 2s of confusion.
---
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/README.md b/README.md
index aa19f439..03396b56 100644
--- a/README.md
+++ b/README.md
@@ -157,7 +157,7 @@ If some dependency is not enabled in the pre-built wheels, you can also run the
 4. Select the package flavor which you wish to build with `ENABLE_CONTRIB` and `ENABLE_HEADLESS`: i.e. `export ENABLE_CONTRIB=1` if you wish to build `opencv-contrib-python`
 5. Run ``pip wheel . --verbose``. NOTE: make sure you have the latest ``pip`` version, the ``pip wheel`` command replaces the old ``python setup.py bdist_wheel`` command which does not support ``pyproject.toml``.
     - this might take anything from 5 minutes to over 2 hours depending on your hardware
-6. Pip will print fresh will location at the end of build procedure. If you use old approach with `setup.py` file wheel package will be placed in `dist` folder. Package is ready and you can do with that whatever you wish.
+6. Pip will print fresh wheel location at the end of build procedure. If you use old approach with `setup.py` file wheel package will be placed in `dist` folder. Package is ready and you can do with that whatever you wish.
     - Optional: on Linux use some of the `manylinux` images as a build hosts if maximum portability is needed and run `auditwheel` for the wheel after build
     - Optional: on macOS use ``delocate`` (same as ``auditwheel`` but for macOS) for better portability
 

From f9577797693ad3750d0fab0330b044b249068653 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dr=2E=20Artificial=E6=9B=BE=E5=B0=8F=E5=81=A5?=
 <875100501@qq.com>
Date: Sun, 11 Aug 2024 23:17:32 +0800
Subject: [PATCH 34/59] fix

fix
---
 README.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 03396b56..3a4b46c2 100644
--- a/README.md
+++ b/README.md
@@ -249,6 +249,6 @@ Starting from 4.2.0 and 3.4.9 builds the macOS Travis build environment was upda
 
 Starting from 4.3.0 and 3.4.10 builds the Linux build environment was updated from `manylinux1` to `manylinux2014`. This dropped support for old Linux distributions.
 
-Starting from version 4.7.0 the Mac OS GitHub Actions build environment was update to version 11. Mac OS 10.x support depricated. See https://github.com/actions/runner-images/issues/5583
+Starting from version 4.7.0 the Mac OS GitHub Actions build environment was update to version 11. Mac OS 10.x support deprecated. See https://github.com/actions/runner-images/issues/5583
 
-Starting from version 4.9.0 the Mac OS GitHub Actions build environment was update to version 12. Mac OS 10.x support depricated by Brew and most of used packages.
+Starting from version 4.9.0 the Mac OS GitHub Actions build environment was update to version 12. Mac OS 10.x support deprecated by Brew and most of used packages.

From ec3604aae5cd0bee4b05dbf102dc3956728b4eff Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <2536374+asmorkalov@users.noreply.github.com>
Date: Tue, 3 Dec 2024 15:39:28 +0300
Subject: [PATCH 35/59] Revert "5.x merge 4.x and submodules update"

---
 .gitmodules     | 3 ---
 find_version.py | 2 +-
 opencv          | 2 +-
 opencv_contrib  | 2 +-
 opencv_extra    | 2 +-
 pyproject.toml  | 2 +-
 setup.py        | 2 +-
 7 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/.gitmodules b/.gitmodules
index 99476363..7193d3b9 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,15 +1,12 @@
 [submodule "opencv"]
 	path = opencv
 	url = https://github.com/opencv/opencv.git
-	branch = 5.x
 [submodule "opencv_contrib"]
 	path = opencv_contrib
 	url = https://github.com/opencv/opencv_contrib.git
-	branch = 5.x
 [submodule "multibuild"]
 	path = multibuild
 	url = https://github.com/multi-build/multibuild.git
 [submodule "opencv_extra"]
 	path = opencv_extra
 	url = https://github.com/opencv/opencv_extra.git
-	branch = 5.x
diff --git a/find_version.py b/find_version.py
index 274c93e6..13e8003c 100644
--- a/find_version.py
+++ b/find_version.py
@@ -65,7 +65,7 @@
     else:
         # local version identifier, not to be published on PyPI
         version = git_hash
-        opencv_version += ".{}".format(version)
+        opencv_version += "+{}".format(version)
 
     with open("cv2/version.py", "w") as f:
         f.write('opencv_version = "{}"\n'.format(opencv_version))
diff --git a/opencv b/opencv
index b31bc1a2..71d3237a 160000
--- a/opencv
+++ b/opencv
@@ -1 +1 @@
-Subproject commit b31bc1a2954e22d87f8384212c5e3dfbe7024f16
+Subproject commit 71d3237a093b60a27601c20e9ee6c3e52154e8b1
diff --git a/opencv_contrib b/opencv_contrib
index f7d6288a..1ed3dd2c 160000
--- a/opencv_contrib
+++ b/opencv_contrib
@@ -1 +1 @@
-Subproject commit f7d6288aeb38ff1b8af70ecf50a98258e8cd1bef
+Subproject commit 1ed3dd2c53888e3289afdb22ec4e9ebbff3dba87
diff --git a/opencv_extra b/opencv_extra
index 0e3b933a..dd1fbd07 160000
--- a/opencv_extra
+++ b/opencv_extra
@@ -1 +1 @@
-Subproject commit 0e3b933aa762b28b54a40034c58f8c734f1ed759
+Subproject commit dd1fbd0717ef4d83f86899b4144fdd9bc0364a5f
diff --git a/pyproject.toml b/pyproject.toml
index 270a25d1..71de7f9b 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,6 @@
 [build-system]
 requires = [
-  "cmake>=3.13",
+  "cmake>=3.1",
   "numpy==1.13.3; python_version=='3.6' and platform_machine != 'aarch64' and platform_machine != 'arm64'",
   "numpy==1.17.0; python_version=='3.7' and platform_machine != 'aarch64' and platform_machine != 'arm64'",
   "numpy==1.17.5; python_version=='3.8' and platform_machine != 'aarch64' and platform_machine != 'arm64'",
diff --git a/setup.py b/setup.py
index edf813b4..48d5a65f 100644
--- a/setup.py
+++ b/setup.py
@@ -140,7 +140,7 @@ def main():
         [ r"python/cv2/py.typed" ] if sys.version_info >= (3, 6) else []
         ,
         "cv2.data": [  # OPENCV_OTHER_INSTALL_PATH
-            ("etc" if os.name == "nt" else "share/opencv5") + r"/haarcascades/.*\.xml"
+            ("etc" if os.name == "nt" else "share/opencv4") + r"/haarcascades/.*\.xml"
         ],
         "cv2.gapi": [
             "python/cv2" + r"/gapi/.*\.py"

From 3f50d3281f82d1c6733bbb2872adacca29995e12 Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <2536374+asmorkalov@users.noreply.github.com>
Date: Tue, 3 Dec 2024 16:07:30 +0300
Subject: [PATCH 36/59] Linux dependencies update (#1052)

* Base manylinux2014 image update.
* Use command line git to checkout repo instead of actions step.
* Qt and others update.
* Updated submodules to current 4.x branch.
---
 .github/workflows/build_wheels_linux.yml     | 28 ++++++++++----------
 .github/workflows/build_wheels_linux_arm.yml | 18 ++++++-------
 docker/manylinux2014/Dockerfile_aarch64      | 12 ++++-----
 docker/manylinux2014/Dockerfile_x86_64       | 12 ++++-----
 opencv                                       |  2 +-
 opencv_contrib                               |  2 +-
 opencv_extra                                 |  2 +-
 patches/patchQtPlugins                       |  2 +-
 travis_config.sh                             |  2 +-
 9 files changed, 40 insertions(+), 40 deletions(-)

diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml
index 746395e4..9df69240 100644
--- a/.github/workflows/build_wheels_linux.yml
+++ b/.github/workflows/build_wheels_linux.yml
@@ -41,7 +41,7 @@ jobs:
       MB_ML_VER: 2014
       TRAVIS_BUILD_DIR: ${{ github.workspace }}
       CONFIG_PATH: travis_config.sh
-      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20240524
+      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20241202
       USE_CCACHE: 0
       UNICODE_WIDTH: 32
       PLAT: x86_64
@@ -58,10 +58,10 @@ jobs:
           echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
         fi
     - name: Checkout
-      uses: actions/checkout@v3
-      with:
-        submodules: false
-        fetch-depth: 0
+      run: |
+        echo "Source branch name: ${{ github.head_ref }}"
+        echo "Target branch name: ${{ github.base_ref }}"
+        git clone --depth 1 -b "${{ github.head_ref }}" "https://github.com/${{ github.event.pull_request.head.repo.full_name }}" "${{ github.workspace }}"
     - name: Build a package
       run: source scripts/build.sh
     - name: Saving all wheels
@@ -101,10 +101,10 @@ jobs:
       run: find . -mindepth 1 -delete
       working-directory: ${{ github.workspace }}
     - name: Checkout
-      uses: actions/checkout@v3
-      with:
-        submodules: true
-        fetch-depth: 0
+      run: |
+        echo "Source branch name: ${{ github.head_ref }}"
+        echo "Target branch name: ${{ github.base_ref }}"
+        git clone --depth 1 --recurse-submodules -b "${{ github.head_ref }}" "https://github.com/${{ github.event.pull_request.head.repo.full_name }}" "${{ github.workspace }}"
     - name: Setup Environment variables
       run: if [ "3.10" == "${{ matrix.python-version }}" -o "3.11" == "${{ matrix.python-version }}" -o "3.12" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
     - name: Download a wheel accordingly to matrix
@@ -139,7 +139,7 @@ jobs:
       NP_TEST_DEP: numpy==1.19.4
       TRAVIS_BUILD_DIR: ${{ github.workspace }}
       CONFIG_PATH: travis_config.sh
-      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20240524
+      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20241202
       USE_CCACHE: 1
       UNICODE_WIDTH: 32
       SDIST: ${{ matrix.build_sdist || 0 }}
@@ -155,10 +155,10 @@ jobs:
           echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
         fi
     - name: Checkout
-      uses: actions/checkout@v3
-      with:
-        submodules: false
-        fetch-depth: 0
+      run: |
+        echo "Source branch name: ${{ github.head_ref }}"
+        echo "Target branch name: ${{ github.base_ref }}"
+        git clone --depth 1 -b "${{ github.head_ref }}" "https://github.com/${{ github.event.pull_request.head.repo.full_name }}" "${{ github.workspace }}"
     - name: Set up Python ${{ matrix.python-version }}
       uses: actions/setup-python@v4
       with:
diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml
index 928ded7d..bd5c0040 100644
--- a/.github/workflows/build_wheels_linux_arm.yml
+++ b/.github/workflows/build_wheels_linux_arm.yml
@@ -42,7 +42,7 @@ jobs:
       MB_ML_VER: 2014
       TRAVIS_BUILD_DIR: ${{ github.workspace }}
       CONFIG_PATH: travis_config.sh
-      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64:20240524
+      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64:20241202
       USE_CCACHE: 0
       UNICODE_WIDTH: 32
       SDIST: ${{ matrix.build_sdist || 0 }}
@@ -58,10 +58,10 @@ jobs:
           echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
         fi
     - name: Checkout
-      uses: actions/checkout@v3
-      with:
-        submodules: false
-        fetch-depth: 0
+      run: |
+        echo "Source branch name: ${{ github.head_ref }}"
+        echo "Target branch name: ${{ github.base_ref }}"
+        git clone --depth 1 -b "${{ github.head_ref }}" "https://github.com/${{ github.event.pull_request.head.repo.full_name }}" "${{ github.workspace }}"
     - name: Build a package
       run: source scripts/build.sh
     - name: Saving all wheels
@@ -103,10 +103,10 @@ jobs:
       run: find . -mindepth 1 -delete
       working-directory: ${{ github.workspace }}
     - name: Checkout
-      uses: actions/checkout@v3
-      with:
-        submodules: true
-        fetch-depth: 0
+      run: |
+        echo "Source branch name:  ${{ github.head_ref }}"
+        echo "Target branch name: ${{ github.base_ref }}"
+        git clone --depth 1 --recurse-submodules -b "${{ github.head_ref }}" "https://github.com/${{ github.event.pull_request.head.repo.full_name }}" "${{ github.workspace }}"
     - name: Setup Environment variables
       run: if [ "3.10" == "${{ matrix.python-version }}" -o "3.11" == "${{ matrix.python-version }}" -o "3.12" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
     - name: Download a wheel accordingly to matrix
diff --git a/docker/manylinux2014/Dockerfile_aarch64 b/docker/manylinux2014/Dockerfile_aarch64
index e19492ff..9a8bfdde 100644
--- a/docker/manylinux2014/Dockerfile_aarch64
+++ b/docker/manylinux2014/Dockerfile_aarch64
@@ -1,16 +1,16 @@
-# Version: 20240524
+# Version: 20241202
 # Image name: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64
 
 FROM quay.io/pypa/manylinux2014_aarch64:latest
 
 ARG CCACHE_VERSION=3.7.9
-ARG FFMPEG_VERSION=5.1.4
-ARG FREETYPE_VERSION=2.13.2
-ARG LIBPNG_VERSION=1.6.43
-ARG VPX_VERSION=v1.14.0
+ARG FFMPEG_VERSION=5.1.6
+ARG FREETYPE_VERSION=2.13.3
+ARG LIBPNG_VERSION=1.6.44
+ARG VPX_VERSION=v1.15.0
 ARG NASM_VERSION=2.15.04
 ARG OPENSSL_VERSION=1_1_1w
-ARG QT_VERSION=5.15.13
+ARG QT_VERSION=5.15.16
 ARG YASM_VERSION=1.3.0
 
 ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH
diff --git a/docker/manylinux2014/Dockerfile_x86_64 b/docker/manylinux2014/Dockerfile_x86_64
index eceae25e..088d8df5 100644
--- a/docker/manylinux2014/Dockerfile_x86_64
+++ b/docker/manylinux2014/Dockerfile_x86_64
@@ -1,16 +1,16 @@
-# Version: 20240524
+# Version: 20241202
 # Image name: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64
 
 FROM quay.io/pypa/manylinux2014_x86_64:latest
 
 ARG CCACHE_VERSION=3.7.9
-ARG FFMPEG_VERSION=5.1.4
-ARG FREETYPE_VERSION=2.13.2
-ARG LIBPNG_VERSION=1.6.43
-ARG VPX_VERSION=v1.14.0
+ARG FFMPEG_VERSION=5.1.6
+ARG FREETYPE_VERSION=2.13.3
+ARG LIBPNG_VERSION=1.6.44
+ARG VPX_VERSION=v1.15.0
 ARG NASM_VERSION=2.15.04
 ARG OPENSSL_VERSION=1_1_1w
-ARG QT_VERSION=5.15.13
+ARG QT_VERSION=5.15.16
 ARG YASM_VERSION=1.3.0
 
 ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH
diff --git a/opencv b/opencv
index 71d3237a..03cedee0 160000
--- a/opencv
+++ b/opencv
@@ -1 +1 @@
-Subproject commit 71d3237a093b60a27601c20e9ee6c3e52154e8b1
+Subproject commit 03cedee0b0258875eafd1576b59d686ba805da7a
diff --git a/opencv_contrib b/opencv_contrib
index 1ed3dd2c..67337620 160000
--- a/opencv_contrib
+++ b/opencv_contrib
@@ -1 +1 @@
-Subproject commit 1ed3dd2c53888e3289afdb22ec4e9ebbff3dba87
+Subproject commit 673376203b0a8371a31ec5e8f08910a9744c0f32
diff --git a/opencv_extra b/opencv_extra
index dd1fbd07..08fe33c7 160000
--- a/opencv_extra
+++ b/opencv_extra
@@ -1 +1 @@
-Subproject commit dd1fbd0717ef4d83f86899b4144fdd9bc0364a5f
+Subproject commit 08fe33c733cabec70ffb6e5eac49708b073e5277
diff --git a/patches/patchQtPlugins b/patches/patchQtPlugins
index 70c6975a..b274aa08 100644
--- a/patches/patchQtPlugins
+++ b/patches/patchQtPlugins
@@ -9,7 +9,7 @@ index 4c0b3880fc..dffa0a4caa 100644
 +      install(DIRECTORY ${Qt5_DIR}/../../../plugins DESTINATION lib/qt)
 +    endif()
 +    if(UNIX AND NOT APPLE)
-+      install(DIRECTORY /opt/Qt5.15.13/plugins DESTINATION lib/qt)
++      install(DIRECTORY /opt/Qt5.15.16/plugins DESTINATION lib/qt)
 +      install(DIRECTORY /usr/share/fonts DESTINATION lib/qt)
 +    endif()
      if(HAVE_QT_OPENGL)
diff --git a/travis_config.sh b/travis_config.sh
index 903ceafb..fcdd4f60 100644
--- a/travis_config.sh
+++ b/travis_config.sh
@@ -34,7 +34,7 @@ if [ -n "$IS_OSX" ]; then
   export MAKEFLAGS="-j$(sysctl -n hw.ncpu)"
 else
   echo "    > Linux environment "
-  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/Qt5.15.13/lib
+  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/Qt5.15.16/lib
   export MAKEFLAGS="-j$(grep -E '^processor[[:space:]]*:' /proc/cpuinfo | wc -l)"
   CURRENT_ARCH=$(uname -m)
   if [[ $CURRENT_ARCH == 'aarch64' ]]; then

From b12aea12d288351b542a83d98333a35c95eb1dea Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@opencv.ai>
Date: Wed, 4 Dec 2024 11:10:09 +0300
Subject: [PATCH 37/59] Try to update to macos-13 to fix home brew
 dependencies.

---
 .github/workflows/build_wheels_macos.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml
index 97df456e..6940cc55 100644
--- a/.github/workflows/build_wheels_macos.yml
+++ b/.github/workflows/build_wheels_macos.yml
@@ -20,7 +20,7 @@ on:
 
 jobs:
   Build:
-    runs-on: macos-12
+    runs-on: macos-13
     defaults:
       run:
         shell: bash
@@ -98,7 +98,7 @@ jobs:
 
   Test:
     needs: [Build]
-    runs-on: macos-12
+    runs-on: macos-13
     defaults:
       run:
         shell: bash

From d23e79634dc0f6014b6b879d80626dd993a87705 Mon Sep 17 00:00:00 2001
From: Bill Clark <saikbc89@gmail.com>
Date: Thu, 12 Dec 2024 11:26:20 -0500
Subject: [PATCH 38/59] Update pyproject.toml

Attempting to get building on 3.12
---
 pyproject.toml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/pyproject.toml b/pyproject.toml
index 71de7f9b..10201b8c 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -9,5 +9,6 @@ requires = [
   "numpy>=2.0.0;  python_version>='3.9'",
   "pip",
   "scikit-build>=0.14.0",
-  "setuptools==59.2.0",
+  "setuptools==59.2.0; python_version<'3.12'",
+  "setuptools<70.0.0; python_version>='3.12'",
 ]

From ae90ee753908ae55fd3045719408441c6b18af67 Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@opencv.ai>
Date: Tue, 24 Dec 2024 09:00:35 +0300
Subject: [PATCH 39/59] Submodules update to 4.11.0-pre

---
 .github/workflows/build_wheels_macos_m1.yml | 2 +-
 opencv                                      | 2 +-
 opencv_contrib                              | 2 +-
 opencv_extra                                | 2 +-
 setup.py                                    | 6 ------
 5 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml
index a3bcac63..dd119fcb 100644
--- a/.github/workflows/build_wheels_macos_m1.yml
+++ b/.github/workflows/build_wheels_macos_m1.yml
@@ -20,7 +20,7 @@ on:
 
 jobs:
   Build:
-    runs-on: python-macos11-m1
+    runs-on: python-macos12-m1
     strategy:
       fail-fast: false
       matrix:
diff --git a/opencv b/opencv
index 03cedee0..b42075f3 160000
--- a/opencv
+++ b/opencv
@@ -1 +1 @@
-Subproject commit 03cedee0b0258875eafd1576b59d686ba805da7a
+Subproject commit b42075f3e2c7eca4a12e55b32cfc95fa90982a21
diff --git a/opencv_contrib b/opencv_contrib
index 67337620..3e776c87 160000
--- a/opencv_contrib
+++ b/opencv_contrib
@@ -1 +1 @@
-Subproject commit 673376203b0a8371a31ec5e8f08910a9744c0f32
+Subproject commit 3e776c876ef8527ad639d2c792521b6cede291e5
diff --git a/opencv_extra b/opencv_extra
index 08fe33c7..a74cf6ba 160000
--- a/opencv_extra
+++ b/opencv_extra
@@ -1 +1 @@
-Subproject commit 08fe33c733cabec70ffb6e5eac49708b073e5277
+Subproject commit a74cf6bae7fd75d91282b877c559168b3a62148a
diff --git a/setup.py b/setup.py
index 48d5a65f..fd4181d0 100644
--- a/setup.py
+++ b/setup.py
@@ -115,12 +115,6 @@ def main():
             else []
         )
         +
-        (
-            [r"lib/libOrbbecSDK.dylib", r"lib/libOrbbecSDK.\d.\d.dylib", r"lib/libOrbbecSDK.\d.\d.\d.dylib"]
-            if platform.system() == "Darwin" and platform.machine() == "arm64"
-            else []
-        )
-        +
         # In Windows, in python/X.Y/<arch>/; in Linux, in just python/X.Y/.
         # Naming conventions vary so widely between versions and OSes
         # had to give up on checking them.

From ef9443d618d0b297b75c6cfb276beadcebf3dedc Mon Sep 17 00:00:00 2001
From: mayeut <mayeut@users.noreply.github.com>
Date: Sat, 21 Sep 2024 21:22:52 +0200
Subject: [PATCH 40/59] fix: add CMake as a build requirement only if required

The PyPI distribution of CMake shall not be listed as an unconditional build requirement.
It shall only be added as a build requirement if not installed or too low a version.

This helps building from sources on platforms where no wheels are available for CMake but the system already provides a recent enough CMake version.

In case of error checking the version, the backend falls back to using the PyPI distribution of CMake.
---
 MANIFEST.in               |  1 +
 _build_backend/backend.py | 23 +++++++++++++++++++++++
 pyproject.toml            |  6 +++++-
 3 files changed, 29 insertions(+), 1 deletion(-)
 create mode 100644 _build_backend/backend.py

diff --git a/MANIFEST.in b/MANIFEST.in
index b429eae0..cb9a7e7b 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -4,6 +4,7 @@ include README.md
 include find_version.py
 include setup.py
 include pyproject.toml
+include _build_backend/backend.py
 recursive-include cv2 *
 recursive-include docker *
 recursive-include opencv *
diff --git a/_build_backend/backend.py b/_build_backend/backend.py
new file mode 100644
index 00000000..7fc84138
--- /dev/null
+++ b/_build_backend/backend.py
@@ -0,0 +1,23 @@
+from setuptools import build_meta as _orig
+
+prepare_metadata_for_build_wheel = _orig.prepare_metadata_for_build_wheel
+build_wheel = _orig.build_wheel
+build_sdist = _orig.build_sdist
+get_requires_for_build_sdist = _orig.get_requires_for_build_sdist
+
+def get_requires_for_build_wheel(config_settings=None):
+    from packaging import version
+    from skbuild.exceptions import SKBuildError
+    from skbuild.cmaker import get_cmake_version
+    packages = _orig.get_requires_for_build_wheel(config_settings)
+    # check if system cmake can be used if present
+    # if not, append cmake PyPI distribution to required packages
+    # scikit-build>=0.18 itself requires cmake 3.5+
+    min_version = "3.5"
+    try:
+        if version.parse(get_cmake_version().split("-")[0]) < version.parse(min_version):
+            packages.append(f'cmake>={min_version}')
+    except SKBuildError:
+        packages.append(f'cmake>={min_version}')
+
+    return packages
diff --git a/pyproject.toml b/pyproject.toml
index 71de7f9b..7a37ec46 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,13 +1,17 @@
 [build-system]
 requires = [
-  "cmake>=3.1",
   "numpy==1.13.3; python_version=='3.6' and platform_machine != 'aarch64' and platform_machine != 'arm64'",
   "numpy==1.17.0; python_version=='3.7' and platform_machine != 'aarch64' and platform_machine != 'arm64'",
   "numpy==1.17.5; python_version=='3.8' and platform_machine != 'aarch64' and platform_machine != 'arm64'",
   "numpy==1.19.3; python_version<'3.9' and sys_platform == 'linux' and platform_machine == 'aarch64'",
   "numpy==1.21.0; python_version<'3.9' and sys_platform == 'darwin' and platform_machine == 'arm64'",
   "numpy>=2.0.0;  python_version>='3.9'",
+  "packaging",
   "pip",
   "scikit-build>=0.14.0",
   "setuptools==59.2.0",
 ]
+# use a custom backend to manage CMake check / installation
+# see https://scikit-build.readthedocs.io/en/latest/usage.html#adding-cmake-as-building-requirement-only-if-not-installed-or-too-low-a-version
+build-backend = "backend"
+backend-path = ["_build_backend"]

From 02648ce49748032a78937c8cdb8c015577b9ff2a Mon Sep 17 00:00:00 2001
From: Zhanwen Chen <phil.zhanwen.chen@gmail.com>
Date: Fri, 14 Jun 2024 16:55:51 -0700
Subject: [PATCH 41/59] Fix Python Source RelPath for PY_LIMITED_API=OFF

---
 setup.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/setup.py b/setup.py
index fd4181d0..4f50b3e3 100644
--- a/setup.py
+++ b/setup.py
@@ -118,8 +118,11 @@ def main():
         # In Windows, in python/X.Y/<arch>/; in Linux, in just python/X.Y/.
         # Naming conventions vary so widely between versions and OSes
         # had to give up on checking them.
+        # If not specifying PY_LIMITED_API, the Python sources go under python/cv2/python-3.MINOR_VERSION/ instead of python/cv2/python-3/
         [
-            r"python/cv2/python-%s/cv2.*"
+            r"python/cv2/python-%s*/cv2.*"
+            % (sys.version_info[0]) if 'CMAKE_ARGS' in os.environ and "-DPYTHON3_LIMITED_API=ON" in os.environ['CMAKE_ARGS']
+            else r"python/cv2/python-%s.*/cv2.*"
             % (sys.version_info[0])
         ]
         +

From 5da0b6e74467b3be2bd297dbb565b30661c77ebf Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@opencv.ai>
Date: Mon, 13 Jan 2025 18:06:49 +0300
Subject: [PATCH 42/59] Add NASM assembler to Windows build for jpeg-turbo.

---
 .github/workflows/build_wheels_windows.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index d69f17ec..4469f7b9 100644
--- a/.github/workflows/build_wheels_windows.yml
+++ b/.github/workflows/build_wheels_windows.yml
@@ -59,6 +59,8 @@ jobs:
         architecture: ${{ matrix.platform }}
     - name: Setup MSBuild.exe
       uses: microsoft/setup-msbuild@v1.1
+    - name: Setup NASM
+      uses: ilammy/setup-nasm@v1
     - name: Build a package
       # CMake 3.25 regression fix. See https://stackoverflow.com/questions/74162633/problem-compiling-from-source-opencv-with-mvsc2019-in-64-bit-version
       run: |

From 58257dc9079d94afd319bd8b863dd884582ea6e0 Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
Date: Thu, 9 Jan 2025 15:23:43 +0300
Subject: [PATCH 43/59] Switched to tag 4.11.0

---
 .github/workflows/build_wheels_macos_m1.yml | 4 ++--
 opencv                                      | 2 +-
 opencv_contrib                              | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml
index dd119fcb..effc27fe 100644
--- a/.github/workflows/build_wheels_macos_m1.yml
+++ b/.github/workflows/build_wheels_macos_m1.yml
@@ -54,7 +54,7 @@ jobs:
         git submodule update --init multibuild
         echo $ENABLE_CONTRIB > contrib.enabled
         echo $ENABLE_HEADLESS > headless.enabled
-        export MACOSX_DEPLOYMENT_TARGET=11.0
+        export MACOSX_DEPLOYMENT_TARGET=13.0
         python${{ matrix.python-version }} -m pip install toml && python${{ matrix.python-version }} -c 'import toml; c = toml.load("pyproject.toml"); print("\n".join(c["build-system"]["requires"]))' | python${{ matrix.python-version }} -m pip install -r /dev/stdin
         python${{ matrix.python-version }} setup.py bdist_wheel --py-limited-api=cp37 --dist-dir=wheelhouse -v
         delocate-wheel ${{ github.workspace }}/wheelhouse/opencv*
@@ -71,7 +71,7 @@ jobs:
 
   Test:
     needs: [Build]
-    runs-on: opencv-cn-mac-arm64-tests
+    runs-on: python-macos12-m1
     strategy:
       fail-fast: false
       matrix:
diff --git a/opencv b/opencv
index b42075f3..31b0eeea 160000
--- a/opencv
+++ b/opencv
@@ -1 +1 @@
-Subproject commit b42075f3e2c7eca4a12e55b32cfc95fa90982a21
+Subproject commit 31b0eeea0b44b370fd0712312df4214d4ae1b158
diff --git a/opencv_contrib b/opencv_contrib
index 3e776c87..0e5254eb 160000
--- a/opencv_contrib
+++ b/opencv_contrib
@@ -1 +1 @@
-Subproject commit 3e776c876ef8527ad639d2c792521b6cede291e5
+Subproject commit 0e5254ebf54d2aed6e7eaf6660bf3b797cf50a02

From ca68df575d75c916097c642f5f0c508e38b7c2e7 Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@opencv.ai>
Date: Wed, 15 Jan 2025 12:50:06 +0300
Subject: [PATCH 44/59] Python 3.13 support.

---
 .github/workflows/build_wheels_linux.yml     | 6 +++---
 .github/workflows/build_wheels_linux_arm.yml | 6 +++---
 .github/workflows/build_wheels_macos.yml     | 6 +++---
 .github/workflows/build_wheels_macos_m1.yml  | 2 +-
 .github/workflows/build_wheels_windows.yml   | 2 +-
 setup.py                                     | 1 +
 6 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml
index 9df69240..653d4975 100644
--- a/.github/workflows/build_wheels_linux.yml
+++ b/.github/workflows/build_wheels_linux.yml
@@ -84,7 +84,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
+        python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
         platform: [x64]
         with_contrib: [0, 1]
         without_gui: [0, 1]
@@ -93,7 +93,7 @@ jobs:
       ACTIONS_ALLOW_UNSECURE_COMMANDS: true
       MB_PYTHON_VERSION: ${{ matrix.python-version }}
       NP_TEST_DEP: numpy==1.19.4
-      NP_TEST_DEP_LATEST: numpy==2.0.0
+      NP_TEST_DEP_LATEST: numpy==2.2.1
       CONFIG_PATH: travis_config.sh
       PLAT: x86_64
     steps:
@@ -106,7 +106,7 @@ jobs:
         echo "Target branch name: ${{ github.base_ref }}"
         git clone --depth 1 --recurse-submodules -b "${{ github.head_ref }}" "https://github.com/${{ github.event.pull_request.head.repo.full_name }}" "${{ github.workspace }}"
     - name: Setup Environment variables
-      run: if [ "3.10" == "${{ matrix.python-version }}" -o "3.11" == "${{ matrix.python-version }}" -o "3.12" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
+      run: if [ "3.10" == "${{ matrix.python-version }}" -o "3.11" == "${{ matrix.python-version }}" -o "3.12" == "${{ matrix.python-version }}" -o "3.13" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
     - name: Download a wheel accordingly to matrix
       uses: actions/download-artifact@v3
       with:
diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml
index bd5c0040..385f696d 100644
--- a/.github/workflows/build_wheels_linux_arm.yml
+++ b/.github/workflows/build_wheels_linux_arm.yml
@@ -84,7 +84,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
+        python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
         platform: [x64]
         with_contrib: [0, 1]
         without_gui: [0, 1]
@@ -94,7 +94,7 @@ jobs:
       MB_PYTHON_VERSION: ${{ matrix.python-version }}
       PLAT: aarch64
       NP_TEST_DEP: numpy==1.19.4
-      NP_TEST_DEP_LATEST: numpy==2.0.0
+      NP_TEST_DEP_LATEST: numpy==2.2.1
       CONFIG_PATH: travis_config.sh
       DOCKER_TEST_IMAGE: multibuild/focal_arm64v8
       UNICODE_WIDTH: 32
@@ -108,7 +108,7 @@ jobs:
         echo "Target branch name: ${{ github.base_ref }}"
         git clone --depth 1 --recurse-submodules -b "${{ github.head_ref }}" "https://github.com/${{ github.event.pull_request.head.repo.full_name }}" "${{ github.workspace }}"
     - name: Setup Environment variables
-      run: if [ "3.10" == "${{ matrix.python-version }}" -o "3.11" == "${{ matrix.python-version }}" -o "3.12" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
+      run: if [ "3.10" == "${{ matrix.python-version }}" -o "3.11" == "${{ matrix.python-version }}" -o "3.12" == "${{ matrix.python-version }}" -o "3.13" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
     - name: Download a wheel accordingly to matrix
       uses: actions/download-artifact@v3
       with:
diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml
index 6940cc55..eb797d46 100644
--- a/.github/workflows/build_wheels_macos.yml
+++ b/.github/workflows/build_wheels_macos.yml
@@ -105,7 +105,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
+        python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
         platform: [x64]
         with_contrib: [0, 1]
         without_gui: [0, 1]
@@ -114,7 +114,7 @@ jobs:
       ACTIONS_ALLOW_UNSECURE_COMMANDS: true
       MB_PYTHON_VERSION: ${{ matrix.python-version }}
       NP_TEST_DEP: numpy==1.19.4
-      NP_TEST_DEP_LATEST: numpy==2.0.0
+      NP_TEST_DEP_LATEST: numpy==2.2.1
       CONFIG_PATH: travis_config.sh
       PLAT: x86_64
       OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata
@@ -134,7 +134,7 @@ jobs:
         python-version: ${{ matrix.python-version }}
         architecture: ${{ matrix.platform }}
     - name: Setup Environment variables
-      run: if [ "3.10" == "${{ matrix.python-version }}" -o "3.11" == "${{ matrix.python-version }}" -o "3.12" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
+      run: if ["3.10" == "${{ matrix.python-version }}" -o "3.11" == "${{ matrix.python-version }}" -o "3.12" == "${{ matrix.python-version }}" -o "3.13" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
     - name: Download a wheel accordingly to matrix
       uses: actions/download-artifact@v3
       with:
diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml
index effc27fe..ffbdc752 100644
--- a/.github/workflows/build_wheels_macos_m1.yml
+++ b/.github/workflows/build_wheels_macos_m1.yml
@@ -75,7 +75,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
+        python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
         platform: [x64]
         with_contrib: [0, 1]
         without_gui: [0, 1]
diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index 4469f7b9..bb7b548b 100644
--- a/.github/workflows/build_wheels_windows.yml
+++ b/.github/workflows/build_wheels_windows.yml
@@ -91,7 +91,7 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
-        python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
+        python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
         platform: [x86, x64]
         with_contrib: [0, 1]
         without_gui: [0, 1]
diff --git a/setup.py b/setup.py
index 4f50b3e3..1dfab2fb 100644
--- a/setup.py
+++ b/setup.py
@@ -303,6 +303,7 @@ def main():
             "Programming Language :: Python :: 3.10",
             "Programming Language :: Python :: 3.11",
             "Programming Language :: Python :: 3.12",
+            "Programming Language :: Python :: 3.13",
             "Programming Language :: C++",
             "Programming Language :: Python :: Implementation :: CPython",
             "Topic :: Scientific/Engineering",

From 28172087e47d6575ecd6853b2915e1e679f5fb6f Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@opencv.ai>
Date: Thu, 16 Jan 2025 11:08:39 +0300
Subject: [PATCH 45/59] Reverted back to Github actions checkout as self-made
 command does not handle releases.

---
 .github/workflows/build_wheels_linux.yml     | 24 ++++++++++----------
 .github/workflows/build_wheels_linux_arm.yml | 16 ++++++-------
 2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml
index 653d4975..7bfe8cec 100644
--- a/.github/workflows/build_wheels_linux.yml
+++ b/.github/workflows/build_wheels_linux.yml
@@ -58,10 +58,10 @@ jobs:
           echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
         fi
     - name: Checkout
-      run: |
-        echo "Source branch name: ${{ github.head_ref }}"
-        echo "Target branch name: ${{ github.base_ref }}"
-        git clone --depth 1 -b "${{ github.head_ref }}" "https://github.com/${{ github.event.pull_request.head.repo.full_name }}" "${{ github.workspace }}"
+      uses: actions/checkout@v3
+      with:
+        submodules: false
+        fetch-depth: 0
     - name: Build a package
       run: source scripts/build.sh
     - name: Saving all wheels
@@ -101,10 +101,10 @@ jobs:
       run: find . -mindepth 1 -delete
       working-directory: ${{ github.workspace }}
     - name: Checkout
-      run: |
-        echo "Source branch name: ${{ github.head_ref }}"
-        echo "Target branch name: ${{ github.base_ref }}"
-        git clone --depth 1 --recurse-submodules -b "${{ github.head_ref }}" "https://github.com/${{ github.event.pull_request.head.repo.full_name }}" "${{ github.workspace }}"
+      uses: actions/checkout@v3
+      with:
+        submodules: true
+        fetch-depth: 0
     - name: Setup Environment variables
       run: if [ "3.10" == "${{ matrix.python-version }}" -o "3.11" == "${{ matrix.python-version }}" -o "3.12" == "${{ matrix.python-version }}" -o "3.13" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
     - name: Download a wheel accordingly to matrix
@@ -155,10 +155,10 @@ jobs:
           echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
         fi
     - name: Checkout
-      run: |
-        echo "Source branch name: ${{ github.head_ref }}"
-        echo "Target branch name: ${{ github.base_ref }}"
-        git clone --depth 1 -b "${{ github.head_ref }}" "https://github.com/${{ github.event.pull_request.head.repo.full_name }}" "${{ github.workspace }}"
+      uses: actions/checkout@v3
+      with:
+        submodules: false
+        fetch-depth: 0
     - name: Set up Python ${{ matrix.python-version }}
       uses: actions/setup-python@v4
       with:
diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml
index 385f696d..d643ba8e 100644
--- a/.github/workflows/build_wheels_linux_arm.yml
+++ b/.github/workflows/build_wheels_linux_arm.yml
@@ -58,10 +58,10 @@ jobs:
           echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
         fi
     - name: Checkout
-      run: |
-        echo "Source branch name: ${{ github.head_ref }}"
-        echo "Target branch name: ${{ github.base_ref }}"
-        git clone --depth 1 -b "${{ github.head_ref }}" "https://github.com/${{ github.event.pull_request.head.repo.full_name }}" "${{ github.workspace }}"
+      uses: actions/checkout@v3
+      with:
+        submodules: false
+        fetch-depth: 0
     - name: Build a package
       run: source scripts/build.sh
     - name: Saving all wheels
@@ -103,10 +103,10 @@ jobs:
       run: find . -mindepth 1 -delete
       working-directory: ${{ github.workspace }}
     - name: Checkout
-      run: |
-        echo "Source branch name:  ${{ github.head_ref }}"
-        echo "Target branch name: ${{ github.base_ref }}"
-        git clone --depth 1 --recurse-submodules -b "${{ github.head_ref }}" "https://github.com/${{ github.event.pull_request.head.repo.full_name }}" "${{ github.workspace }}"
+      uses: actions/checkout@v3
+      with:
+        submodules: true
+        fetch-depth: 0
     - name: Setup Environment variables
       run: if [ "3.10" == "${{ matrix.python-version }}" -o "3.11" == "${{ matrix.python-version }}" -o "3.12" == "${{ matrix.python-version }}" -o "3.13" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
     - name: Download a wheel accordingly to matrix

From fc127ae098f394313ca26bac1435aafa448a312c Mon Sep 17 00:00:00 2001
From: Aditya Kumar <as1100k@outlook.in>
Date: Sun, 20 Apr 2025 08:33:21 +0530
Subject: [PATCH 46/59] Update README.md

---
 README.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/README.md b/README.md
index 3a4b46c2..6de64d64 100644
--- a/README.md
+++ b/README.md
@@ -242,6 +242,7 @@ Python 3.x compatible pre-built wheels are provided for the officially supported
 - 3.10
 - 3.11
 - 3.12
+- 3.13
 
 ### Backward compatibility
 

From 2606a6032ee8206f331e927041d9d7cf67fb9980 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 19 May 2025 09:22:36 +0300
Subject: [PATCH 47/59] Merge pull request #1100 from avdivan:4.x

* Update build_wheels_windows.yml
* Update setup.py
---
 .github/workflows/build_wheels_windows.yml | 24 ++++++++--------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index bb7b548b..a1a36ff8 100644
--- a/.github/workflows/build_wheels_windows.yml
+++ b/.github/workflows/build_wheels_windows.yml
@@ -72,12 +72,7 @@ jobs:
         set "CI_BUILD=1" && python setup.py bdist_wheel --py-limited-api=cp37 --dist-dir=%cd%\wheelhouse -v
       shell: cmd
     - name: Saving all wheels
-      uses: actions/upload-artifact@v3
-      with:
-        name: wheels
-        path: wheelhouse/opencv*.whl
-    - name: Saving a wheel accordingly to matrix
-      uses: actions/upload-artifact@v3
+      uses: actions/upload-artifact@v4
       with:
         name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}
         path: wheelhouse/opencv*
@@ -118,7 +113,7 @@ jobs:
         python-version: ${{ matrix.python-version }}
         architecture: ${{ matrix.platform }}
     - name: Download a wheel accordingly to matrix
-      uses: actions/download-artifact@v3
+      uses: actions/download-artifact@v4
       with:
         name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}
         path: wheelhouse/
@@ -142,15 +137,14 @@ jobs:
   Release_rolling:
     if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
     needs: [Build, Test]
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
     environment: opencv-python-rolling-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v3
+      - uses: actions/download-artifact@v4
         with:
-          name: wheels
           path: wheelhouse/
       - name: Upload wheels for opencv_python_rolling
         run: |
@@ -172,15 +166,14 @@ jobs:
   Pre-release:
     if: github.event_name == 'release' && github.event.release.prerelease
     needs: [Build, Test]
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
     environment: test-opencv-python-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v3
+      - uses: actions/download-artifact@v4
         with:
-          name: wheels
           path: wheelhouse/
       - name: Upload all wheels
         run: |
@@ -190,15 +183,14 @@ jobs:
   Release:
     if: github.event_name == 'release' && !github.event.release.prerelease
     needs: [Build, Test]
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
     environment: opencv-python-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v3
+      - uses: actions/download-artifact@v4
         with:
-          name: wheels
           path: wheelhouse/
       - name: Upload wheels for opencv_python
         run: |

From 6140e8595e208527d3893674b00408a70bed3c1b Mon Sep 17 00:00:00 2001
From: Alexander Alekhin <alexander.a.alekhin@gmail.com>
Date: Fri, 13 Jun 2025 06:49:01 +0000
Subject: [PATCH 48/59] setup.py: support patched sources, allow custom package
 name

---
 setup.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
 mode change 100644 => 100755 setup.py

diff --git a/setup.py b/setup.py
old mode 100644
new mode 100755
index 1dfab2fb..9aff8d23
--- a/setup.py
+++ b/setup.py
@@ -48,7 +48,7 @@ def main():
         "\\", "/"
     )
 
-    if os.path.exists(".git"):
+    if not bool(os.environ.get('OPENCV_PYTHON_SKIP_GIT_COMMANDS', False)) and os.path.exists(".git"):
         import pip._internal.vcs.git as git
 
         g = git.Git()  # NOTE: pip API's are internal, this has to be refactored
@@ -95,6 +95,8 @@ def main():
     if build_rolling:
         package_name += "-rolling"
 
+    package_name = os.environ.get('OPENCV_PYTHON_PACKAGE_NAME', package_name)
+
     long_description = io.open("README.md", encoding="utf-8").read()
 
     packages = ["cv2", "cv2.data"]

From dccecfa48612393ae7c11ccd1675b51f1a35612d Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <2536374+asmorkalov@users.noreply.github.com>
Date: Fri, 13 Jun 2025 12:52:46 +0300
Subject: [PATCH 49/59] Linux and Mac builds update (#1106)

* Base image update from ubuntu 20.04 to 22.04.

* Update dependencies.

* Removed double artifacts upload.

* Use fresh download step.

* Deduplicate wheels upload on Mac too.
---
 .github/workflows/build_wheels_linux.yml     | 31 ++++++++------------
 .github/workflows/build_wheels_linux_arm.yml | 21 +++++--------
 .github/workflows/build_wheels_macos.yml     | 21 +++++--------
 .github/workflows/build_wheels_macos_m1.yml  | 21 +++++--------
 4 files changed, 37 insertions(+), 57 deletions(-)

diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml
index 7bfe8cec..e32d6ae0 100644
--- a/.github/workflows/build_wheels_linux.yml
+++ b/.github/workflows/build_wheels_linux.yml
@@ -20,7 +20,7 @@ on:
 
 jobs:
   Build:
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
     defaults:
       run:
         shell: bash
@@ -64,20 +64,15 @@ jobs:
         fetch-depth: 0
     - name: Build a package
       run: source scripts/build.sh
-    - name: Saving all wheels
-      uses: actions/upload-artifact@v3
-      with:
-        name: wheels
-        path: wheelhouse/opencv*.whl
     - name: Saving a wheel accordingly to matrix
-      uses: actions/upload-artifact@v3
+      uses: actions/upload-artifact@v4
       with:
         name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
         path: wheelhouse/opencv*.whl
 
   Test:
     needs: [Build]
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
     defaults:
       run:
         shell: bash
@@ -108,7 +103,7 @@ jobs:
     - name: Setup Environment variables
       run: if [ "3.10" == "${{ matrix.python-version }}" -o "3.11" == "${{ matrix.python-version }}" -o "3.12" == "${{ matrix.python-version }}" -o "3.13" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
     - name: Download a wheel accordingly to matrix
-      uses: actions/download-artifact@v3
+      uses: actions/download-artifact@v4
       with:
         name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
         path: wheelhouse/
@@ -116,7 +111,7 @@ jobs:
       run: source scripts/install.sh
 
   Build_sdist:
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
     defaults:
       run:
         shell: bash
@@ -177,21 +172,21 @@ jobs:
         set -x
         echo "skipping tests because of sdist"
     - name: saving artifacts
-      uses: actions/upload-artifact@v3
+      uses: actions/upload-artifact@v4
       with:
-        name: wheels
+        name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
         path: dist/opencv*.tar.gz
 
   Release_rolling:
     if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
     needs: [Build, Test]
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
     environment: opencv-python-rolling-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v3
+      - uses: actions/download-artifact@v4
         with:
           name: wheels
           path: wheelhouse/
@@ -215,13 +210,13 @@ jobs:
   Pre-release:
     if: github.event_name == 'release' && github.event.release.prerelease
     needs: [Build, Build_sdist, Test]
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
     environment: test-opencv-python-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v3
+      - uses: actions/download-artifact@v4
         with:
           name: wheels
           path: wheelhouse/
@@ -233,13 +228,13 @@ jobs:
   Release:
     if: github.event_name == 'release' && !github.event.release.prerelease
     needs: [Build, Build_sdist, Test]
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
     environment: opencv-python-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v3
+      - uses: actions/download-artifact@v4
         with:
           name: wheels
           path: wheelhouse/
diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml
index d643ba8e..4c60bb76 100644
--- a/.github/workflows/build_wheels_linux_arm.yml
+++ b/.github/workflows/build_wheels_linux_arm.yml
@@ -64,13 +64,8 @@ jobs:
         fetch-depth: 0
     - name: Build a package
       run: source scripts/build.sh
-    - name: Saving all wheels
-      uses: actions/upload-artifact@v3
-      with:
-        name: wheels
-        path: wheelhouse/opencv*.whl
     - name: Saving a wheel accordingly to matrix
-      uses: actions/upload-artifact@v3
+      uses: actions/upload-artifact@v4
       with:
         name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
         path: wheelhouse/opencv*.whl
@@ -110,7 +105,7 @@ jobs:
     - name: Setup Environment variables
       run: if [ "3.10" == "${{ matrix.python-version }}" -o "3.11" == "${{ matrix.python-version }}" -o "3.12" == "${{ matrix.python-version }}" -o "3.13" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
     - name: Download a wheel accordingly to matrix
-      uses: actions/download-artifact@v3
+      uses: actions/download-artifact@v4
       with:
         name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
         path: wheelhouse/
@@ -120,13 +115,13 @@ jobs:
   Release_rolling:
     if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
     needs: [Build, Test]
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
     environment: opencv-python-rolling-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v3
+      - uses: actions/download-artifact@v4
         with:
           name: wheels
           path: wheelhouse/
@@ -150,13 +145,13 @@ jobs:
   Pre-release:
     if: github.event_name == 'release' && github.event.release.prerelease
     needs: [Build, Test]
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
     environment: test-opencv-python-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v3
+      - uses: actions/download-artifact@v4
         with:
           name: wheels
           path: wheelhouse/
@@ -168,13 +163,13 @@ jobs:
   Release:
     if: github.event_name == 'release' && !github.event.release.prerelease
     needs: [Build, Test]
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
     environment: opencv-python-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v3
+      - uses: actions/download-artifact@v4
         with:
           name: wheels
           path: wheelhouse/
diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml
index eb797d46..a1cad49e 100644
--- a/.github/workflows/build_wheels_macos.yml
+++ b/.github/workflows/build_wheels_macos.yml
@@ -85,13 +85,8 @@ jobs:
         echo $ENABLE_HEADLESS > headless.enabled
         set -x
         build_wheel $REPO_DIR $PLAT
-    - name: Saving all wheels
-      uses: actions/upload-artifact@v3
-      with:
-        name: wheels
-        path: wheelhouse/opencv*.whl
     - name: Saving a wheel accordingly to matrix
-      uses: actions/upload-artifact@v3
+      uses: actions/upload-artifact@v4
       with:
         name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
         path: wheelhouse/opencv*.whl
@@ -136,7 +131,7 @@ jobs:
     - name: Setup Environment variables
       run: if ["3.10" == "${{ matrix.python-version }}" -o "3.11" == "${{ matrix.python-version }}" -o "3.12" == "${{ matrix.python-version }}" -o "3.13" == "${{ matrix.python-version }}" ]; then echo "TEST_DEPENDS=$(echo $NP_TEST_DEP_LATEST)" >> $GITHUB_ENV; else echo "TEST_DEPENDS=$(echo $NP_TEST_DEP)" >> $GITHUB_ENV; fi
     - name: Download a wheel accordingly to matrix
-      uses: actions/download-artifact@v3
+      uses: actions/download-artifact@v4
       with:
         name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
         path: wheelhouse/
@@ -158,13 +153,13 @@ jobs:
   Release_rolling:
     if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
     needs: [Build, Test]
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
     environment: opencv-python-rolling-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v3
+      - uses: actions/download-artifact@v4
         with:
           name: wheels
           path: wheelhouse/
@@ -188,13 +183,13 @@ jobs:
   Pre-release:
     if: github.event_name == 'release' && github.event.release.prerelease
     needs: [Build, Test]
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
     environment: test-opencv-python-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v3
+      - uses: actions/download-artifact@v4
         with:
           name: wheels
           path: wheelhouse/
@@ -206,13 +201,13 @@ jobs:
   Release:
     if: github.event_name == 'release' && !github.event.release.prerelease
     needs: [Build, Test]
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
     environment: opencv-python-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v3
+      - uses: actions/download-artifact@v4
         with:
           name: wheels
           path: wheelhouse/
diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml
index ffbdc752..1e62c858 100644
--- a/.github/workflows/build_wheels_macos_m1.yml
+++ b/.github/workflows/build_wheels_macos_m1.yml
@@ -58,13 +58,8 @@ jobs:
         python${{ matrix.python-version }} -m pip install toml && python${{ matrix.python-version }} -c 'import toml; c = toml.load("pyproject.toml"); print("\n".join(c["build-system"]["requires"]))' | python${{ matrix.python-version }} -m pip install -r /dev/stdin
         python${{ matrix.python-version }} setup.py bdist_wheel --py-limited-api=cp37 --dist-dir=wheelhouse -v
         delocate-wheel ${{ github.workspace }}/wheelhouse/opencv*
-    - name: Saving all wheels
-      uses: actions/upload-artifact@v3
-      with:
-        name: wheels
-        path: wheelhouse/opencv*.whl
     - name: Saving a wheel accordingly to matrix
-      uses: actions/upload-artifact@v3
+      uses: actions/upload-artifact@v4
       with:
         name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
         path: wheelhouse/opencv*.whl
@@ -94,7 +89,7 @@ jobs:
         submodules: true
         fetch-depth: 0
     - name: Download a wheel accordingly to matrix
-      uses: actions/download-artifact@v3
+      uses: actions/download-artifact@v4
       with:
         name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}
         path: wheelhouse/
@@ -124,13 +119,13 @@ jobs:
   Release_rolling:
     if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
     needs: [Build, Test]
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
     environment: opencv-python-rolling-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v3
+      - uses: actions/download-artifact@v4
         with:
           name: wheels
           path: wheelhouse/
@@ -154,13 +149,13 @@ jobs:
   Pre-release:
     if: github.event_name == 'release' && github.event.release.prerelease
     needs: [Build, Test]
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
     environment: test-opencv-python-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v3
+      - uses: actions/download-artifact@v4
         with:
           name: wheels
           path: wheelhouse/
@@ -172,13 +167,13 @@ jobs:
   Release:
     if: github.event_name == 'release' && !github.event.release.prerelease
     needs: [Build, Test]
-    runs-on: ubuntu-20.04
+    runs-on: ubuntu-22.04
     environment: opencv-python-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v3
+      - uses: actions/download-artifact@v4
         with:
           name: wheels
           path: wheelhouse/

From b4e126ba2cf9bbe3a988ef61b74514f34e55986f Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <2536374+asmorkalov@users.noreply.github.com>
Date: Mon, 16 Jun 2025 06:25:40 +0300
Subject: [PATCH 50/59] Added libavif to the build environment (#1098)

* Added libavif to the build environment.

* Added license text for libavif and its dependencies.
---
 .github/workflows/build_wheels_linux.yml     |   4 +-
 .github/workflows/build_wheels_linux_arm.yml |   2 +-
 LICENSE-3RD-PARTY.txt                        | 423 +++++++++++++++++++
 docker/manylinux2014/Dockerfile_aarch64      |  26 +-
 docker/manylinux2014/Dockerfile_x86_64       |  26 +-
 5 files changed, 472 insertions(+), 9 deletions(-)

diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml
index e32d6ae0..7e2f836e 100644
--- a/.github/workflows/build_wheels_linux.yml
+++ b/.github/workflows/build_wheels_linux.yml
@@ -41,7 +41,7 @@ jobs:
       MB_ML_VER: 2014
       TRAVIS_BUILD_DIR: ${{ github.workspace }}
       CONFIG_PATH: travis_config.sh
-      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20241202
+      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20250611
       USE_CCACHE: 0
       UNICODE_WIDTH: 32
       PLAT: x86_64
@@ -134,7 +134,7 @@ jobs:
       NP_TEST_DEP: numpy==1.19.4
       TRAVIS_BUILD_DIR: ${{ github.workspace }}
       CONFIG_PATH: travis_config.sh
-      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20241202
+      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20250611
       USE_CCACHE: 1
       UNICODE_WIDTH: 32
       SDIST: ${{ matrix.build_sdist || 0 }}
diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml
index 4c60bb76..d802204e 100644
--- a/.github/workflows/build_wheels_linux_arm.yml
+++ b/.github/workflows/build_wheels_linux_arm.yml
@@ -42,7 +42,7 @@ jobs:
       MB_ML_VER: 2014
       TRAVIS_BUILD_DIR: ${{ github.workspace }}
       CONFIG_PATH: travis_config.sh
-      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64:20241202
+      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64:20250611
       USE_CCACHE: 0
       UNICODE_WIDTH: 32
       SDIST: ${{ matrix.build_sdist || 0 }}
diff --git a/LICENSE-3RD-PARTY.txt b/LICENSE-3RD-PARTY.txt
index 0462eee3..b5e8f5e9 100644
--- a/LICENSE-3RD-PARTY.txt
+++ b/LICENSE-3RD-PARTY.txt
@@ -3088,3 +3088,426 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 SOFTWARE.
+
+------------------------------------------------------------------------------
+
+libavif library and it's dependnecies are redistributed within all opencv-python packages.
+
+Copyright 2019 Joe Drago. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimer in the documentation
+and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+------------------------------------------------------------------------------
+
+Files: src/obu.c
+
+Copyright © 2018-2019, VideoLAN and dav1d authors
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+   list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR CONTRIBUTORS 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.
+
+------------------------------------------------------------------------------
+
+Files: third_party/iccjpeg/*
+
+In plain English:
+
+1. We don't promise that this software works.  (But if you find any bugs,
+   please let us know!)
+2. You can use this software for whatever you want.  You don't have to pay us.
+3. You may not pretend that you wrote this software.  If you use it in a
+   program, you must acknowledge somewhere in your documentation that
+   you've used the IJG code.
+
+In legalese:
+
+The authors make NO WARRANTY or representation, either express or implied,
+with respect to this software, its quality, accuracy, merchantability, or
+fitness for a particular purpose.  This software is provided "AS IS", and you,
+its user, assume the entire risk as to its quality and accuracy.
+
+This software is copyright (C) 1991-2013, Thomas G. Lane, Guido Vollbeding.
+All Rights Reserved except as specified below.
+
+Permission is hereby granted to use, copy, modify, and distribute this
+software (or portions thereof) for any purpose, without fee, subject to these
+conditions:
+(1) If any part of the source code for this software is distributed, then this
+README file must be included, with this copyright and no-warranty notice
+unaltered; and any additions, deletions, or changes to the original files
+must be clearly indicated in accompanying documentation.
+(2) If only executable code is distributed, then the accompanying
+documentation must state that "this software is based in part on the work of
+the Independent JPEG Group".
+(3) Permission for use of this software is granted only if the user accepts
+full responsibility for any undesirable consequences; the authors accept
+NO LIABILITY for damages of any kind.
+
+These conditions apply to any software derived from or based on the IJG code,
+not just to the unmodified library.  If you use our work, you ought to
+acknowledge us.
+
+Permission is NOT granted for the use of any IJG author's name or company name
+in advertising or publicity relating to this software or products derived from
+it.  This software may be referred to only as "the Independent JPEG Group's
+software".
+
+We specifically permit and encourage the use of this software as the basis of
+commercial products, provided that all warranty or liability claims are
+assumed by the product vendor.
+
+
+The Unix configuration script "configure" was produced with GNU Autoconf.
+It is copyright by the Free Software Foundation but is freely distributable.
+The same holds for its supporting scripts (config.guess, config.sub,
+ltmain.sh).  Another support script, install-sh, is copyright by X Consortium
+but is also freely distributable.
+
+The IJG distribution formerly included code to read and write GIF files.
+To avoid entanglement with the Unisys LZW patent, GIF reading support has
+been removed altogether, and the GIF writer has been simplified to produce
+"uncompressed GIFs".  This technique does not use the LZW algorithm; the
+resulting GIF files are larger than usual, but are readable by all standard
+GIF decoders.
+
+We are required to state that
+    "The Graphics Interchange Format(c) is the Copyright property of
+    CompuServe Incorporated.  GIF(sm) is a Service Mark property of
+    CompuServe Incorporated."
+
+------------------------------------------------------------------------------
+
+Files: contrib/gdk-pixbuf/*
+
+Copyright 2020 Emmanuel Gil Peyrot. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+this list of conditions and the following disclaimer in the documentation
+and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT HOLDER OR CONTRIBUTORS 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.
+
+------------------------------------------------------------------------------
+
+Files: android_jni/gradlew*
+
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+
+------------------------------------------------------------------------------
+
+Files: third_party/libyuv/*
+
+Copyright 2011 The LibYuv Project Authors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+  * Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+
+  * Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in
+    the documentation and/or other materials provided with the
+    distribution.
+
+  * Neither the name of Google nor the names of its contributors may
+    be used to endorse or promote products derived from this software
+    without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"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 COPYRIGHT
+HOLDER OR CONTRIBUTORS 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.
+
+------------------------------------------------------------------------------
+
+aom library and it's dependnecies are redistributed within all opencv-python packages.
+
+Copyright (c) 2016, Alliance for Open Media. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in
+   the documentation and/or other materials provided with the
+   distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"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
+COPYRIGHT HOLDER OR CONTRIBUTORS 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.
diff --git a/docker/manylinux2014/Dockerfile_aarch64 b/docker/manylinux2014/Dockerfile_aarch64
index 9a8bfdde..e991029c 100644
--- a/docker/manylinux2014/Dockerfile_aarch64
+++ b/docker/manylinux2014/Dockerfile_aarch64
@@ -1,4 +1,4 @@
-# Version: 20241202
+# Version: 20250611
 # Image name: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64
 
 FROM quay.io/pypa/manylinux2014_aarch64:latest
@@ -6,12 +6,14 @@ FROM quay.io/pypa/manylinux2014_aarch64:latest
 ARG CCACHE_VERSION=3.7.9
 ARG FFMPEG_VERSION=5.1.6
 ARG FREETYPE_VERSION=2.13.3
-ARG LIBPNG_VERSION=1.6.44
-ARG VPX_VERSION=v1.15.0
+ARG LIBPNG_VERSION=1.6.48
+ARG VPX_VERSION=v1.15.1
 ARG NASM_VERSION=2.15.04
 ARG OPENSSL_VERSION=1_1_1w
 ARG QT_VERSION=5.15.16
 ARG YASM_VERSION=1.3.0
+ARG AOM_VERSION=v3.12.1
+ARG AVIF_VERSION=v1.3.0
 
 ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH
 
@@ -102,6 +104,24 @@ RUN mkdir ~/libvpx_sources && \
     cd .. && \
     rm -rf ~/libvpx_sources
 
+RUN mkdir ~/aom_sources && \
+    cd ~/aom_sources && \
+    git clone --depth 1 -b ${AOM_VERSION} https://aomedia.googlesource.com/aom && \
+    mkdir build && cd build && \
+    cmake -DCMAKE_C_COMPILER=$(dirname $(which g++))/gcc -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=ON -DENABLE_TESTS=OFF ../aom/ && \
+    make -j$(getconf _NPROCESSORS_ONLN) && \
+    make install && \
+    cd / && rm -rf ~/aom_sources
+
+RUN mkdir ~/avif_sources && \
+    cd ~/avif_sources && \
+    git clone -b ${AVIF_VERSION} https://github.com/AOMediaCodec/libavif.git && \
+    mkdir build && cd build && \
+    cmake -DCMAKE_INSTALL_PREFIX=/usr -DAVIF_CODEC_AOM=SYSTEM -DAVIF_LIBYUV=LOCAL -DAVIF_BUILD_APPS=OFF ../libavif && \
+    make -j$(getconf _NPROCESSORS_ONLN) && \
+    make install && \
+    cd / && rm -rf ~/avif_sources
+
 RUN mkdir ~/ffmpeg_sources && \
     cd ~/ffmpeg_sources && \
     curl -O -L https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz && \
diff --git a/docker/manylinux2014/Dockerfile_x86_64 b/docker/manylinux2014/Dockerfile_x86_64
index 088d8df5..8adbc8a6 100644
--- a/docker/manylinux2014/Dockerfile_x86_64
+++ b/docker/manylinux2014/Dockerfile_x86_64
@@ -1,4 +1,4 @@
-# Version: 20241202
+# Version: 20250611
 # Image name: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64
 
 FROM quay.io/pypa/manylinux2014_x86_64:latest
@@ -6,12 +6,14 @@ FROM quay.io/pypa/manylinux2014_x86_64:latest
 ARG CCACHE_VERSION=3.7.9
 ARG FFMPEG_VERSION=5.1.6
 ARG FREETYPE_VERSION=2.13.3
-ARG LIBPNG_VERSION=1.6.44
-ARG VPX_VERSION=v1.15.0
+ARG LIBPNG_VERSION=1.6.48
+ARG VPX_VERSION=v1.15.1
 ARG NASM_VERSION=2.15.04
 ARG OPENSSL_VERSION=1_1_1w
 ARG QT_VERSION=5.15.16
 ARG YASM_VERSION=1.3.0
+ARG AOM_VERSION=v3.12.1
+ARG AVIF_VERSION=v1.3.0
 
 ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH
 
@@ -101,6 +103,24 @@ RUN mkdir ~/libvpx_sources && \
     cd .. && \
     rm -rf ~/libvpx_sources
 
+RUN mkdir ~/aom_sources && \
+    cd ~/aom_sources && \
+    git clone --depth 1 -b ${AOM_VERSION} https://aomedia.googlesource.com/aom && \
+    mkdir build && cd build && \
+    cmake -DCMAKE_C_COMPILER=$(dirname $(which g++))/gcc -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_SHARED_LIBS=ON -DENABLE_TESTS=OFF ../aom/ && \
+    make -j$(getconf _NPROCESSORS_ONLN) && \
+    make install && \
+    cd / && rm -rf ~/aom_sources
+
+RUN mkdir ~/avif_sources && \
+    cd ~/avif_sources && \
+    git clone -b ${AVIF_VERSION} https://github.com/AOMediaCodec/libavif.git && \
+    mkdir build && cd build && \
+    cmake -DCMAKE_INSTALL_PREFIX=/usr -DAVIF_CODEC_AOM=SYSTEM -DAVIF_LIBYUV=LOCAL -DAVIF_BUILD_APPS=OFF ../libavif && \
+    make -j$(getconf _NPROCESSORS_ONLN) && \
+    make install && \
+    cd / && rm -rf ~/avif_sources
+
 RUN mkdir ~/ffmpeg_sources && \
     cd ~/ffmpeg_sources && \
     curl -O -L https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz && \

From d432bd4d8dc8d03c0d9aa22d4621fe93c7705f87 Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@xperience.ai>
Date: Mon, 16 Jun 2025 06:40:43 +0300
Subject: [PATCH 51/59] Install libavif and deps on MacOS.

---
 travis_config.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/travis_config.sh b/travis_config.sh
index fcdd4f60..2e5e1a0e 100644
--- a/travis_config.sh
+++ b/travis_config.sh
@@ -103,6 +103,7 @@ function pre_build {
 
   if [ -n "$IS_OSX" ]; then
     brew install lapack
+    brew install libavif
   fi
 
   if [ -n "$IS_OSX" ]; then

From 416ec8b3c6d5514ea7b78d816b247dfc1c240c55 Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@opencv.ai>
Date: Wed, 18 Jun 2025 17:10:23 +0300
Subject: [PATCH 52/59] OpenCV submodules update.

---
 opencv         | 2 +-
 opencv_contrib | 2 +-
 opencv_extra   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/opencv b/opencv
index 31b0eeea..bbaed6f3 160000
--- a/opencv
+++ b/opencv
@@ -1 +1 @@
-Subproject commit 31b0eeea0b44b370fd0712312df4214d4ae1b158
+Subproject commit bbaed6f377e7ed118b977ff178029403a6e30eea
diff --git a/opencv_contrib b/opencv_contrib
index 0e5254eb..1e4d4e0f 160000
--- a/opencv_contrib
+++ b/opencv_contrib
@@ -1 +1 @@
-Subproject commit 0e5254ebf54d2aed6e7eaf6660bf3b797cf50a02
+Subproject commit 1e4d4e0f3e4c7d6d7ab9d738026fe13d3cd85cf4
diff --git a/opencv_extra b/opencv_extra
index a74cf6ba..8926a390 160000
--- a/opencv_extra
+++ b/opencv_extra
@@ -1 +1 @@
-Subproject commit a74cf6bae7fd75d91282b877c559168b3a62148a
+Subproject commit 8926a3906a44733d68485c703de1c8a765577246

From fa50138c30ca70851a5893d02f059c2c509d88d2 Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@opencv.ai>
Date: Mon, 30 Jun 2025 18:22:24 +0300
Subject: [PATCH 53/59] BLAS search fix on Linux after chanages in main OpenCV.

---
 .github/workflows/build_wheels_linux.yml     | 4 ++--
 .github/workflows/build_wheels_linux_arm.yml | 2 +-
 docker/manylinux2014/Dockerfile_aarch64      | 4 ++--
 docker/manylinux2014/Dockerfile_x86_64       | 4 ++--
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml
index 7e2f836e..d8fa7c46 100644
--- a/.github/workflows/build_wheels_linux.yml
+++ b/.github/workflows/build_wheels_linux.yml
@@ -41,7 +41,7 @@ jobs:
       MB_ML_VER: 2014
       TRAVIS_BUILD_DIR: ${{ github.workspace }}
       CONFIG_PATH: travis_config.sh
-      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20250611
+      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20250630
       USE_CCACHE: 0
       UNICODE_WIDTH: 32
       PLAT: x86_64
@@ -134,7 +134,7 @@ jobs:
       NP_TEST_DEP: numpy==1.19.4
       TRAVIS_BUILD_DIR: ${{ github.workspace }}
       CONFIG_PATH: travis_config.sh
-      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20250611
+      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64:20250630
       USE_CCACHE: 1
       UNICODE_WIDTH: 32
       SDIST: ${{ matrix.build_sdist || 0 }}
diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml
index d802204e..04acb2a3 100644
--- a/.github/workflows/build_wheels_linux_arm.yml
+++ b/.github/workflows/build_wheels_linux_arm.yml
@@ -42,7 +42,7 @@ jobs:
       MB_ML_VER: 2014
       TRAVIS_BUILD_DIR: ${{ github.workspace }}
       CONFIG_PATH: travis_config.sh
-      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64:20250611
+      DOCKER_IMAGE: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64:20250630
       USE_CCACHE: 0
       UNICODE_WIDTH: 32
       SDIST: ${{ matrix.build_sdist || 0 }}
diff --git a/docker/manylinux2014/Dockerfile_aarch64 b/docker/manylinux2014/Dockerfile_aarch64
index e991029c..98cd3125 100644
--- a/docker/manylinux2014/Dockerfile_aarch64
+++ b/docker/manylinux2014/Dockerfile_aarch64
@@ -1,4 +1,4 @@
-# Version: 20250611
+# Version: 20250630
 # Image name: quay.io/opencv-ci/opencv-python-manylinux2014-aarch64
 
 FROM quay.io/pypa/manylinux2014_aarch64:latest
@@ -21,7 +21,7 @@ ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH
 RUN yum install zlib-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel lapack-devel epel-release -y && \
     yum install openblas-devel dejavu-sans-fonts -y && \
     cp /usr/include/lapacke/lapacke*.h /usr/include/ && \
-    curl https://raw.githubusercontent.com/xianyi/OpenBLAS/v0.3.3/cblas.h -o /usr/include/cblas.h && \
+    cp /usr/include/openblas/*.h /usr/include/ && \
     # libpng will be built from source
     yum remove libpng -y
 
diff --git a/docker/manylinux2014/Dockerfile_x86_64 b/docker/manylinux2014/Dockerfile_x86_64
index 8adbc8a6..3ed3aa49 100644
--- a/docker/manylinux2014/Dockerfile_x86_64
+++ b/docker/manylinux2014/Dockerfile_x86_64
@@ -1,4 +1,4 @@
-# Version: 20250611
+# Version: 20250630
 # Image name: quay.io/opencv-ci/opencv-python-manylinux2014-x86-64
 
 FROM quay.io/pypa/manylinux2014_x86_64:latest
@@ -20,8 +20,8 @@ ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH
 # epel-release need for aarch64 to get openblas packages
 RUN yum install zlib-devel curl-devel xcb-util-renderutil-devel xcb-util-devel xcb-util-image-devel xcb-util-keysyms-devel xcb-util-wm-devel mesa-libGL-devel libxkbcommon-devel libxkbcommon-x11-devel libXi-devel lapack-devel epel-release -y && \
     yum install openblas-devel dejavu-sans-fonts -y && \
+    cp /usr/include/openblas/*.h /usr/include/ && \
     cp /usr/include/lapacke/lapacke*.h /usr/include/ && \
-    curl https://raw.githubusercontent.com/xianyi/OpenBLAS/v0.3.3/cblas.h -o /usr/include/cblas.h && \
     # libpng will be built from source
     yum remove libpng -y
 

From b5f684cdc36c3b7aee6d57a10c7cf561dc049794 Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@opencv.ai>
Date: Thu, 3 Jul 2025 11:16:24 +0300
Subject: [PATCH 54/59] Updated OpenCV to release 4.12.0.

---
 opencv         | 2 +-
 opencv_contrib | 2 +-
 opencv_extra   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/opencv b/opencv
index bbaed6f3..49486f61 160000
--- a/opencv
+++ b/opencv
@@ -1 +1 @@
-Subproject commit bbaed6f377e7ed118b977ff178029403a6e30eea
+Subproject commit 49486f61fb25722cbcf586b7f4320921d46fb38e
diff --git a/opencv_contrib b/opencv_contrib
index 1e4d4e0f..d943e1d6 160000
--- a/opencv_contrib
+++ b/opencv_contrib
@@ -1 +1 @@
-Subproject commit 1e4d4e0f3e4c7d6d7ab9d738026fe13d3cd85cf4
+Subproject commit d943e1d61c8bc556a13783e1546ee7c1a9e0b1cf
diff --git a/opencv_extra b/opencv_extra
index 8926a390..b6db059e 160000
--- a/opencv_extra
+++ b/opencv_extra
@@ -1 +1 @@
-Subproject commit 8926a3906a44733d68485c703de1c8a765577246
+Subproject commit b6db059e9b80072d80d009d2ab344f8606a8e964

From 957adcfdcd5c5c7b386de7e14436416523b7081f Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@opencv.ai>
Date: Thu, 3 Jul 2025 18:39:28 +0300
Subject: [PATCH 55/59] Updated Windows build environment to 2025. 2019 -
 retired.

---
 .github/workflows/build_wheels_windows.yml | 9 +++++----
 setup.py                                   | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index a1a36ff8..329f60de 100644
--- a/.github/workflows/build_wheels_windows.yml
+++ b/.github/workflows/build_wheels_windows.yml
@@ -19,7 +19,7 @@ on:
 
 jobs:
   Build:
-    runs-on: windows-2019
+    runs-on: windows-2025
     strategy:
       fail-fast: false
       matrix:
@@ -48,7 +48,7 @@ jobs:
           echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
         fi
     - name: Checkout
-      uses: actions/checkout@v3
+      uses: actions/checkout@v4
       with:
         submodules: false
         fetch-depth: 0
@@ -79,7 +79,7 @@ jobs:
 
   Test:
     needs: [Build]
-    runs-on: windows-2019
+    runs-on: windows-2025
     defaults:
       run:
         shell: cmd
@@ -95,6 +95,7 @@ jobs:
       ACTIONS_ALLOW_UNSECURE_COMMANDS: true
       OPENCV_TEST_DATA_PATH: ${{ github.workspace }}\opencv_extra\testdata
       PYLINT_TEST_FILE: ${{ github.workspace }}\opencv\samples\python\squares.py
+      PlatformToolset: v143
     steps:
     - name: Cleanup
       shell: bash
@@ -103,7 +104,7 @@ jobs:
         rm -rf ./.??* || true
       working-directory: ${{ github.workspace }}
     - name: Checkout
-      uses: actions/checkout@v3
+      uses: actions/checkout@v4
       with:
         submodules: true
         fetch-depth: 0
diff --git a/setup.py b/setup.py
index 9aff8d23..3ab0495d 100755
--- a/setup.py
+++ b/setup.py
@@ -163,7 +163,7 @@ def main():
     files_outside_package_dir = {"cv2": ["LICENSE.txt", "LICENSE-3RD-PARTY.txt"]}
 
     ci_cmake_generator = (
-        ["-G", "Visual Studio 14" + (" Win64" if is64 else "")]
+        ["-G", "Visual Studio 17 2022"]
         if os.name == "nt"
         else ["-G", "Unix Makefiles"]
     )

From 7a9ed05ca7e59829d24c9eb57bc7289dd68b73d6 Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@opencv.ai>
Date: Fri, 4 Jul 2025 09:07:09 +0300
Subject: [PATCH 56/59] Updated numpy dependencies.

---
 .github/workflows/build_wheels_linux.yml     |  4 +---
 .github/workflows/build_wheels_linux_arm.yml |  4 +---
 .github/workflows/build_wheels_macos.yml     |  4 +---
 .github/workflows/build_wheels_macos_m1.yml  |  2 --
 .github/workflows/build_wheels_windows.yml   |  2 --
 pyproject.toml                               |  9 +++------
 setup.py                                     | 14 ++++----------
 7 files changed, 10 insertions(+), 29 deletions(-)

diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml
index d8fa7c46..2f4ff9ce 100644
--- a/.github/workflows/build_wheels_linux.yml
+++ b/.github/workflows/build_wheels_linux.yml
@@ -3,8 +3,6 @@ name: Linux x86_64
 on:
   pull_request:
     branches:
-      - master
-      - 3.4
       - 4.x
       - 5.x
     paths-ignore:
@@ -88,7 +86,7 @@ jobs:
       ACTIONS_ALLOW_UNSECURE_COMMANDS: true
       MB_PYTHON_VERSION: ${{ matrix.python-version }}
       NP_TEST_DEP: numpy==1.19.4
-      NP_TEST_DEP_LATEST: numpy==2.2.1
+      NP_TEST_DEP_LATEST: numpy==2.2.6
       CONFIG_PATH: travis_config.sh
       PLAT: x86_64
     steps:
diff --git a/.github/workflows/build_wheels_linux_arm.yml b/.github/workflows/build_wheels_linux_arm.yml
index 04acb2a3..58b06747 100644
--- a/.github/workflows/build_wheels_linux_arm.yml
+++ b/.github/workflows/build_wheels_linux_arm.yml
@@ -3,8 +3,6 @@ name: Linux ARM64
 on:
   pull_request:
     branches:
-      - master
-      - 3.4
       - 4.x
       - 5.x
     paths-ignore:
@@ -89,7 +87,7 @@ jobs:
       MB_PYTHON_VERSION: ${{ matrix.python-version }}
       PLAT: aarch64
       NP_TEST_DEP: numpy==1.19.4
-      NP_TEST_DEP_LATEST: numpy==2.2.1
+      NP_TEST_DEP_LATEST: numpy==2.2.6
       CONFIG_PATH: travis_config.sh
       DOCKER_TEST_IMAGE: multibuild/focal_arm64v8
       UNICODE_WIDTH: 32
diff --git a/.github/workflows/build_wheels_macos.yml b/.github/workflows/build_wheels_macos.yml
index a1cad49e..6a84bda0 100644
--- a/.github/workflows/build_wheels_macos.yml
+++ b/.github/workflows/build_wheels_macos.yml
@@ -3,8 +3,6 @@ name: macOS x86_64
 on:
   pull_request:
     branches:
-      - master
-      - 3.4
       - 4.x
       - 5.x
     paths-ignore:
@@ -109,7 +107,7 @@ jobs:
       ACTIONS_ALLOW_UNSECURE_COMMANDS: true
       MB_PYTHON_VERSION: ${{ matrix.python-version }}
       NP_TEST_DEP: numpy==1.19.4
-      NP_TEST_DEP_LATEST: numpy==2.2.1
+      NP_TEST_DEP_LATEST: numpy==2.2.6
       CONFIG_PATH: travis_config.sh
       PLAT: x86_64
       OPENCV_TEST_DATA_PATH: ${{ github.workspace }}/opencv_extra/testdata
diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml
index 1e62c858..875efbf7 100644
--- a/.github/workflows/build_wheels_macos_m1.yml
+++ b/.github/workflows/build_wheels_macos_m1.yml
@@ -3,8 +3,6 @@ name: macOS ARM64
 on:
   pull_request:
     branches:
-      - master
-      - 3.4
       - 4.x
       - 5.x
     paths-ignore:
diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index 329f60de..1ee786a9 100644
--- a/.github/workflows/build_wheels_windows.yml
+++ b/.github/workflows/build_wheels_windows.yml
@@ -3,8 +3,6 @@ name: Windows x86_64
 on:
   pull_request:
     branches:
-      - master
-      - 3.4
       - 4.x
       - 5.x
     paths-ignore:
diff --git a/pyproject.toml b/pyproject.toml
index d70b49ef..58fba213 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,11 +1,8 @@
 [build-system]
 requires = [
-  "numpy==1.13.3; python_version=='3.6' and platform_machine != 'aarch64' and platform_machine != 'arm64'",
-  "numpy==1.17.0; python_version=='3.7' and platform_machine != 'aarch64' and platform_machine != 'arm64'",
-  "numpy==1.17.5; python_version=='3.8' and platform_machine != 'aarch64' and platform_machine != 'arm64'",
-  "numpy==1.19.3; python_version<'3.9' and sys_platform == 'linux' and platform_machine == 'aarch64'",
-  "numpy==1.21.0; python_version<'3.9' and sys_platform == 'darwin' and platform_machine == 'arm64'",
-  "numpy>=2.0.0;  python_version>='3.9'",
+  "numpy<2.0; python_version<'3.9'",
+  "numpy==2.0.2; python_version>='3.9' and python_version<'3.13'",
+  "numpy==2.1.3; python_version=='3.13'",
   "packaging",
   "pip",
   "scikit-build>=0.14.0",
diff --git a/setup.py b/setup.py
index 3ab0495d..89412187 100755
--- a/setup.py
+++ b/setup.py
@@ -22,17 +22,11 @@ def main():
     build_java = "ON" if get_build_env_var_by_name("java") else "OFF"
     build_rolling = get_build_env_var_by_name("rolling")
 
+    # NOTE: since 2.3.0 numpy upgraded from manylinux2014 to manylinux_2_28
+    # see https://numpy.org/doc/stable/release/2.3.0-notes.html#numpy-2-3-0-release-notes
     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'"
+        'numpy<2.0; python_version<"3.9"',
+        'numpy(>=2, <2.3.0); python_version>="3.9"',
     ]
 
     python_version = cmaker.CMaker.get_python_version()

From 609ff9b9a8166476baf596fd4c3f976ca7d2f30f Mon Sep 17 00:00:00 2001
From: Alexander Smorkalov <alexander.smorkalov@opencv.ai>
Date: Tue, 8 Jul 2025 11:17:57 +0300
Subject: [PATCH 57/59] Disabled Orbbec backend on Windows in headless
 configuration as it uses MSMF API too.

---
 setup.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/setup.py b/setup.py
index 89412187..7c470824 100755
--- a/setup.py
+++ b/setup.py
@@ -214,10 +214,10 @@ def main():
         cmake_args.append("-DWITH_WIN32UI=OFF")
         cmake_args.append("-DWITH_QT=OFF")
         cmake_args.append("-DWITH_GTK=OFF")
-        if is_CI_build:
-            cmake_args.append(
-                "-DWITH_MSMF=OFF"
-            )  # see: https://github.com/skvark/opencv-python/issues/263
+        # see: https://github.com/skvark/opencv-python/issues/263
+        # see: https://github.com/opencv/opencv-python/issues/771
+        cmake_args.append("-DWITH_MSMF=OFF")
+        cmake_args.append("-DWITH_OBSENSOR=OFF") # Orbbec cameras backend uses MSMF API
 
     if sys.platform.startswith("linux") and not is64 and "bdist_wheel" in sys.argv:
         subprocess.check_call("patch -p0 < patches/patchOpenEXR", shell=True)

From dd8186090c7a63e1aead4efff401e39dd34771ef Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Thu, 10 Jul 2025 20:40:22 +0300
Subject: [PATCH 58/59] Update build_wheels_linux.yml

---
 .github/workflows/build_wheels_linux.yml | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml
index 2f4ff9ce..31c812f9 100644
--- a/.github/workflows/build_wheels_linux.yml
+++ b/.github/workflows/build_wheels_linux.yml
@@ -186,8 +186,8 @@ jobs:
     steps:
       - uses: actions/download-artifact@v4
         with:
-          name: wheels
           path: wheelhouse/
+
       - name: Upload wheels for opencv_python_rolling
         run: |
           python -m pip install twine
@@ -216,8 +216,8 @@ jobs:
     steps:
       - uses: actions/download-artifact@v4
         with:
-          name: wheels
           path: wheelhouse/
+          
       - name: Upload all wheels
         run: |
           python -m pip install twine
@@ -234,7 +234,6 @@ jobs:
     steps:
       - uses: actions/download-artifact@v4
         with:
-          name: wheels
           path: wheelhouse/
       - name: Upload wheels for opencv_python
         run: |

From 031af3ccfbca46626d4e8979cc70c08e540a854a Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 28 Jul 2025 21:10:58 +0300
Subject: [PATCH 59/59] Update build_wheels_linux.yml

---
 .github/workflows/build_wheels_linux.yml | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/.github/workflows/build_wheels_linux.yml b/.github/workflows/build_wheels_linux.yml
index 31c812f9..cc7b0636 100644
--- a/.github/workflows/build_wheels_linux.yml
+++ b/.github/workflows/build_wheels_linux.yml
@@ -191,19 +191,19 @@ jobs:
       - name: Upload wheels for opencv_python_rolling
         run: |
           python -m pip install twine
-          python -m twine upload -u ${{ secrets.OPENCV_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_rolling-*
+          python -m twine upload -u ${{ secrets.OPENCV_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/wheel-*/opencv_python_rolling-*
       - name: Upload wheels for opencv_contrib_python_rolling
         run: |
           python -m pip install twine
-          python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_rolling-*
+          python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/wheel-*/opencv_contrib_python_rolling-*
       - name: Upload wheels for opencv_python_headless_rolling
         run: |
           python -m pip install twine
-          python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless_rolling-*
+          python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/wheel-*/opencv_python_headless_rolling-*
       - name: Upload wheels for opencv_contrib_python_headless_rolling
         run: |
           python -m pip install twine
-          python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless_rolling-*
+          python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_ROLLING_PASSWORD }} --skip-existing wheelhouse/wheel-*/opencv_contrib_python_headless_rolling-*
 
   Pre-release:
     if: github.event_name == 'release' && github.event.release.prerelease
@@ -221,7 +221,7 @@ jobs:
       - name: Upload all wheels
         run: |
           python -m pip install twine
-          python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/opencv_* wheelhouse/opencv-*
+          python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/wheel-*/opencv_* wheelhouse/wheel-*/opencv-*
 
   Release:
     if: github.event_name == 'release' && !github.event.release.prerelease
@@ -238,16 +238,16 @@ jobs:
       - name: Upload wheels for opencv_python
         run: |
           python -m pip install twine
-          python -m twine upload -u ${{ secrets.OPENCV_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_python-* wheelhouse/opencv-python-[^h]*
+          python -m twine upload -u ${{ secrets.OPENCV_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_PASSWORD }} --skip-existing wheelhouse/wheel-*/opencv_python-* wheelhouse/wheel-*/opencv-python-[^h]*
       - name: Upload wheels for opencv_contrib_python
         run: |
           python -m pip install twine
-          python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python-* wheelhouse/opencv-contrib-python-[^h]*
+          python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_PASSWORD }} --skip-existing wheelhouse/wheel-*/opencv_contrib_python-* wheelhouse/wheel-*/opencv-contrib-python-[^h]*
       - name: Upload wheels for opencv_python_headless
         run: |
           python -m pip install twine
-          python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/opencv_python_headless-* wheelhouse/opencv-python-headless-*
+          python -m twine upload -u ${{ secrets.OPENCV_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/wheel-*/opencv_python_headless-* wheelhouse/wheel-*/opencv-python-headless-*
       - name: Upload wheels for opencv_contrib_python_headless
         run: |
           python -m pip install twine
-          python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/opencv_contrib_python_headless-* wheelhouse/opencv-contrib-python-headless-*
+          python -m twine upload -u ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_USERNAME }} -p ${{ secrets.OPENCV_CONTRIB_PYTHON_HEADLESS_PASSWORD }} --skip-existing wheelhouse/wheel-*/opencv_contrib_python_headless-* wheelhouse/wheel-*/opencv-contrib-python-headless-*
