From 5b6855241e00920d3d28c462da22067be69b5dbb Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 12 May 2025 08:53:14 +0300
Subject: [PATCH 01/45] Update build_wheels_windows.yml

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

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index bb7b548b..ecd64ad7 100644
--- a/.github/workflows/build_wheels_windows.yml
+++ b/.github/workflows/build_wheels_windows.yml
@@ -72,12 +72,12 @@ 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
+      uses: actions/upload-artifact@v3.1.2
       with:
         name: wheels
         path: wheelhouse/opencv*.whl
     - name: Saving a wheel accordingly to matrix
-      uses: actions/upload-artifact@v3
+      uses: actions/upload-artifact@v3.1.2
       with:
         name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}
         path: wheelhouse/opencv*

From 0ed693265a9cb4e427a118c6f0a0c38519bab8e9 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 12 May 2025 08:58:18 +0300
Subject: [PATCH 02/45] Update build_wheels_windows.yml

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

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index ecd64ad7..cdad84c6 100644
--- a/.github/workflows/build_wheels_windows.yml
+++ b/.github/workflows/build_wheels_windows.yml
@@ -72,12 +72,12 @@ 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.1.2
+      uses: actions/upload-artifact@v4
       with:
         name: wheels
         path: wheelhouse/opencv*.whl
     - name: Saving a wheel accordingly to matrix
-      uses: actions/upload-artifact@v3.1.2
+      uses: actions/upload-artifact@v4
       with:
         name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}
         path: wheelhouse/opencv*

From 43df361f8f39f55d5cbdf59647f56175152ed0c1 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 12 May 2025 09:20:13 +0300
Subject: [PATCH 03/45] Update build_wheels_windows.yml

---
 .github/workflows/build_wheels_windows.yml | 36 ++++++++++------------
 1 file changed, 17 insertions(+), 19 deletions(-)

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index cdad84c6..dbcb2e54 100644
--- a/.github/workflows/build_wheels_windows.yml
+++ b/.github/workflows/build_wheels_windows.yml
@@ -71,16 +71,12 @@ jobs:
         python -m pip install toml && python -c "import toml; c = toml.load('pyproject.toml'); print('\n'.join(c['build-system']['requires']))" >> requirements.txt | python -m pip install -r requirements.txt
         set "CI_BUILD=1" && python setup.py bdist_wheel --py-limited-api=cp37 --dist-dir=%cd%\wheelhouse -v
       shell: cmd
-    - name: Saving all wheels
+      
+    - name: Upload built wheel
       uses: actions/upload-artifact@v4
-      with:
-        name: wheels
-        path: wheelhouse/opencv*.whl
-    - name: Saving a wheel accordingly to matrix
-      uses: actions/upload-artifact@v4
-      with:
-        name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}
-        path: wheelhouse/opencv*
+        with:
+          name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}-${{ github.run_id }}-${{ github.job }}
+          path: wheelhouse/opencv*.whl
 
   Test:
     needs: [Build]
@@ -117,11 +113,12 @@ jobs:
       with:
         python-version: ${{ matrix.python-version }}
         architecture: ${{ matrix.platform }}
-    - name: Download a wheel accordingly to matrix
+        
+    - name: Download all artifacts
       uses: actions/download-artifact@v3
-      with:
-        name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}
-        path: wheelhouse/
+        with:
+          path: wheelhouse/
+
     - name: Package installation
       run: |
         cd ${{ github.workspace }}/tests
@@ -148,10 +145,11 @@ jobs:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v3
+      - name: Download all wheels
+        uses: actions/download-artifact@v3
         with:
-          name: wheels
           path: wheelhouse/
+
       - name: Upload wheels for opencv_python_rolling
         run: |
           python -m pip install twine
@@ -178,9 +176,9 @@ jobs:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v3
+      - name: Download all wheels
+        uses: actions/download-artifact@v3
         with:
-          name: wheels
           path: wheelhouse/
       - name: Upload all wheels
         run: |
@@ -196,9 +194,9 @@ jobs:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v3
+      - name: Download all wheels
+        uses: actions/download-artifact@v3
         with:
-          name: wheels
           path: wheelhouse/
       - name: Upload wheels for opencv_python
         run: |

From 800c408fb8c7312091a098cedc41bd5825f568ee Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 12 May 2025 09:22:31 +0300
Subject: [PATCH 04/45] Update build_wheels_windows.yml

---
 .github/workflows/build_wheels_windows.yml | 197 ++++++++++-----------
 1 file changed, 92 insertions(+), 105 deletions(-)

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index dbcb2e54..40eab4d6 100644
--- a/.github/workflows/build_wheels_windows.yml
+++ b/.github/workflows/build_wheels_windows.yml
@@ -16,7 +16,6 @@ on:
     - cron: '0 3 * * 6'
   workflow_dispatch:
 
-
 jobs:
   Build:
     runs-on: windows-2019
@@ -35,45 +34,50 @@ jobs:
       ENABLE_CONTRIB: ${{ matrix.with_contrib }}
       OPENCV_TEST_DATA_PATH: ${{ github.workspace }}\opencv_extra\testdata
     steps:
-    - name: Cleanup
-      shell: bash
-      run: |
-        rm -rf ./* || true
-        rm -rf ./.??* || true
-      working-directory: ${{ github.workspace }}
-    - name: Setup environment
-      shell: bash
-      run: |
-        if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
-          echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
-        fi
-    - name: Checkout
-      uses: actions/checkout@v3
-      with:
-        submodules: false
-        fetch-depth: 0
-    - name: Set up Python ${{ matrix.python-version }}
-      uses: actions/setup-python@v4
-      with:
-        python-version: ${{ matrix.python-version }}
-        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: |
-        python --version
-        python -m pip install --upgrade pip
-        python -m pip install --upgrade setuptools
-        python -m pip install cmake==3.24.2
-        python -m pip install toml && python -c "import toml; c = toml.load('pyproject.toml'); print('\n'.join(c['build-system']['requires']))" >> requirements.txt | python -m pip install -r requirements.txt
-        set "CI_BUILD=1" && python setup.py bdist_wheel --py-limited-api=cp37 --dist-dir=%cd%\wheelhouse -v
-      shell: cmd
-      
-    - name: Upload built wheel
-      uses: actions/upload-artifact@v4
+      - name: Cleanup
+        shell: bash
+        run: |
+          rm -rf ./* || true
+          rm -rf ./.??* || true
+        working-directory: ${{ github.workspace }}
+
+      - name: Setup environment
+        shell: bash
+        run: |
+          if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
+            echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
+          fi
+
+      - name: Checkout
+        uses: actions/checkout@v3
+        with:
+          submodules: false
+          fetch-depth: 0
+
+      - name: Set up Python ${{ matrix.python-version }}
+        uses: actions/setup-python@v4
+        with:
+          python-version: ${{ matrix.python-version }}
+          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
+        run: |
+          python --version
+          python -m pip install --upgrade pip
+          python -m pip install --upgrade setuptools
+          python -m pip install cmake==3.24.2
+          python -m pip install toml && python -c "import toml; c = toml.load('pyproject.toml'); print('\n'.join(c['build-system']['requires']))" >> requirements.txt | python -m pip install -r requirements.txt
+          set "CI_BUILD=1" && python setup.py bdist_wheel --py-limited-api=cp37 --dist-dir=%cd%\wheelhouse -v
+        shell: cmd
+
+      - name: Upload built wheel
+        uses: actions/upload-artifact@v4
         with:
           name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}-${{ github.run_id }}-${{ github.job }}
           path: wheelhouse/opencv*.whl
@@ -97,44 +101,49 @@ jobs:
       OPENCV_TEST_DATA_PATH: ${{ github.workspace }}\opencv_extra\testdata
       PYLINT_TEST_FILE: ${{ github.workspace }}\opencv\samples\python\squares.py
     steps:
-    - name: Cleanup
-      shell: bash
-      run: |
-        rm -rf ./* || true
-        rm -rf ./.??* || true
-      working-directory: ${{ github.workspace }}
-    - name: Checkout
-      uses: actions/checkout@v3
-      with:
-        submodules: true
-        fetch-depth: 0
-    - name: Set up Python ${{ matrix.python-version }}
-      uses: actions/setup-python@v4
-      with:
-        python-version: ${{ matrix.python-version }}
-        architecture: ${{ matrix.platform }}
-        
-    - name: Download all artifacts
-      uses: actions/download-artifact@v3
+      - name: Cleanup
+        shell: bash
+        run: |
+          rm -rf ./* || true
+          rm -rf ./.??* || true
+        working-directory: ${{ github.workspace }}
+
+      - name: Checkout
+        uses: actions/checkout@v3
+        with:
+          submodules: true
+          fetch-depth: 0
+
+      - name: Set up Python ${{ matrix.python-version }}
+        uses: actions/setup-python@v4
+        with:
+          python-version: ${{ matrix.python-version }}
+          architecture: ${{ matrix.platform }}
+
+      - name: Download all artifacts
+        uses: actions/download-artifact@v3
         with:
           path: wheelhouse/
 
-    - name: Package installation
-      run: |
-        cd ${{ github.workspace }}/tests
-        &python -m pip install --user --no-warn-script-location (ls "../wheelhouse/opencv*.whl")
-        if ($LastExitCode -ne 0) {throw $LastExitCode}
-        python get_build_info.py
-      shell: powershell
-    - name: Run tests
-      run: |
-        cd ${{ github.workspace }}/opencv
-        python modules\python\test\test.py -v --repo .
-    - name: Pylint test
-      run: |
-        python -m pip install pylint==2.15.9
-        cd ${{ github.workspace }}\tests
-        python -m pylint $PYLINT_TEST_FILE
+      - name: Find and install matching wheel
+        shell: powershell
+        run: |
+          $pattern = "wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}-*"
+          $file = Get-ChildItem -Recurse wheelhouse | Where-Object { $_.Name -like "$pattern*.whl" } | Select-Object -First 1
+          if (-not $file) { throw "No matching wheel found" }
+          & python -m pip install --user --no-warn-script-location $file.FullName
+          python get_build_info.py
+
+      - name: Run tests
+        run: |
+          cd ${{ github.workspace }}/opencv
+          python modules\python\test\test.py -v --repo .
+
+      - name: Pylint test
+        run: |
+          python -m pip install pylint==2.15.9
+          cd ${{ github.workspace }}\tests
+          python -m pylint $PYLINT_TEST_FILE
 
   Release_rolling:
     if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
@@ -150,22 +159,10 @@ jobs:
         with:
           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
+      - name: Upload wheels
         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-*
+          python -m twine upload -u ${{ secrets.OPENCV_PYTHON_ROLLING_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_ROLLING_PASSWORD }} --skip-existing wheelhouse/**/*.whl
 
   Pre-release:
     if: github.event_name == 'release' && github.event.release.prerelease
@@ -180,10 +177,11 @@ jobs:
         uses: actions/download-artifact@v3
         with:
           path: wheelhouse/
-      - name: Upload all wheels
+
+      - name: Upload all wheels to Test PyPI
         run: |
           python -m pip install twine
-          python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/opencv_*
+          python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/**/*.whl
 
   Release:
     if: github.event_name == 'release' && !github.event.release.prerelease
@@ -198,19 +196,8 @@ jobs:
         uses: actions/download-artifact@v3
         with:
           path: wheelhouse/
-      - 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-*
-      - 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-*
-      - 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-*
-      - name: Upload wheels for opencv_contrib_python_headless
+
+      - name: Upload all wheels to PyPI
         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-*
+          python -m twine upload -u ${{ secrets.OPENCV_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_PASSWORD }} --skip-existing wheelhouse/**/*.whl

From d5099508f0d34619daab8fde560671607af3b686 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 12 May 2025 10:52:57 +0300
Subject: [PATCH 05/45] Update build_wheels_windows.yml

---
 .github/workflows/build_wheels_windows.yml | 225 +++++++++++----------
 1 file changed, 120 insertions(+), 105 deletions(-)

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index 40eab4d6..bb7b548b 100644
--- a/.github/workflows/build_wheels_windows.yml
+++ b/.github/workflows/build_wheels_windows.yml
@@ -16,6 +16,7 @@ on:
     - cron: '0 3 * * 6'
   workflow_dispatch:
 
+
 jobs:
   Build:
     runs-on: windows-2019
@@ -34,53 +35,52 @@ jobs:
       ENABLE_CONTRIB: ${{ matrix.with_contrib }}
       OPENCV_TEST_DATA_PATH: ${{ github.workspace }}\opencv_extra\testdata
     steps:
-      - name: Cleanup
-        shell: bash
-        run: |
-          rm -rf ./* || true
-          rm -rf ./.??* || true
-        working-directory: ${{ github.workspace }}
-
-      - name: Setup environment
-        shell: bash
-        run: |
-          if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
-            echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
-          fi
-
-      - name: Checkout
-        uses: actions/checkout@v3
-        with:
-          submodules: false
-          fetch-depth: 0
-
-      - name: Set up Python ${{ matrix.python-version }}
-        uses: actions/setup-python@v4
-        with:
-          python-version: ${{ matrix.python-version }}
-          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
-        run: |
-          python --version
-          python -m pip install --upgrade pip
-          python -m pip install --upgrade setuptools
-          python -m pip install cmake==3.24.2
-          python -m pip install toml && python -c "import toml; c = toml.load('pyproject.toml'); print('\n'.join(c['build-system']['requires']))" >> requirements.txt | python -m pip install -r requirements.txt
-          set "CI_BUILD=1" && python setup.py bdist_wheel --py-limited-api=cp37 --dist-dir=%cd%\wheelhouse -v
-        shell: cmd
-
-      - name: Upload built wheel
-        uses: actions/upload-artifact@v4
-        with:
-          name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}-${{ github.run_id }}-${{ github.job }}
-          path: wheelhouse/opencv*.whl
+    - name: Cleanup
+      shell: bash
+      run: |
+        rm -rf ./* || true
+        rm -rf ./.??* || true
+      working-directory: ${{ github.workspace }}
+    - name: Setup environment
+      shell: bash
+      run: |
+        if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
+          echo "ENABLE_ROLLING=1" >> $GITHUB_ENV
+        fi
+    - name: Checkout
+      uses: actions/checkout@v3
+      with:
+        submodules: false
+        fetch-depth: 0
+    - name: Set up Python ${{ matrix.python-version }}
+      uses: actions/setup-python@v4
+      with:
+        python-version: ${{ matrix.python-version }}
+        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: |
+        python --version
+        python -m pip install --upgrade pip
+        python -m pip install --upgrade setuptools
+        python -m pip install cmake==3.24.2
+        python -m pip install toml && python -c "import toml; c = toml.load('pyproject.toml'); print('\n'.join(c['build-system']['requires']))" >> requirements.txt | python -m pip install -r requirements.txt
+        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
+      with:
+        name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}
+        path: wheelhouse/opencv*
 
   Test:
     needs: [Build]
@@ -101,49 +101,43 @@ jobs:
       OPENCV_TEST_DATA_PATH: ${{ github.workspace }}\opencv_extra\testdata
       PYLINT_TEST_FILE: ${{ github.workspace }}\opencv\samples\python\squares.py
     steps:
-      - name: Cleanup
-        shell: bash
-        run: |
-          rm -rf ./* || true
-          rm -rf ./.??* || true
-        working-directory: ${{ github.workspace }}
-
-      - name: Checkout
-        uses: actions/checkout@v3
-        with:
-          submodules: true
-          fetch-depth: 0
-
-      - name: Set up Python ${{ matrix.python-version }}
-        uses: actions/setup-python@v4
-        with:
-          python-version: ${{ matrix.python-version }}
-          architecture: ${{ matrix.platform }}
-
-      - name: Download all artifacts
-        uses: actions/download-artifact@v3
-        with:
-          path: wheelhouse/
-
-      - name: Find and install matching wheel
-        shell: powershell
-        run: |
-          $pattern = "wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}-*"
-          $file = Get-ChildItem -Recurse wheelhouse | Where-Object { $_.Name -like "$pattern*.whl" } | Select-Object -First 1
-          if (-not $file) { throw "No matching wheel found" }
-          & python -m pip install --user --no-warn-script-location $file.FullName
-          python get_build_info.py
-
-      - name: Run tests
-        run: |
-          cd ${{ github.workspace }}/opencv
-          python modules\python\test\test.py -v --repo .
-
-      - name: Pylint test
-        run: |
-          python -m pip install pylint==2.15.9
-          cd ${{ github.workspace }}\tests
-          python -m pylint $PYLINT_TEST_FILE
+    - name: Cleanup
+      shell: bash
+      run: |
+        rm -rf ./* || true
+        rm -rf ./.??* || true
+      working-directory: ${{ github.workspace }}
+    - name: Checkout
+      uses: actions/checkout@v3
+      with:
+        submodules: true
+        fetch-depth: 0
+    - name: Set up Python ${{ matrix.python-version }}
+      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@v3
+      with:
+        name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}
+        path: wheelhouse/
+    - name: Package installation
+      run: |
+        cd ${{ github.workspace }}/tests
+        &python -m pip install --user --no-warn-script-location (ls "../wheelhouse/opencv*.whl")
+        if ($LastExitCode -ne 0) {throw $LastExitCode}
+        python get_build_info.py
+      shell: powershell
+    - name: Run tests
+      run: |
+        cd ${{ github.workspace }}/opencv
+        python modules\python\test\test.py -v --repo .
+    - name: Pylint test
+      run: |
+        python -m pip install pylint==2.15.9
+        cd ${{ github.workspace }}\tests
+        python -m pylint $PYLINT_TEST_FILE
 
   Release_rolling:
     if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
@@ -154,15 +148,26 @@ jobs:
       run:
         shell: bash
     steps:
-      - name: Download all wheels
-        uses: actions/download-artifact@v3
+      - uses: actions/download-artifact@v3
         with:
+          name: wheels
           path: wheelhouse/
-
-      - name: Upload wheels
+      - 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/**/*.whl
+          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
@@ -173,15 +178,14 @@ jobs:
       run:
         shell: bash
     steps:
-      - name: Download all wheels
-        uses: actions/download-artifact@v3
+      - uses: actions/download-artifact@v3
         with:
+          name: wheels
           path: wheelhouse/
-
-      - name: Upload all wheels to Test PyPI
+      - 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/**/*.whl
+          python -m twine upload --repository testpypi -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_PASSWORD }} --skip-existing wheelhouse/opencv_*
 
   Release:
     if: github.event_name == 'release' && !github.event.release.prerelease
@@ -192,12 +196,23 @@ jobs:
       run:
         shell: bash
     steps:
-      - name: Download all wheels
-        uses: actions/download-artifact@v3
+      - uses: actions/download-artifact@v3
         with:
+          name: wheels
           path: wheelhouse/
-
-      - name: Upload all wheels to PyPI
+      - 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-*
+      - 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-*
+      - 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-*
+      - name: Upload wheels for opencv_contrib_python_headless
         run: |
           python -m pip install twine
-          python -m twine upload -u ${{ secrets.OPENCV_PYTHON_USERNAME }} -p ${{ secrets.OPENCV_PYTHON_PASSWORD }} --skip-existing wheelhouse/**/*.whl
+          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-*

From 81b57ade406779a52a48a29c255edf8b12721b85 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 12 May 2025 11:00:54 +0300
Subject: [PATCH 06/45] Update build_wheels_windows.yml

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

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index bb7b548b..636fbe88 100644
--- a/.github/workflows/build_wheels_windows.yml
+++ b/.github/workflows/build_wheels_windows.yml
@@ -72,12 +72,12 @@ 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
+      uses: actions/upload-artifact@v4
       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 +118,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/
@@ -148,7 +148,7 @@ jobs:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v3
+      - uses: actions/download-artifact@v4
         with:
           name: wheels
           path: wheelhouse/
@@ -178,7 +178,7 @@ jobs:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v3
+      - uses: actions/download-artifact@v4
         with:
           name: wheels
           path: wheelhouse/
@@ -196,7 +196,7 @@ jobs:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v3
+      - uses: actions/download-artifact@v4
         with:
           name: wheels
           path: wheelhouse/

From cf6f2a1052049cfd654c49f89072e0ecfb081087 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 12 May 2025 11:19:59 +0300
Subject: [PATCH 07/45] Update build_wheels_windows.yml

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

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index 636fbe88..1e8d65de 100644
--- a/.github/workflows/build_wheels_windows.yml
+++ b/.github/workflows/build_wheels_windows.yml
@@ -74,7 +74,7 @@ jobs:
     - name: Saving all wheels
       uses: actions/upload-artifact@v4
       with:
-        name: wheels
+        name: wheels-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}
         path: wheelhouse/opencv*.whl
     - name: Saving a wheel accordingly to matrix
       uses: actions/upload-artifact@v4
@@ -150,7 +150,7 @@ jobs:
     steps:
       - uses: actions/download-artifact@v4
         with:
-          name: wheels
+          name: wheels-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}
           path: wheelhouse/
       - name: Upload wheels for opencv_python_rolling
         run: |
@@ -180,7 +180,7 @@ jobs:
     steps:
       - uses: actions/download-artifact@v4
         with:
-          name: wheels
+          name: wheels-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}
           path: wheelhouse/
       - name: Upload all wheels
         run: |
@@ -198,7 +198,7 @@ jobs:
     steps:
       - uses: actions/download-artifact@v4
         with:
-          name: wheels
+          name: wheels-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}
           path: wheelhouse/
       - name: Upload wheels for opencv_python
         run: |

From ce9020fdb5ee7c7f3b337b6f147c058a78dd1a92 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 12 May 2025 11:45:47 +0300
Subject: [PATCH 08/45] Update build_wheels_windows.yml

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

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index 1e8d65de..035acec0 100644
--- a/.github/workflows/build_wheels_windows.yml
+++ b/.github/workflows/build_wheels_windows.yml
@@ -142,7 +142,7 @@ 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:
@@ -172,7 +172,7 @@ 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:
@@ -190,7 +190,7 @@ 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:

From 5da97acb2c7e6998dae354b5e2c0287748b32f3c Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 12 May 2025 20:36:47 +0300
Subject: [PATCH 09/45] Update build_wheels_windows.yml

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

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index 035acec0..bb7b548b 100644
--- a/.github/workflows/build_wheels_windows.yml
+++ b/.github/workflows/build_wheels_windows.yml
@@ -72,12 +72,12 @@ 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@v4
+      uses: actions/upload-artifact@v3
       with:
-        name: wheels-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}
+        name: wheels
         path: wheelhouse/opencv*.whl
     - name: Saving a wheel accordingly to matrix
-      uses: actions/upload-artifact@v4
+      uses: actions/upload-artifact@v3
       with:
         name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}
         path: wheelhouse/opencv*
@@ -118,7 +118,7 @@ jobs:
         python-version: ${{ matrix.python-version }}
         architecture: ${{ matrix.platform }}
     - name: Download a wheel accordingly to matrix
-      uses: actions/download-artifact@v4
+      uses: actions/download-artifact@v3
       with:
         name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}
         path: wheelhouse/
@@ -142,15 +142,15 @@ jobs:
   Release_rolling:
     if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
     needs: [Build, Test]
-    runs-on: ubuntu-22.04
+    runs-on: ubuntu-20.04
     environment: opencv-python-rolling-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v4
+      - uses: actions/download-artifact@v3
         with:
-          name: wheels-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}
+          name: wheels
           path: wheelhouse/
       - name: Upload wheels for opencv_python_rolling
         run: |
@@ -172,15 +172,15 @@ jobs:
   Pre-release:
     if: github.event_name == 'release' && github.event.release.prerelease
     needs: [Build, Test]
-    runs-on: ubuntu-22.04
+    runs-on: ubuntu-20.04
     environment: test-opencv-python-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v4
+      - uses: actions/download-artifact@v3
         with:
-          name: wheels-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}
+          name: wheels
           path: wheelhouse/
       - name: Upload all wheels
         run: |
@@ -190,15 +190,15 @@ jobs:
   Release:
     if: github.event_name == 'release' && !github.event.release.prerelease
     needs: [Build, Test]
-    runs-on: ubuntu-22.04
+    runs-on: ubuntu-20.04
     environment: opencv-python-release
     defaults:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v4
+      - uses: actions/download-artifact@v3
         with:
-          name: wheels-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}
+          name: wheels
           path: wheelhouse/
       - name: Upload wheels for opencv_python
         run: |

From 02ffc4a0b08dd1cc089cfd3a37b500d282c2e9f0 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 12 May 2025 20:37:26 +0300
Subject: [PATCH 10/45] Update build_wheels_windows.yml

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

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index bb7b548b..a194b172 100644
--- a/.github/workflows/build_wheels_windows.yml
+++ b/.github/workflows/build_wheels_windows.yml
@@ -72,12 +72,12 @@ 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
+      uses: actions/upload-artifact@v3.1.3
       with:
         name: wheels
         path: wheelhouse/opencv*.whl
     - name: Saving a wheel accordingly to matrix
-      uses: actions/upload-artifact@v3
+      uses: actions/upload-artifact@v3.1.3
       with:
         name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}
         path: wheelhouse/opencv*

From 62aa42cf8e5c44aba8e5cdfbf54841baead1f5c9 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 12 May 2025 20:45:27 +0300
Subject: [PATCH 11/45] Update build_wheels_windows.yml

---
 .github/workflows/build_wheels_windows.yml | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index a194b172..eea53c81 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.1.3
-      with:
-        name: wheels
-        path: wheelhouse/opencv*.whl
-    - name: Saving a wheel accordingly to matrix
-      uses: actions/upload-artifact@v3.1.3
+      uses: actions/upload-artifact@v4
       with:
         name: wheel-${{ matrix.with_contrib }}-${{ matrix.without_gui }}-${{ matrix.build_sdist }}-${{ matrix.platform }}
         path: wheelhouse/opencv*
@@ -148,9 +143,8 @@ jobs:
       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: |
@@ -178,9 +172,8 @@ jobs:
       run:
         shell: bash
     steps:
-      - uses: actions/download-artifact@v3
+      - uses: actions/download-artifact@v4
         with:
-          name: wheels
           path: wheelhouse/
       - name: Upload all wheels
         run: |
@@ -196,9 +189,8 @@ jobs:
       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 3f50ff6391e3f2dbbe7a8cef13c8a855c6c37d3c Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 12 May 2025 21:03:44 +0300
Subject: [PATCH 12/45] Update build_wheels_windows.yml

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

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index eea53c81..4c95586d 100644
--- a/.github/workflows/build_wheels_windows.yml
+++ b/.github/workflows/build_wheels_windows.yml
@@ -113,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/

From 24e5192378b85d57ccd3bfc377fc3df205c43092 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 12 May 2025 21:28:34 +0300
Subject: [PATCH 13/45] Update build_wheels_windows.yml

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

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index 4c95586d..a1a36ff8 100644
--- a/.github/workflows/build_wheels_windows.yml
+++ b/.github/workflows/build_wheels_windows.yml
@@ -137,7 +137,7 @@ 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:
@@ -166,7 +166,7 @@ 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:
@@ -183,7 +183,7 @@ 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:

From af76f7a3548ff143b87bf185d51c7065dce7123b Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Tue, 13 May 2025 20:32:55 +0300
Subject: [PATCH 14/45] Update setup.py

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

diff --git a/setup.py b/setup.py
index 1dfab2fb..72ad485c 100644
--- a/setup.py
+++ b/setup.py
@@ -193,6 +193,7 @@ def main():
             "-DBUILD_DOCS=OFF",
             "-DPYTHON3_LIMITED_API=ON",
             "-DBUILD_OPENEXR=ON",
+            "-DWITH_MSMF=OFF",
         ]
         + (
             # CMake flags for windows/arm64 build

From 8e63c5b47cda57f7dfa074e61d61199e50898ee4 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Sun, 18 May 2025 15:45:18 +0300
Subject: [PATCH 15/45] Update setup.py

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

diff --git a/setup.py b/setup.py
index 72ad485c..1dfab2fb 100644
--- a/setup.py
+++ b/setup.py
@@ -193,7 +193,6 @@ def main():
             "-DBUILD_DOCS=OFF",
             "-DPYTHON3_LIMITED_API=ON",
             "-DBUILD_OPENEXR=ON",
-            "-DWITH_MSMF=OFF",
         ]
         + (
             # CMake flags for windows/arm64 build

From fb2ce3266fed408dc9480c90bdae12d0ea1b0b42 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Sun, 18 May 2025 15:58:30 +0300
Subject: [PATCH 16/45] Update build_wheels_windows.yml

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

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index a1a36ff8..72b338b1 100644
--- a/.github/workflows/build_wheels_windows.yml
+++ b/.github/workflows/build_wheels_windows.yml
@@ -71,6 +71,12 @@ jobs:
         python -m pip install toml && python -c "import toml; c = toml.load('pyproject.toml'); print('\n'.join(c['build-system']['requires']))" >> requirements.txt | python -m pip install -r requirements.txt
         set "CI_BUILD=1" && python setup.py bdist_wheel --py-limited-api=cp37 --dist-dir=%cd%\wheelhouse -v
       shell: cmd
+      
+    - name: Check for Media Foundation
+      run: |
+          findstr /i MSMF build\CMakeCache.txt || echo "MSMF not found"
+      shell: cmd
+
     - name: Saving all wheels
       uses: actions/upload-artifact@v4
       with:

From 34c8ef17d36d1bc3233212b7efa97f16ca5d3177 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Sun, 18 May 2025 16:22:53 +0300
Subject: [PATCH 17/45] Update build_wheels_windows.yml

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

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index 72b338b1..8ae4f78e 100644
--- a/.github/workflows/build_wheels_windows.yml
+++ b/.github/workflows/build_wheels_windows.yml
@@ -72,9 +72,12 @@ jobs:
         set "CI_BUILD=1" && python setup.py bdist_wheel --py-limited-api=cp37 --dist-dir=%cd%\wheelhouse -v
       shell: cmd
       
-    - name: Check for Media Foundation
+    - name: Find CMakeCache.txt and check for MSMF
       run: |
-          findstr /i MSMF build\CMakeCache.txt || echo "MSMF not found"
+          for /r %%f in (CMakeCache.txt) do (
+          echo Found: %%f
+          findstr /i MSMF "%%f"
+          )
       shell: cmd
 
     - name: Saving all wheels

From 0d87cdfbec5e84099dfe61e0c6963c1b957dfe45 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Sun, 18 May 2025 16:44:43 +0300
Subject: [PATCH 18/45] Update build_wheels_windows.yml

---
 .github/workflows/build_wheels_windows.yml | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index 8ae4f78e..9b204fc6 100644
--- a/.github/workflows/build_wheels_windows.yml
+++ b/.github/workflows/build_wheels_windows.yml
@@ -71,14 +71,6 @@ jobs:
         python -m pip install toml && python -c "import toml; c = toml.load('pyproject.toml'); print('\n'.join(c['build-system']['requires']))" >> requirements.txt | python -m pip install -r requirements.txt
         set "CI_BUILD=1" && python setup.py bdist_wheel --py-limited-api=cp37 --dist-dir=%cd%\wheelhouse -v
       shell: cmd
-      
-    - name: Find CMakeCache.txt and check for MSMF
-      run: |
-          for /r %%f in (CMakeCache.txt) do (
-          echo Found: %%f
-          findstr /i MSMF "%%f"
-          )
-      shell: cmd
 
     - name: Saving all wheels
       uses: actions/upload-artifact@v4

From a8d63756c6b2554c9fd0678601c147bca1f420d2 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 9 Jun 2025 15:42:24 +0300
Subject: [PATCH 19/45] Update build_wheels_windows.yml

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

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index 9b204fc6..f6d60228 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:
@@ -80,7 +80,7 @@ jobs:
 
   Test:
     needs: [Build]
-    runs-on: windows-2019
+    runs-on: windows-2025
     defaults:
       run:
         shell: cmd

From d728c917a3bfbd28417e9aaa5b09d555a47d0147 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 9 Jun 2025 16:22:04 +0300
Subject: [PATCH 20/45] Update build_wheels_windows.yml

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

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index f6d60228..04d3c12e 100644
--- a/.github/workflows/build_wheels_windows.yml
+++ b/.github/workflows/build_wheels_windows.yml
@@ -61,6 +61,18 @@ jobs:
       uses: microsoft/setup-msbuild@v1.1
     - name: Setup NASM
       uses: ilammy/setup-nasm@v1
+
+    - name: Debug Visual Studio and MSBuild
+      shell: pwsh
+      run: |
+        Get-Command msbuild.exe -All
+        &"C:\Program Files\Microsoft Visual Studio\Installer\vswhere.exe" -all -products * -format json | ConvertFrom-Json | ForEach-Object {
+          $_.displayName
+          $_.installationPath
+          $_.catalog.productDisplayVersion
+          $_.catalog.productLine
+        }
+        
     - 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 5601e197aa3890de8dcc470cdcacc709eb318bee Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 9 Jun 2025 16:33:03 +0300
Subject: [PATCH 21/45] Update setup.py

---
 setup.py | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/setup.py b/setup.py
index 1dfab2fb..5c81a6c6 100644
--- a/setup.py
+++ b/setup.py
@@ -160,11 +160,26 @@ def main():
     # Raw paths relative to sourcetree root.
     files_outside_package_dir = {"cv2": ["LICENSE.txt", "LICENSE-3RD-PARTY.txt"]}
 
-    ci_cmake_generator = (
-        ["-G", "Visual Studio 14" + (" Win64" if is64 else "")]
-        if os.name == "nt"
-        else ["-G", "Unix Makefiles"]
-    )
+def get_windows_version():
+    try:
+        release_str = platform.release()
+        if release_str == "2025":
+            return 2025
+        else:
+            return int(release_str)
+    except Exception:
+        return None
+
+windows_version = get_windows_version()
+
+if os.name == "nt":
+    if windows_version == 2025:
+        generator_name = "Visual Studio 17"
+    else:
+        generator_name = "Visual Studio 14"
+    ci_cmake_generator = ["-G", generator_name + (" Win64" if is64 else "")]
+else:
+    ci_cmake_generator = ["-G", "Unix Makefiles"]
 
     cmake_args = (
         (ci_cmake_generator if is_CI_build else [])

From a397db1c3125ee76d11a805c5f0e0d825ae1e3e0 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 9 Jun 2025 16:34:24 +0300
Subject: [PATCH 22/45] Update build_wheels_windows.yml

---
 .github/workflows/build_wheels_windows.yml | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index 04d3c12e..99ef15f1 100644
--- a/.github/workflows/build_wheels_windows.yml
+++ b/.github/workflows/build_wheels_windows.yml
@@ -62,17 +62,6 @@ jobs:
     - name: Setup NASM
       uses: ilammy/setup-nasm@v1
 
-    - name: Debug Visual Studio and MSBuild
-      shell: pwsh
-      run: |
-        Get-Command msbuild.exe -All
-        &"C:\Program Files\Microsoft Visual Studio\Installer\vswhere.exe" -all -products * -format json | ConvertFrom-Json | ForEach-Object {
-          $_.displayName
-          $_.installationPath
-          $_.catalog.productDisplayVersion
-          $_.catalog.productLine
-        }
-        
     - 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 4721363d4aef28754819bc1937e79c0d1e051b70 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 9 Jun 2025 16:40:12 +0300
Subject: [PATCH 23/45] Update setup.py

---
 setup.py | 26 +++++++-------------------
 1 file changed, 7 insertions(+), 19 deletions(-)

diff --git a/setup.py b/setup.py
index 5c81a6c6..33101ac3 100644
--- a/setup.py
+++ b/setup.py
@@ -160,27 +160,15 @@ def main():
     # Raw paths relative to sourcetree root.
     files_outside_package_dir = {"cv2": ["LICENSE.txt", "LICENSE-3RD-PARTY.txt"]}
 
-def get_windows_version():
-    try:
-        release_str = platform.release()
-        if release_str == "2025":
-            return 2025
+    if os.name == "nt": 
+        if windows_version == 2025:
+            generator_name = "Visual Studio 17"
         else:
-            return int(release_str)
-    except Exception:
-        return None
-
-windows_version = get_windows_version()
-
-if os.name == "nt":
-    if windows_version == 2025:
-        generator_name = "Visual Studio 17"
+            enerator_name = "Visual Studio 14"
+        ci_cmake_generator = ["-G", generator_name + (" Win64" if is64 else "")]
     else:
-        generator_name = "Visual Studio 14"
-    ci_cmake_generator = ["-G", generator_name + (" Win64" if is64 else "")]
-else:
-    ci_cmake_generator = ["-G", "Unix Makefiles"]
-
+        ci_cmake_generator = ["-G", "Unix Makefiles"]
+        
     cmake_args = (
         (ci_cmake_generator if is_CI_build else [])
         + [

From b14fc8626fafffa302957258e53f19b1a7ba111d Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 9 Jun 2025 16:43:16 +0300
Subject: [PATCH 24/45] Update setup.py

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

diff --git a/setup.py b/setup.py
index 33101ac3..199f4c72 100644
--- a/setup.py
+++ b/setup.py
@@ -159,7 +159,9 @@ def main():
     # Files in sourcetree outside package dir that should be copied to package.
     # Raw paths relative to sourcetree root.
     files_outside_package_dir = {"cv2": ["LICENSE.txt", "LICENSE-3RD-PARTY.txt"]}
-
+    
+    windows_version = int(platform.release())
+    print(windows_version)
     if os.name == "nt": 
         if windows_version == 2025:
             generator_name = "Visual Studio 17"

From eec14cc5536ed2784c9949cc96a9194770cd66af Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 9 Jun 2025 16:48:24 +0300
Subject: [PATCH 25/45] Update build_wheels_windows.yml

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

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index 99ef15f1..3dc09501 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-2025
+    runs-on: windows-2019
     strategy:
       fail-fast: false
       matrix:

From c860bb9f0cb818018696a3724526e59841e0887a Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 9 Jun 2025 16:50:35 +0300
Subject: [PATCH 26/45] Update setup.py

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

diff --git a/setup.py b/setup.py
index 199f4c72..99c5c98d 100644
--- a/setup.py
+++ b/setup.py
@@ -163,7 +163,7 @@ def main():
     windows_version = int(platform.release())
     print(windows_version)
     if os.name == "nt": 
-        if windows_version == 2025:
+        if windows_version == 10:
             generator_name = "Visual Studio 17"
         else:
             enerator_name = "Visual Studio 14"

From d32432016000cc1e004599adbb07b05a87b3bfcb Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 9 Jun 2025 17:07:13 +0300
Subject: [PATCH 27/45] Update setup.py

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

diff --git a/setup.py b/setup.py
index 99c5c98d..28db461c 100644
--- a/setup.py
+++ b/setup.py
@@ -160,11 +160,10 @@ def main():
     # Raw paths relative to sourcetree root.
     files_outside_package_dir = {"cv2": ["LICENSE.txt", "LICENSE-3RD-PARTY.txt"]}
     
-    windows_version = int(platform.release())
-    print(windows_version)
     if os.name == "nt": 
-        if windows_version == 10:
-            generator_name = "Visual Studio 17"
+        vs_env = os.environ.get("VISUAL_STUDIO")
+        if vs_env == "17":
+           generator_name = "Visual Studio 17"
         else:
             enerator_name = "Visual Studio 14"
         ci_cmake_generator = ["-G", generator_name + (" Win64" if is64 else "")]

From 60d8b855c6c615b2db9996c48f465decd271eb00 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 9 Jun 2025 17:10:11 +0300
Subject: [PATCH 28/45] Update setup.py

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

diff --git a/setup.py b/setup.py
index 28db461c..0c084603 100644
--- a/setup.py
+++ b/setup.py
@@ -159,13 +159,13 @@ def main():
     # Files in sourcetree outside package dir that should be copied to package.
     # Raw paths relative to sourcetree root.
     files_outside_package_dir = {"cv2": ["LICENSE.txt", "LICENSE-3RD-PARTY.txt"]}
-    
+
     if os.name == "nt": 
         vs_env = os.environ.get("VISUAL_STUDIO")
         if vs_env == "17":
            generator_name = "Visual Studio 17"
         else:
-            enerator_name = "Visual Studio 14"
+           generator_name = "Visual Studio 14"
         ci_cmake_generator = ["-G", generator_name + (" Win64" if is64 else "")]
     else:
         ci_cmake_generator = ["-G", "Unix Makefiles"]

From 7dfe2c9d876ac6d6333dccec122344b784a5a0a3 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 9 Jun 2025 17:20:45 +0300
Subject: [PATCH 29/45] Update build_wheels_windows.yml

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

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index 3dc09501..5450c3c8 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:
@@ -65,6 +65,7 @@ jobs:
     - 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: |
+        set "VISUAL_STUDIO=17"
         python --version
         python -m pip install --upgrade pip
         python -m pip install --upgrade setuptools

From f8f3ed8589b3313a5965ca99fcfbb47186d9dfb1 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 9 Jun 2025 21:36:40 +0300
Subject: [PATCH 30/45] Update build_wheels_windows.yml

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

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index 5450c3c8..773a7c75 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-2025
+    runs-on: windows-2022
     strategy:
       fail-fast: false
       matrix:
@@ -82,7 +82,7 @@ jobs:
 
   Test:
     needs: [Build]
-    runs-on: windows-2025
+    runs-on: windows-2022
     defaults:
       run:
         shell: cmd

From cebae276ba243cc8edfa09dad3321ab0d10e4740 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 9 Jun 2025 21:58:17 +0300
Subject: [PATCH 31/45] Update setup.py

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

diff --git a/setup.py b/setup.py
index 0c084603..d9397725 100644
--- a/setup.py
+++ b/setup.py
@@ -166,7 +166,7 @@ def main():
            generator_name = "Visual Studio 17"
         else:
            generator_name = "Visual Studio 14"
-        ci_cmake_generator = ["-G", generator_name + (" Win64" if is64 else "")]
+        ci_cmake_generator = ["-G", generator_name] + (["-A", "x64"] if is64 else ["-A", "Win32"])
     else:
         ci_cmake_generator = ["-G", "Unix Makefiles"]
         

From d0b029e98ecae5dbc7fe5392b5d853ac583b1bc5 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 9 Jun 2025 22:21:24 +0300
Subject: [PATCH 32/45] Update setup.py

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

diff --git a/setup.py b/setup.py
index d9397725..9ebafacc 100644
--- a/setup.py
+++ b/setup.py
@@ -163,10 +163,12 @@ def main():
     if os.name == "nt": 
         vs_env = os.environ.get("VISUAL_STUDIO")
         if vs_env == "17":
-           generator_name = "Visual Studio 17"
+           generator_name = "Visual Studio 17 2022"
+           arch = "x64" if is64 else "Win32"
+           ci_cmake_generator = ["-G", generator_name, "-A", arch]
         else:
-           generator_name = "Visual Studio 14"
-        ci_cmake_generator = ["-G", generator_name] + (["-A", "x64"] if is64 else ["-A", "Win32"])
+           generator_name = "Visual Studio 14" + (" Win64" if is64 else "")
+           ci_cmake_generator = ["-G", generator_name]
     else:
         ci_cmake_generator = ["-G", "Unix Makefiles"]
         

From 93929b6457a87d68aa149d8a797e398f5e15b632 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 9 Jun 2025 22:26:37 +0300
Subject: [PATCH 33/45] Update setup.py

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

diff --git a/setup.py b/setup.py
index 9ebafacc..0a0c4eea 100644
--- a/setup.py
+++ b/setup.py
@@ -165,7 +165,7 @@ def main():
         if vs_env == "17":
            generator_name = "Visual Studio 17 2022"
            arch = "x64" if is64 else "Win32"
-           ci_cmake_generator = ["-G", generator_name, "-A", arch]
+           ci_cmake_generator = ["-G", generator_name, "-A", arch, "-T", "v143"]
         else:
            generator_name = "Visual Studio 14" + (" Win64" if is64 else "")
            ci_cmake_generator = ["-G", generator_name]

From aef056266414551e9c07634053db37d0c2abaf57 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 9 Jun 2025 22:38:33 +0300
Subject: [PATCH 34/45] Update build_wheels_windows.yml

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

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index 773a7c75..5450c3c8 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-2022
+    runs-on: windows-2025
     strategy:
       fail-fast: false
       matrix:
@@ -82,7 +82,7 @@ jobs:
 
   Test:
     needs: [Build]
-    runs-on: windows-2022
+    runs-on: windows-2025
     defaults:
       run:
         shell: cmd

From 878d9f9e0f6fe1427ee2ea48b422f24ca574b9b8 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Mon, 9 Jun 2025 22:52:32 +0300
Subject: [PATCH 35/45] Update setup.py

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

diff --git a/setup.py b/setup.py
index 0a0c4eea..9ebafacc 100644
--- a/setup.py
+++ b/setup.py
@@ -165,7 +165,7 @@ def main():
         if vs_env == "17":
            generator_name = "Visual Studio 17 2022"
            arch = "x64" if is64 else "Win32"
-           ci_cmake_generator = ["-G", generator_name, "-A", arch, "-T", "v143"]
+           ci_cmake_generator = ["-G", generator_name, "-A", arch]
         else:
            generator_name = "Visual Studio 14" + (" Win64" if is64 else "")
            ci_cmake_generator = ["-G", generator_name]

From da9d1b9c684ddca7b5ff8ba8f8d239642fa7c577 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Tue, 10 Jun 2025 20:24:15 +0300
Subject: [PATCH 36/45] Update build_wheels_windows.yml

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

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index 5450c3c8..773a7c75 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-2025
+    runs-on: windows-2022
     strategy:
       fail-fast: false
       matrix:
@@ -82,7 +82,7 @@ jobs:
 
   Test:
     needs: [Build]
-    runs-on: windows-2025
+    runs-on: windows-2022
     defaults:
       run:
         shell: cmd

From da2e6b823133c9bb4bc3697552ac3562da748f37 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Tue, 10 Jun 2025 20:24:52 +0300
Subject: [PATCH 37/45] Update setup.py

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

diff --git a/setup.py b/setup.py
index 9ebafacc..bb54944d 100644
--- a/setup.py
+++ b/setup.py
@@ -199,6 +199,7 @@ def main():
             "-DBUILD_DOCS=OFF",
             "-DPYTHON3_LIMITED_API=ON",
             "-DBUILD_OPENEXR=ON",
+            "-DWITH_OBSENSOR=OFF",
         ]
         + (
             # CMake flags for windows/arm64 build

From 8a872906b5b17f00370f94c4366a01bc1a2209dd Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Tue, 10 Jun 2025 20:41:31 +0300
Subject: [PATCH 38/45] Update setup.py

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

diff --git a/setup.py b/setup.py
index bb54944d..39b5387e 100644
--- a/setup.py
+++ b/setup.py
@@ -200,6 +200,7 @@ def main():
             "-DPYTHON3_LIMITED_API=ON",
             "-DBUILD_OPENEXR=ON",
             "-DWITH_OBSENSOR=OFF",
+            "-DWITH_MEDIAFOUNDATION=OFF",
         ]
         + (
             # CMake flags for windows/arm64 build

From 560670dce615261c36cf48a53200b802390d3918 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Thu, 19 Jun 2025 14:23:50 +0300
Subject: [PATCH 39/45] Update build_wheels_macos_m1.yml

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

diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml
index 1e62c858..7591e8f0 100644
--- a/.github/workflows/build_wheels_macos_m1.yml
+++ b/.github/workflows/build_wheels_macos_m1.yml
@@ -36,6 +36,19 @@ jobs:
       ENABLE_CONTRIB: ${{ matrix.with_contrib }}
       PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple
     steps:
+    - name: Check pyenv versions
+      run: pyenv versions
+
+    - name: Check Python versions
+      run: |
+          python3.7 --version || echo "python3.7 not found"
+          python3.8 --version || echo "python3.8 not found"
+          python3.9 --version || echo "python3.9 not found"
+          python3.10 --version || echo "python3.10 not found"
+          python3.11 --version || echo "python3.11 not found"
+          python3.12 --version || echo "python3.12 not found"
+          python3.13 --version || echo "python3.13 not found"
+
     - name: Cleanup
       run: find . -mindepth 1 -delete
       working-directory: ${{ github.workspace }}

From 10dd63c16d977ec04278568cbaf208e9ec839e45 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Fri, 20 Jun 2025 16:02:47 +0300
Subject: [PATCH 40/45] Update build_wheels_macos_m1.yml

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

diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml
index 7591e8f0..faf736db 100644
--- a/.github/workflows/build_wheels_macos_m1.yml
+++ b/.github/workflows/build_wheels_macos_m1.yml
@@ -36,19 +36,7 @@ jobs:
       ENABLE_CONTRIB: ${{ matrix.with_contrib }}
       PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple
     steps:
-    - name: Check pyenv versions
-      run: pyenv versions
-
-    - name: Check Python versions
-      run: |
-          python3.7 --version || echo "python3.7 not found"
-          python3.8 --version || echo "python3.8 not found"
-          python3.9 --version || echo "python3.9 not found"
-          python3.10 --version || echo "python3.10 not found"
-          python3.11 --version || echo "python3.11 not found"
-          python3.12 --version || echo "python3.12 not found"
-          python3.13 --version || echo "python3.13 not found"
-
+    
     - name: Cleanup
       run: find . -mindepth 1 -delete
       working-directory: ${{ github.workspace }}

From 7b587e1f0f1662d5951317909433ec8bba0fdd4e Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Fri, 20 Jun 2025 16:03:55 +0300
Subject: [PATCH 41/45] Update build_wheels_windows.yml

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

diff --git a/.github/workflows/build_wheels_windows.yml b/.github/workflows/build_wheels_windows.yml
index 773a7c75..a1a36ff8 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-2022
+    runs-on: windows-2019
     strategy:
       fail-fast: false
       matrix:
@@ -61,11 +61,9 @@ jobs:
       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: |
-        set "VISUAL_STUDIO=17"
         python --version
         python -m pip install --upgrade pip
         python -m pip install --upgrade setuptools
@@ -73,7 +71,6 @@ jobs:
         python -m pip install toml && python -c "import toml; c = toml.load('pyproject.toml'); print('\n'.join(c['build-system']['requires']))" >> requirements.txt | python -m pip install -r requirements.txt
         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@v4
       with:
@@ -82,7 +79,7 @@ jobs:
 
   Test:
     needs: [Build]
-    runs-on: windows-2022
+    runs-on: windows-2019
     defaults:
       run:
         shell: cmd

From ea51e72b00eb60108a96688ad26b3d9576db0c48 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Fri, 20 Jun 2025 16:04:18 +0300
Subject: [PATCH 42/45] Update setup.py

---
 setup.py | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/setup.py b/setup.py
index 0970bf32..9aff8d23 100755
--- a/setup.py
+++ b/setup.py
@@ -162,18 +162,12 @@ def main():
     # Raw paths relative to sourcetree root.
     files_outside_package_dir = {"cv2": ["LICENSE.txt", "LICENSE-3RD-PARTY.txt"]}
 
-    if os.name == "nt": 
-        vs_env = os.environ.get("VISUAL_STUDIO")
-        if vs_env == "17":
-           generator_name = "Visual Studio 17 2022"
-           arch = "x64" if is64 else "Win32"
-           ci_cmake_generator = ["-G", generator_name, "-A", arch]
-        else:
-           generator_name = "Visual Studio 14" + (" Win64" if is64 else "")
-           ci_cmake_generator = ["-G", generator_name]
-    else:
-        ci_cmake_generator = ["-G", "Unix Makefiles"]
-        
+    ci_cmake_generator = (
+        ["-G", "Visual Studio 14" + (" Win64" if is64 else "")]
+        if os.name == "nt"
+        else ["-G", "Unix Makefiles"]
+    )
+
     cmake_args = (
         (ci_cmake_generator if is_CI_build else [])
         + [
@@ -201,8 +195,6 @@ def main():
             "-DBUILD_DOCS=OFF",
             "-DPYTHON3_LIMITED_API=ON",
             "-DBUILD_OPENEXR=ON",
-            "-DWITH_OBSENSOR=OFF",
-            "-DWITH_MEDIAFOUNDATION=OFF",
         ]
         + (
             # CMake flags for windows/arm64 build

From 336271857b3224c16a759ec21e6486e8caa03ce6 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Fri, 20 Jun 2025 16:04:44 +0300
Subject: [PATCH 43/45] Update build_wheels_macos_m1.yml

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

diff --git a/.github/workflows/build_wheels_macos_m1.yml b/.github/workflows/build_wheels_macos_m1.yml
index faf736db..1e62c858 100644
--- a/.github/workflows/build_wheels_macos_m1.yml
+++ b/.github/workflows/build_wheels_macos_m1.yml
@@ -36,7 +36,6 @@ jobs:
       ENABLE_CONTRIB: ${{ matrix.with_contrib }}
       PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple
     steps:
-    
     - name: Cleanup
       run: find . -mindepth 1 -delete
       working-directory: ${{ github.workspace }}

From 88f1c276fd3d9927118f792813874d756b3d77cf Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Fri, 20 Jun 2025 16:06:22 +0300
Subject: [PATCH 44/45] Create Dockerfile-alpine-musllinux-test

---
 .../Dockerfile-alpine-musllinux-test          | 159 ++++++++++++++++++
 1 file changed, 159 insertions(+)
 create mode 100644 docker/musllinux/Dockerfile-alpine-musllinux-test

diff --git a/docker/musllinux/Dockerfile-alpine-musllinux-test b/docker/musllinux/Dockerfile-alpine-musllinux-test
new file mode 100644
index 00000000..c945ecfd
--- /dev/null
+++ b/docker/musllinux/Dockerfile-alpine-musllinux-test
@@ -0,0 +1,159 @@
+# Version: 20250619
+# musllinux-compatible build environment for OpenCV Python wheels
+
+FROM alpine:3.19
+
+ARG CCACHE_VERSION=3.7.9
+ARG FFMPEG_VERSION=5.1.6
+ARG FREETYPE_VERSION=2.13.3
+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 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
+
+RUN apk add --no-cache \
+    build-base \
+    diffutils \
+    cmake \
+    bash \
+    git \
+    curl \
+    wget \
+    tar \
+    xz \
+    zlib-dev \
+    xz-dev \
+    nasm \
+    yasm \
+    pkgconfig \
+    openssl-dev \
+    libjpeg-turbo-dev \
+    fontconfig-dev \
+    freetype-dev \
+    expat-dev \
+    libpng-dev \
+    alsa-lib-dev \
+    musl-dev \
+    linux-headers \
+    perl
+
+### libpng
+RUN mkdir ~/libpng_sources && \
+    cd ~/libpng_sources && \
+    curl -O -L https://download.sourceforge.net/libpng/libpng-${LIBPNG_VERSION}.tar.gz && \
+    tar -xf libpng-${LIBPNG_VERSION}.tar.gz && \
+    cd libpng-${LIBPNG_VERSION} && \
+    ./configure --prefix=/usr/local && \
+    make && \
+    make install && \
+    cd .. && \
+    rm -rf ~/libpng_sources
+
+### freetype
+RUN mkdir ~/freetype_sources && \
+    cd ~/freetype_sources && \
+    curl -O -L https://download.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 && \
+    make && \
+    make install && \
+    cd .. && \
+    rm -rf ~/freetype_sources
+
+### OpenSSL
+RUN mkdir ~/openssl_sources && \
+    cd ~/openssl_sources && \
+    curl -O -L https://github.com/openssl/openssl/archive/OpenSSL_${OPENSSL_VERSION}.tar.gz && \
+    tar -xf OpenSSL_${OPENSSL_VERSION}.tar.gz && \
+    cd openssl-OpenSSL_${OPENSSL_VERSION} && \
+    ./config --prefix="/ffmpeg_build" --openssldir="/ffmpeg_build" no-pinshared shared zlib && \
+    make -j$(getconf _NPROCESSORS_ONLN) && \
+    # skip installing documentation
+    make install_sw && \
+    cd .. && \
+    rm -rf ~/openssl_build ~/openssl_sources
+
+
+### NASM YASM exist in alpine
+
+### libvpx
+RUN mkdir ~/libvpx_sources && \
+    cd ~/libvpx_sources && \
+    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) && \
+    make install && \
+    cd .. && \
+    rm -rf ~/libvpx_sources
+
+### aom
+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
+
+### avif
+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
+
+### ffmpeg
+RUN mkdir ~/ffmpeg_sources && \
+    cd ~/ffmpeg_sources && \
+    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="/usr/local" \
+        --extra-cflags="-I/ffmpeg_build/include -Wno-error=array-bounds -Wno-error=unused-variable" \
+        --extra-ldflags="-L/ffmpeg_build/lib" \
+        --enable-openssl \
+        --enable-libvpx \
+        --enable-shared \
+        --enable-pic \
+        --bindir="$HOME/bin" && \
+    make -j$(getconf _NPROCESSORS_ONLN) && \
+    make install && \
+    echo "/ffmpeg_build/lib/" >> /etc/ld.so.conf && \
+    ldconfig && \
+    rm -rf ~/ffmpeg_sources
+
+### ccache
+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 && \
+    cd ccache-${CCACHE_VERSION} && \
+    ./configure && \
+    make -j$(getconf _NPROCESSORS_ONLN) && \
+    make install && \
+    cd .. && \
+    rm -rf ccache-${CCACHE_VERSION}.tar.gz
+
+#  user`s UID is 1001
+RUN adduser -D -u 1001 ci && mkdir /io && chown ci:ci /io &&  \
+    # This needs to find ffmpeg packages from ci user
+    chown -R ci:ci /ffmpeg_build
+
+USER ci
+WORKDIR /io
+
+RUN git config --global --add safe.directory /io
+ENV PATH="/home/ci/bin:/ffmpeg_build/bin:$PATH"
+ENV LD_LIBRARY_PATH="/ffmpeg_build/lib:/usr/local/lib:$LD_LIBRARY_PATH"
+ENV PKG_CONFIG_PATH="/ffmpeg_build/lib/pkgconfig:/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"

From c17d164d43e58a2f4cf0571e85224c68c9600810 Mon Sep 17 00:00:00 2001
From: Ivan Avdeev <avdeeff@internet.ru>
Date: Fri, 20 Jun 2025 17:02:39 +0300
Subject: [PATCH 45/45] Update Dockerfile-alpine-musllinux-test

---
 .../Dockerfile-alpine-musllinux-test          | 29 +++++++++----------
 1 file changed, 14 insertions(+), 15 deletions(-)

diff --git a/docker/musllinux/Dockerfile-alpine-musllinux-test b/docker/musllinux/Dockerfile-alpine-musllinux-test
index c945ecfd..94a27b09 100644
--- a/docker/musllinux/Dockerfile-alpine-musllinux-test
+++ b/docker/musllinux/Dockerfile-alpine-musllinux-test
@@ -42,6 +42,8 @@ RUN apk add --no-cache \
     linux-headers \
     perl
 
+RUN apk del libpng-dev
+
 ### libpng
 RUN mkdir ~/libpng_sources && \
     cd ~/libpng_sources && \
@@ -114,26 +116,22 @@ RUN mkdir ~/avif_sources && \
     cd / && rm -rf ~/avif_sources
 
 ### ffmpeg
-RUN mkdir ~/ffmpeg_sources && \
-    cd ~/ffmpeg_sources && \
-    curl -O -L https://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz && \
+RUN mkdir -p /ffmpeg_sources && \
+    cd /ffmpeg_sources && \
+    curl -LO 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="/usr/local" \
-        --extra-cflags="-I/ffmpeg_build/include -Wno-error=array-bounds -Wno-error=unused-variable" \
+        --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" && \
+        --enable-pic && \
     make -j$(getconf _NPROCESSORS_ONLN) && \
     make install && \
-    echo "/ffmpeg_build/lib/" >> /etc/ld.so.conf && \
-    ldconfig && \
-    rm -rf ~/ffmpeg_sources
+    rm -rf /ffmpeg_sources
 
 ### ccache
 RUN curl -O -L https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/ccache-${CCACHE_VERSION}.tar.gz && \
@@ -151,9 +149,10 @@ RUN adduser -D -u 1001 ci && mkdir /io && chown ci:ci /io &&  \
     chown -R ci:ci /ffmpeg_build
 
 USER ci
-WORKDIR /io
 
 RUN git config --global --add safe.directory /io
-ENV PATH="/home/ci/bin:/ffmpeg_build/bin:$PATH"
-ENV LD_LIBRARY_PATH="/ffmpeg_build/lib:/usr/local/lib:$LD_LIBRARY_PATH"
-ENV PKG_CONFIG_PATH="/ffmpeg_build/lib/pkgconfig:/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"
+ENV PATH="/ffmpeg_build/bin:$PATH"
+ENV PKG_CONFIG_PATH /usr/local/lib/pkgconfig:/ffmpeg_build/lib/pkgconfig
+ENV LDFLAGS -L/ffmpeg_build/lib
+ENV PATH "$HOME/bin:$PATH"
+ENV LD_LIBRARY_PATH="/ffmpeg_build/lib:$LD_LIBRARY_PATH"