Merge remote-tracking branch 'upstream/3.4' into merge-3.4
authorOpenCV Developers <dev@opencv.org>
Sat, 14 May 2022 11:21:33 +0000 (11:21 +0000)
committerOpenCV Developers <dev@opencv.org>
Sat, 14 May 2022 11:23:21 +0000 (11:23 +0000)
17 files changed:
1  2 
.github/workflows/PR-4.x-ARM64.yaml
.github/workflows/PR-4.x-U20.yaml
.github/workflows/PR-4.x-W10.yaml
doc/js_tutorials/js_setup/js_nodejs/js_nodejs.markdown
doc/tutorials/imgproc/imgtrans/hough_circle/hough_circle.markdown
doc/tutorials/imgproc/morph_lines_detection/morph_lines_detection.md
modules/core/include/opencv2/core/mat.hpp
modules/core/src/parallel.cpp
modules/imgcodecs/include/opencv2/imgcodecs.hpp
modules/imgcodecs/src/grfmt_jpeg.cpp
modules/imgcodecs/src/grfmt_tiff.cpp
modules/imgcodecs/test/test_tiff.cpp
modules/imgproc/include/opencv2/imgproc.hpp
modules/imgproc/test/test_convhull.cpp
modules/js/test/test_imgproc.js
modules/videoio/src/cap_gstreamer.cpp
modules/videoio/test/test_video_io.cpp

index 0000000,0000000..b2f5de1
new file mode 100644 (file)
--- /dev/null
--- /dev/null
@@@ -1,0 -1,0 +1,187 @@@
++name: PR:4.x ARM64
++
++# TODO: enable pipeline after 4.x update
++on: workflow_dispatch
++
++env:
++  EXTRA_CMAKE_OPTIONS: '-DBUILD_DOCS=ON -DPYTHON_DEFAULT_EXECUTABLE=/usr/bin/python3 -DBUILD_opencv_xfeatures2d=OFF -DBUILD_EXAMPLES=ON -DOPENCV_ENABLE_NONFREE=ON -DENABLE_CCACHE=OFF'
++  OPENCV_TEST_DATA_PATH: '/opencv_extra/testdata'
++  OPENCV_DOCKER_WORKDIR: '/__w/opencv/opencv'
++  PR_AUTHOR: ${{ github.event.pull_request.user.login }}
++  PR_AUTHOR_FORK: ${{ github.event.pull_request.head.repo.full_name }}
++  SOURCE_BRANCH_NAME: ${{ github.head_ref }}
++  TARGET_BRANCH_NAME: ${{ github.base_ref }}
++  ANT_HOME: '/usr/share/ant'
++  PYTHONPATH: /opencv-build/python_loader:$PYTHONPATH
++
++jobs:
++  BuildAndTest:
++    runs-on: opencv-cn-lin-arm64
++    defaults:
++      run:
++        shell: bash
++    container:
++      image: docker.io/yuentau/ocv_ubuntu:20.04-arm64
++    steps:
++    - name: PR info
++      run: |
++        echo "PR Author: ${{ env.PR_AUTHOR }}"
++        echo "PR Author fork: ${{ env.PR_AUTHOR_FORK }}"
++        echo "Source branch name: ${{ env.SOURCE_BRANCH_NAME }}"
++        echo "Target branch name: ${{ env.TARGET_BRANCH_NAME }}"
++    - name: Clean
++      run: find . -mindepth 1 -delete
++    - name: Fetch opencv
++      uses: actions/checkout@v3
++      with:
++        repository: opencv/opencv
++        ref: ${{ env.TARGET_BRANCH_NAME }}
++        fetch-depth: 0
++    - name: Merge opencv with ${{ env.SOURCE_BRANCH_NAME }} branch
++      run: |
++        cd ${{ env.OPENCV_DOCKER_WORKDIR }}
++        git config --global --add safe.directory ${{ env.OPENCV_DOCKER_WORKDIR }}
++        git config user.email "opencv.ci"
++        git config user.name "opencv.ci"
++        git pull -v "https://github.com/${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}"
++    - name: Clone opencv_extra
++      run: git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} https://github.com/opencv/opencv_extra.git /opencv_extra
++    - name: Merge opencv_extra with ${{ env.SOURCE_BRANCH_NAME }} branch
++      run: |
++        OPENCV_EXTRA_FORK=$(git ls-remote --heads "https://github.com/${{ env.PR_AUTHOR }}/opencv_extra" "${{ env.SOURCE_BRANCH_NAME }}") || true
++        if [[ ! -z "$OPENCV_EXTRA_FORK" ]]; then
++          echo "Merge opencv_extra with ${{ env.SOURCE_BRANCH_NAME }} branch"
++          cd /opencv_extra
++          git config user.email "opencv.ci"
++          git config user.name "opencv.ci"
++          git pull -v "https://github.com/${{ env.PR_AUTHOR }}/opencv_extra" "${{ env.SOURCE_BRANCH_NAME }}"
++        else
++          echo "No merge since ${{ env.PR_AUTHOR }}/opencv_extra does not have branch ${{ env.SOURCE_BRANCH_NAME }}"
++        fi
++    - name: Configure OpenCV
++      run: |
++        cmake -G Ninja -B /opencv-build ${{ env.EXTRA_CMAKE_OPTIONS }} ${{ env.OPENCV_DOCKER_WORKDIR }}
++    - name: Build OpenCV
++      run: |
++        cd /opencv-build
++        ninja
++    - name: Accuracy:calib3d
++      run: cd /opencv-build && xvfb-run -a bin/opencv_test_calib3d
++    - name: Accuracy:core
++      run: cd /opencv-build && xvfb-run -a bin/opencv_test_core
++    - name: Accuracy:dnn
++      run: cd /opencv-build && xvfb-run -a bin/opencv_test_dnn
++    - name: Accuracy:features2d
++      run: cd /opencv-build && xvfb-run -a bin/opencv_test_features2d
++    - name: Accuracy:flann
++      run: cd /opencv-build && xvfb-run -a bin/opencv_test_flann
++    - name: Accuracy:highgui
++      run: cd /opencv-build && xvfb-run -a bin/opencv_test_highgui
++    - name: Accuracy:imgcodecs
++      run: cd /opencv-build && xvfb-run -a bin/opencv_test_imgcodecs
++    - name: Accuracy:imgproc
++      run: cd /opencv-build && xvfb-run -a bin/opencv_test_imgproc
++    - name: Accuracy:ml
++      run: cd /opencv-build && xvfb-run -a bin/opencv_test_ml
++    - name: Accuracy:objdetect
++      run: cd /opencv-build && xvfb-run -a bin/opencv_test_objdetect --gtest_filter="-Objdetect_QRCode_Close.regression/0:Objdetect_QRCode_Close.regression/4"
++    - name: Accuracy:photo
++      run: cd /opencv-build && xvfb-run -a bin/opencv_test_photo --gtest_filter="-Photo_CalibrateDebevec.regression"
++    - name: Accuracy:shape
++      run: cd /opencv-build && xvfb-run -a bin/opencv_test_shape
++    - name: Accuracy:stitching
++      run: cd /opencv-build && xvfb-run -a bin/opencv_test_stitching
++    - name: Accuracy:superres
++      run: cd /opencv-build && xvfb-run -a bin/opencv_test_superres
++    - name: Accuracy:video
++      run: cd /opencv-build && xvfb-run -a bin/opencv_test_video
++    - name: Accuracy:videoio
++      run: cd /opencv-build && xvfb-run -a bin/opencv_test_videoio
++    - name: Accuracy:videostab
++      run: cd /opencv-build && xvfb-run -a bin/opencv_test_videostab
++    - name: Performance:calib3d
++      run: cd /opencv-build && xvfb-run -a bin/opencv_perf_calib3d --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1
++    - name: Performance:core
++      run: cd /opencv-build && xvfb-run -a bin/opencv_perf_core --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1
++    - name: Performance:dnn
++      run: cd /opencv-build && xvfb-run -a bin/opencv_perf_dnn --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1
++    - name: Performance:features2d
++      run: cd /opencv-build && xvfb-run -a bin/opencv_perf_features2d --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1
++    - name: Performance:imgcodecs
++      run: cd /opencv-build && xvfb-run -a bin/opencv_perf_imgcodecs --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1
++    - name: Performance:imgproc
++      run: cd /opencv-build && xvfb-run -a bin/opencv_perf_imgproc --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1
++    - name: Performance:objdetect
++      run: cd /opencv-build && xvfb-run -a bin/opencv_perf_objdetect --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1 --gtest_filter="-Perf_Objdetect_QRCode.detect/2:Perf_Objdetect_QRCode_Multi.decodeMulti*:Perf_Objdetect_QRCode_Multi.detectMulti*"
++    - name: Performance:photo
++      run: cd /opencv-build && xvfb-run -a bin/opencv_perf_photo --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1
++    - name: Performance:stitching
++      run: cd /opencv-build && xvfb-run -a bin/opencv_perf_stitching --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1
++    - name: Performance:superres
++      run: cd /opencv-build && xvfb-run -a bin/opencv_perf_superres --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1
++    - name: Performance:video
++      run: cd /opencv-build && xvfb-run -a bin/opencv_perf_video --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1
++    - name: Performance:videoio
++      run: cd /opencv-build && xvfb-run -a bin/opencv_perf_videoio --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1
++    - name: Python3
++      run: |
++        cd ${{ env.OPENCV_DOCKER_WORKDIR }}/modules/python/test
++        python3 ./test.py --repo ../../../ -v
++    - name: Java
++      run: cd /opencv-build && xvfb-run -a python3 ${{ env.OPENCV_DOCKER_WORKDIR }}/modules/ts/misc/run.py . -a -t java
++    - name: Save Unit Test Results
++      uses: actions/upload-artifact@v3
++      if: always()
++      with:
++        name: junit-html
++        path: /opencv-build/java_test/testResults/junit-noframes.html
++
++  BuildContrib:
++    runs-on: opencv-cn-lin-arm64
++    defaults:
++      run:
++        shell: bash
++    container:
++      image: docker.io/yuentau/ocv_ubuntu:20.04-arm64
++    steps:
++    - name: PR info
++      run: |
++        echo "PR Author: ${{ env.PR_AUTHOR }}"
++        echo "Source branch name: ${{ env.SOURCE_BRANCH_NAME }}"
++        echo "Target branch name: ${{ env.TARGET_BRANCH_NAME }}"
++    - name: Clean
++      run: find . -mindepth 1 -delete
++    - name: Fetch opencv
++      uses: actions/checkout@v3
++      with:
++        repository: opencv/opencv
++        ref: ${{ env.TARGET_BRANCH_NAME }}
++        fetch-depth: 0
++    - name: Merge opencv with a test branch
++      run: |
++        cd ${{ env.OPENCV_DOCKER_WORKDIR }}
++        git config --global --add safe.directory ${{ env.OPENCV_DOCKER_WORKDIR }}
++        git config user.email "opencv.ci"
++        git config user.name "opencv.ci"
++        git pull -v "https://github.com/${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}"
++    - name: Clone opencv_contrib
++      run: git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} https://github.com/opencv/opencv_contrib.git /opencv_contrib
++    - name: Merge opencv_contrib with ${{ env.SOURCE_BRANCH_NAME }} branch
++      run: |
++        OPENCV_CONTRIB_FORK=$(git ls-remote --heads "https://github.com/${{ env.PR_AUTHOR }}/opencv_contrib" "${{ env.SOURCE_BRANCH_NAME }}") || true
++        if [[ ! -z "$OPENCV_CONTRIB_FORK" ]]; then
++          echo "Merge opencv_contrib with ${{ env.SOURCE_BRANCH_NAME }} branch"
++          cd /opencv_contrib
++          git config user.email "opencv.ci"
++          git config user.name "opencv.ci"
++          git pull -v "https://github.com/${{ env.PR_AUTHOR }}/opencv_contrib" "${{ env.SOURCE_BRANCH_NAME }}"
++        else
++          echo "No merge since ${{ env.PR_AUTHOR }}/opencv_contrib does not have branch ${{ env.SOURCE_BRANCH_NAME }}"
++        fi
++    - name: Configure OpenCV Contrib
++      run: |
++        cmake -G Ninja -B /opencv-contrib-build ${{ env.EXTRA_CMAKE_OPTIONS }} -DOPENCV_EXTRA_MODULES_PATH=/opencv_contrib/modules ${{ env.OPENCV_DOCKER_WORKDIR }}
++    - name: Build OpenCV Contrib
++      run: |
++        cd /opencv-contrib-build
++        ninja
index 5fd17b6,0000000..10b0847
mode 100644,000000..100644
--- /dev/null
@@@ -1,188 -1,0 +1,189 @@@
-   EXTRA_CMAKE_OPTIONS: '-DBUILD_DOCS=ON -DPYTHON_DEFAULT_EXECUTABLE=/usr/bin/python3 -DBUILD_EXAMPLES=ON -DOPENCV_ENABLE_NONFREE=ON -DENABLE_CCACHE=OFF'
-   OPENCV_TEST_DATA_PATH: '/opencv_extra/testdata'
-   OPENCV_DOCKER_WORKDIR: '/__w/opencv/opencv'
 +name: PR:4.x U20
 +
 +on:
 +  pull_request:
 +    branches:
 +      - 4.x
 +
 +env:
-   ANT_HOME: '/usr/share/ant'
++  EXTRA_CMAKE_OPTIONS: '-DBUILD_DOCS=ON -DPYTHON_DEFAULT_EXECUTABLE=/usr/bin/python3 -DOPENCV_DOWNLOAD_PATH=/home/ci/binaries_cache -DBUILD_EXAMPLES=ON -DOPENCV_ENABLE_NONFREE=ON'
 +  PR_AUTHOR: ${{ github.event.pull_request.user.login }}
 +  PR_AUTHOR_FORK: ${{ github.event.pull_request.head.repo.full_name }}
 +  SOURCE_BRANCH_NAME: ${{ github.head_ref }}
 +  TARGET_BRANCH_NAME: ${{ github.base_ref }}
-     runs-on: ubuntu-20.04
++  ANT_HOME: /usr/share/ant
++  GIT_CACHE_DOCKER: /home/ci/git_cache
 +  PYTHONPATH: /opencv-build/python_loader:$PYTHONPATH
++  OPENCV_TEST_DATA_PATH: /opencv_extra/testdata
++  OPENCV_DOCKER_WORKDIR: /opencv
 +
 +jobs:
 +  BuildAndTest:
-       run: find . -mindepth 1 -delete
++    runs-on: opencv-cn-lin-x86-64
 +    defaults:
 +      run:
 +        shell: bash
 +    container:
 +      image: quay.io/asenyaev/opencv-ubuntu:20.04
++      volumes:
++        - /home/opencv-cn/git_cache:/home/ci/git_cache
++        - /home/opencv-cn/ci_cache/opencv:/home/ci/.ccache
++        - /home/opencv-cn/binaries_cache:/home/ci/binaries_cache
 +    steps:
 +    - name: PR info
 +      run: |
 +        echo "PR Author: ${{ env.PR_AUTHOR }}"
 +        echo "Source branch name: ${{ env.SOURCE_BRANCH_NAME }}"
 +        echo "Target branch name: ${{ env.TARGET_BRANCH_NAME }}"
 +    - name: Clean
-       uses: actions/checkout@v3
-       with:
-         repository: opencv/opencv
-         ref: ${{ env.TARGET_BRANCH_NAME }}
-         fetch-depth: 0
++      run: find ${{ env.OPENCV_DOCKER_WORKDIR }} -mindepth 1 -delete
 +    - name: Fetch opencv
-       run: git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} https://github.com/opencv/opencv_extra.git /opencv_extra
++      run: git clone --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE_DOCKER }}/opencv.git https://github.com/opencv/opencv.git ${{ env.OPENCV_DOCKER_WORKDIR }}
 +    - name: Merge opencv with ${{ env.SOURCE_BRANCH_NAME }} branch
 +      run: |
 +        cd ${{ env.OPENCV_DOCKER_WORKDIR }}
 +        git config --global --add safe.directory ${{ env.OPENCV_DOCKER_WORKDIR }}
 +        git config user.email "opencv.ci"
 +        git config user.name "opencv.ci"
 +        git pull -v "https://github.com/${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}"
 +    - name: Clone opencv_extra
-     runs-on: ubuntu-20.04
++      run: git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE_DOCKER }}/opencv_extra.git https://github.com/opencv/opencv_extra.git /opencv_extra
 +    - name: Merge opencv_extra with ${{ env.SOURCE_BRANCH_NAME }} branch
 +      run: |
 +        OPENCV_EXTRA_FORK=$(git ls-remote --heads "https://github.com/${{ env.PR_AUTHOR }}/opencv_extra" "${{ env.SOURCE_BRANCH_NAME }}") || true
 +        if [[ ! -z "$OPENCV_EXTRA_FORK" ]]; then
 +          echo "Merge opencv_extra with ${{ env.SOURCE_BRANCH_NAME }} branch"
 +          cd /opencv_extra
 +          git config user.email "opencv.ci"
 +          git config user.name "opencv.ci"
 +          git pull -v "https://github.com/${{ env.PR_AUTHOR }}/opencv_extra" "${{ env.SOURCE_BRANCH_NAME }}"
 +        else
 +          echo "No merge since ${{ env.PR_AUTHOR }}/opencv_extra does not have branch ${{ env.SOURCE_BRANCH_NAME }}"
 +        fi
 +    - name: Configure OpenCV
 +      run: |
 +        cd /opencv-build
 +        cmake -G Ninja ${{ env.EXTRA_CMAKE_OPTIONS }} ${{ env.OPENCV_DOCKER_WORKDIR }}
 +    - name: Build OpenCV
 +      run: |
 +        cd /opencv-build
 +        ninja
 +    - name: Accuracy:calib3d
 +      run: cd /opencv-build && xvfb-run -a bin/opencv_test_calib3d
 +    - name: Accuracy:core
 +      run: cd /opencv-build && xvfb-run -a bin/opencv_test_core
 +    - name: Accuracy:dnn
 +      run: cd /opencv-build && xvfb-run -a bin/opencv_test_dnn
 +    - name: Accuracy:features2d
 +      run: cd /opencv-build && xvfb-run -a bin/opencv_test_features2d
 +    - name: Accuracy:flann
 +      run: cd /opencv-build && xvfb-run -a bin/opencv_test_flann
 +    - name: Accuracy:gapi
 +      run: cd /opencv-build && xvfb-run -a bin/opencv_test_gapi
 +    - name: Accuracy:highgui
 +      run: cd /opencv-build && xvfb-run -a bin/opencv_test_highgui
 +    - name: Accuracy:imgcodecs
 +      run: cd /opencv-build && xvfb-run -a bin/opencv_test_imgcodecs
 +    - name: Accuracy:imgproc
 +      run: cd /opencv-build && xvfb-run -a bin/opencv_test_imgproc
 +    - name: Accuracy:ml
 +      run: cd /opencv-build && xvfb-run -a bin/opencv_test_ml
 +    - name: Accuracy:objdetect
 +      run: cd /opencv-build && xvfb-run -a bin/opencv_test_objdetect
 +    - name: Accuracy:photo
 +      run: cd /opencv-build && xvfb-run -a bin/opencv_test_photo
 +    - name: Accuracy:stitching
 +      run: cd /opencv-build && xvfb-run -a bin/opencv_test_stitching
 +    - name: Accuracy:video
 +      run: cd /opencv-build && xvfb-run -a bin/opencv_test_video
 +    - name: Accuracy:videoio
 +      run: cd /opencv-build && xvfb-run -a bin/opencv_test_videoio
 +    - name: Performance:calib3d
 +      run: cd /opencv-build && xvfb-run -a bin/opencv_perf_calib3d --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1
 +    - name: Performance:core
 +      run: cd /opencv-build && xvfb-run -a bin/opencv_perf_core --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1
 +    - name: Performance:dnn
 +      run: cd /opencv-build && xvfb-run -a bin/opencv_perf_dnn --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1
 +    - name: Performance:features2d
 +      run: cd /opencv-build && xvfb-run -a bin/opencv_perf_features2d --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1
 +    - name: Performance:gapi
 +      run: cd /opencv-build && xvfb-run -a bin/opencv_perf_gapi --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1
 +    - name: Performance:imgcodecs
 +      run: cd /opencv-build && xvfb-run -a bin/opencv_perf_imgcodecs --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1
 +    - name: Performance:imgproc
 +      run: cd /opencv-build && xvfb-run -a bin/opencv_perf_imgproc --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1
 +    - name: Performance:objdetect
 +      run: cd /opencv-build && xvfb-run -a bin/opencv_perf_objdetect --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1
 +    - name: Performance:photo
 +      run: cd /opencv-build && xvfb-run -a bin/opencv_perf_photo --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1
 +    - name: Performance:stitching
 +      run: cd /opencv-build && xvfb-run -a bin/opencv_perf_stitching --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1
 +    - name: Performance:video
 +      run: cd /opencv-build && xvfb-run -a bin/opencv_perf_video --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1
 +    - name: Performance:videoio
 +      run: cd /opencv-build && xvfb-run -a bin/opencv_perf_videoio --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1
 +    - name: Python3
 +      run: |
 +        cd ${{ env.OPENCV_DOCKER_WORKDIR }}/modules/python/test
 +        python3 ./test.py --repo ../../../ -v
 +    - name: Java
 +      run: cd /opencv-build && xvfb-run -a python3 ${{ env.OPENCV_DOCKER_WORKDIR }}/modules/ts/misc/run.py . -a -t java
 +    - name: Save Unit Test Results
 +      uses: actions/upload-artifact@v3
 +      if: always()
 +      with:
 +        name: junit-html
 +        path: /opencv-build/java_test/testResults/junit-noframes.html
 +    - name: Pylint
 +      run: cd /opencv-build && cmake --build . --config release --target check_pylint -- -j4
 +
 +  BuildContrib:
-       run: find . -mindepth 1 -delete
++    runs-on: opencv-cn-lin-x86-64
 +    defaults:
 +      run:
 +        shell: bash
 +    container:
 +      image: quay.io/asenyaev/opencv-ubuntu:20.04
++      volumes:
++        - /home/opencv-cn/git_cache:/home/ci/git_cache
++        - /home/opencv-cn/ci_cache/opencv:/home/ci/.ccache
++        - /home/opencv-cn/binaries_cache:/home/ci/binaries_cache
 +    steps:
 +    - name: PR info
 +      run: |
 +        echo "PR Author: ${{ env.PR_AUTHOR }}"
 +        echo "Source branch name: ${{ env.SOURCE_BRANCH_NAME }}"
 +        echo "Target branch name: ${{ env.TARGET_BRANCH_NAME }}"
 +    - name: Clean
-       uses: actions/checkout@v3
-       with:
-         repository: opencv/opencv
-         ref: ${{ env.TARGET_BRANCH_NAME }}
-         fetch-depth: 0
++      run: find ${{ env.OPENCV_DOCKER_WORKDIR }} -mindepth 1 -delete
 +    - name: Fetch opencv
++      run: git clone --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE_DOCKER }}/opencv.git https://github.com/opencv/opencv.git ${{ env.OPENCV_DOCKER_WORKDIR }}
 +    - name: Merge opencv with a test branch
 +      run: |
 +        cd ${{ env.OPENCV_DOCKER_WORKDIR }}
 +        git config --global --add safe.directory ${{ env.OPENCV_DOCKER_WORKDIR }}
 +        git config user.email "opencv.ci"
 +        git config user.name "opencv.ci"
 +        git pull -v "https://github.com/${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}"
 +    - name: Clone opencv_contrib
 +      run: git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} https://github.com/opencv/opencv_contrib.git /opencv_contrib
 +    - name: Merge opencv_contrib with ${{ env.SOURCE_BRANCH_NAME }} branch
 +      run: |
 +        OPENCV_CONTRIB_FORK=$(git ls-remote --heads "https://github.com/${{ env.PR_AUTHOR }}/opencv_contrib" "${{ env.SOURCE_BRANCH_NAME }}") || true
 +        if [[ ! -z "$OPENCV_CONTRIB_FORK" ]]; then
 +          echo "Merge opencv_contrib with ${{ env.SOURCE_BRANCH_NAME }} branch"
 +          cd /opencv_contrib
 +          git config user.email "opencv.ci"
 +          git config user.name "opencv.ci"
 +          git pull -v "https://github.com/${{ env.PR_AUTHOR }}/opencv_contrib" "${{ env.SOURCE_BRANCH_NAME }}"
 +        else
 +          echo "No merge since ${{ env.PR_AUTHOR }}/opencv_contrib does not have branch ${{ env.SOURCE_BRANCH_NAME }}"
 +        fi
 +    - name: Configure OpenCV Contrib
 +      run: |
 +        cd /opencv-contrib-build
 +        cmake -G Ninja ${{ env.EXTRA_CMAKE_OPTIONS }} -DOPENCV_EXTRA_MODULES_PATH=/opencv_contrib/modules ${{ env.OPENCV_DOCKER_WORKDIR }}
 +    - name: Build OpenCV Contrib
 +      run: |
 +        cd /opencv-contrib-build
 +        ninja
index 0e313f3,0000000..8ebd8c7
mode 100644,000000..100644
--- /dev/null
@@@ -1,164 -1,0 +1,176 @@@
-   EXTRA_CMAKE_OPTIONS: '-DCL_Z_OPTION=/Z7 -DOPENCV_DOWNLOAD_PATH=c:\Slave\workspace\binaries_cache -DBUILD_EXAMPLES=ON -DOPENCV_ENABLE_NONFREE=ON -DCMAKE_BUILD_TYPE=Release'
 +name: PR:4.x W10
 +
 +on:
 +  pull_request:
 +    branches:
 +      - 4.x
 +
 +env:
-   GIT_CACHE: c:\Slave\git_cache
++  EXTRA_CMAKE_OPTIONS: '-DCL_Z_OPTION=/Z7 -DOPENCV_DOWNLOAD_PATH=%BINARIES_CACHE% -DBUILD_EXAMPLES=ON -DOPENCV_ENABLE_NONFREE=ON -DCMAKE_BUILD_TYPE=Release'
 +  OPENCV_TEST_DATA_PATH: ${{ github.workspace }}\opencv_extra\testdata
 +  PR_AUTHOR: ${{ github.event.pull_request.user.login }}
 +  PR_AUTHOR_FORK: ${{ github.event.pull_request.head.repo.full_name }}
 +  SOURCE_BRANCH_NAME: ${{ github.head_ref }}
 +  TARGET_BRANCH_NAME: ${{ github.base_ref }}
 +  GTEST_FILTER_STRING: '-Samples.findFile:videoio/videocapture_acceleration.read/122:videoio/videocapture_acceleration.read/126'
-       run: cd ${{ github.workspace }} && git clone --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE }}\opencv.git https://github.com/opencv/opencv.git
 +
 +jobs:
 +  BuildAndTest:
 +    runs-on: opencv-cn-win
 +    defaults:
 +      run:
 +        shell: cmd
 +    steps:
 +    - name: PR info
 +      run: |
 +        echo "PR Author: ${{ env.PR_AUTHOR }}"
 +        echo "Source branch name: ${{ env.SOURCE_BRANCH_NAME }}"
 +        echo "Target branch name: ${{ env.TARGET_BRANCH_NAME }}"
 +    - name: Clean
 +      run: cd ${{ github.workspace }} && rm -rf *
 +    - name: Fetch opencv
-         git pull -v "https://github.com/${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}"
++      run: cd ${{ github.workspace }} && git clone --branch ${{ env.TARGET_BRANCH_NAME }} --reference %GIT_CACHE%\opencv.git git@github.com:opencv/opencv.git
 +    - name: Merge opencv with ${{ env.SOURCE_BRANCH_NAME }} branch
 +      run: |
 +        cd ${{ github.workspace }}\opencv
 +        git config user.email "opencv.ci"
 +        git config user.name "opencv.ci"
-       run: cd ${{ github.workspace }} && git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE }}\opencv_extra.git https://github.com/opencv/opencv_extra.git
++        git pull -v "git@github.com:${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}"
 +    - name: Fetch opencv_extra
-         RET=$(git ls-remote --heads "https://github.com/${{ env.PR_AUTHOR }}/opencv_extra" "${{ env.SOURCE_BRANCH_NAME }}") || true
-         if [[ ! -z "$RET" ]]; then
++      run: cd ${{ github.workspace }} && git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} --reference %GIT_CACHE%\opencv_extra.git git@github.com:opencv/opencv_extra.git
 +    - name: Merge opencv_extra with ${{ env.SOURCE_BRANCH_NAME }} branch
 +      shell: bash
 +      run: |
-           git pull -v "https://github.com/${{ env.PR_AUTHOR }}/opencv_extra" "${{ env.SOURCE_BRANCH_NAME }}"
++        OPENCV_EXTRA_FORK=$(git ls-remote --heads "git@github.com:/${{ env.PR_AUTHOR }}/opencv_extra" "${{ env.SOURCE_BRANCH_NAME }}") || true
++        if [[ ! -z "$OPENCV_EXTRA_FORK" ]]; then
 +          echo "Merge opencv_extra with ${{ env.SOURCE_BRANCH_NAME }} branch"
 +          cd opencv_extra
 +          git config user.email "opencv.ci"
 +          git config user.name "opencv.ci"
-       run: cd ${{ github.workspace }} && git clone --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE }}\opencv.git https://github.com/opencv/opencv.git
++          git pull -v "git@github.com:${{ env.PR_AUTHOR }}/opencv_extra" "${{ env.SOURCE_BRANCH_NAME }}"
 +        else
 +          echo "No merge since ${{ env.PR_AUTHOR }}/opencv_extra does not have branch ${{ env.SOURCE_BRANCH_NAME }}"
 +        fi
 +    - name: Configure OpenCV
 +      run: |
 +        mkdir ${{ github.workspace }}\opencv-build && cd ${{ github.workspace }}\opencv-build
 +        call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
 +        cmake -G Ninja ${{ env.EXTRA_CMAKE_OPTIONS }} ${{ github.workspace }}\opencv
 +    - name: Build OpenCV
 +      run: |
 +        cd ${{ github.workspace }}\opencv-build
 +        call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
 +        ninja
 +    - name: Accuracy:calib3d
 +      run: cd ${{ github.workspace }}\opencv-build && bin\opencv_test_calib3d.exe --skip_unstable --gtest_filter=${{ env.GTEST_FILTER_STRING }}
 +    - name: Accuracy:core
 +      run: cd ${{ github.workspace }}\opencv-build && bin\opencv_test_core.exe --skip_unstable --gtest_filter=${{ env.GTEST_FILTER_STRING }}
 +    - name: Accuracy:dnn
 +      run: cd ${{ github.workspace }}\opencv-build && bin\opencv_test_dnn.exe --skip_unstable --gtest_filter=${{ env.GTEST_FILTER_STRING }}
 +    - name: Accuracy:features2d
 +      run: cd ${{ github.workspace }}\opencv-build && bin\opencv_test_features2d.exe --skip_unstable --gtest_filter=${{ env.GTEST_FILTER_STRING }}
 +    - name: Accuracy:flann
 +      run: cd ${{ github.workspace }}\opencv-build && bin\opencv_test_flann.exe --skip_unstable --gtest_filter=${{ env.GTEST_FILTER_STRING }}
 +    - name: Accuracy:gapi
 +      run: cd ${{ github.workspace }}\opencv-build && bin\opencv_test_gapi.exe --skip_unstable --gtest_filter=${{ env.GTEST_FILTER_STRING }}
 +    - name: Accuracy:highgui
 +      run: cd ${{ github.workspace }}\opencv-build && bin\opencv_test_highgui.exe --skip_unstable --gtest_filter=${{ env.GTEST_FILTER_STRING }}
 +    - name: Accuracy:imgcodecs
 +      run: cd ${{ github.workspace }}\opencv-build && bin\opencv_test_imgcodecs.exe --skip_unstable --gtest_filter=${{ env.GTEST_FILTER_STRING }}
 +    - name: Accuracy:imgproc
 +      run: cd ${{ github.workspace }}\opencv-build && bin\opencv_test_imgproc.exe --skip_unstable --gtest_filter=${{ env.GTEST_FILTER_STRING }}
 +    - name: Accuracy:ml
 +      run: cd ${{ github.workspace }}\opencv-build && bin\opencv_test_ml.exe --skip_unstable --gtest_filter=${{ env.GTEST_FILTER_STRING }}
 +    - name: Accuracy:objdetect
 +      run: cd ${{ github.workspace }}\opencv-build && bin\opencv_test_objdetect.exe --skip_unstable --gtest_filter=${{ env.GTEST_FILTER_STRING }}
 +    - name: Accuracy:photo
 +      run: cd ${{ github.workspace }}\opencv-build && bin\opencv_test_photo.exe --skip_unstable --gtest_filter=${{ env.GTEST_FILTER_STRING }}
 +    - name: Accuracy:stitching
 +      run: cd ${{ github.workspace }}\opencv-build && bin\opencv_test_stitching.exe --skip_unstable --gtest_filter=${{ env.GTEST_FILTER_STRING }}
 +    - name: Accuracy:video
 +      run: cd ${{ github.workspace }}\opencv-build && bin\opencv_test_video.exe --skip_unstable --gtest_filter=${{ env.GTEST_FILTER_STRING }}
 +    - name: Accuracy:videoio
 +      run: cd ${{ github.workspace }}\opencv-build && bin\opencv_test_videoio.exe --skip_unstable --gtest_filter=${{ env.GTEST_FILTER_STRING }}
 +    - name: Performance:calib3d
 +      run: cd ${{ github.workspace }}\opencv-build && bin\opencv_perf_calib3d.exe --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1 --gtest_filter=${{ env.GTEST_FILTER_STRING }}
 +    - name: Performance:core
 +      run: cd ${{ github.workspace }}\opencv-build && bin\opencv_perf_core.exe --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1 --gtest_filter=${{ env.GTEST_FILTER_STRING }}
 +    - name: Performance:dnn
 +      run: cd ${{ github.workspace }}\opencv-build && bin\opencv_perf_dnn.exe --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1 --gtest_filter=${{ env.GTEST_FILTER_STRING }}
 +    - name: Performance:features2d
 +      run: cd ${{ github.workspace }}\opencv-build && bin\opencv_perf_features2d.exe --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1 --gtest_filter=${{ env.GTEST_FILTER_STRING }}
 +    - name: Performance:gapi
 +      run: cd ${{ github.workspace }}\opencv-build && bin\opencv_perf_gapi.exe --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1 --gtest_filter=${{ env.GTEST_FILTER_STRING }}
 +    - name: Performance:imgcodecs
 +      run: cd ${{ github.workspace }}\opencv-build && bin\opencv_perf_imgcodecs.exe --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1 --gtest_filter=${{ env.GTEST_FILTER_STRING }}
 +    - name: Performance:imgproc
 +      run: cd ${{ github.workspace }}\opencv-build && bin\opencv_perf_imgproc.exe --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1 --gtest_filter=${{ env.GTEST_FILTER_STRING }}
 +    - name: Performance:objdetect
 +      run: cd ${{ github.workspace }}\opencv-build && bin\opencv_perf_objdetect.exe --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1 --gtest_filter=${{ env.GTEST_FILTER_STRING }}
 +    - name: Performance:photo
 +      run: cd ${{ github.workspace }}\opencv-build && bin\opencv_perf_photo.exe --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1 --gtest_filter=${{ env.GTEST_FILTER_STRING }}
 +    - name: Performance:stitching
 +      run: cd ${{ github.workspace }}\opencv-build && bin\opencv_perf_stitching.exe --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1 --gtest_filter=${{ env.GTEST_FILTER_STRING }}
 +    - name: Performance:video
 +      run: cd ${{ github.workspace }}\opencv-build && bin\opencv_perf_video.exe --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1 --gtest_filter=${{ env.GTEST_FILTER_STRING }}
 +    - name: Performance:videoio
 +      run: cd ${{ github.workspace }}\opencv-build && bin\opencv_perf_videoio.exe --perf_impl=plain --perf_min_samples=1 --perf_force_samples=1 --perf_verify_sanity --skip_unstable=1 --gtest_filter=${{ env.GTEST_FILTER_STRING }}
 +    - name: Python3
 +      run: |
 +        cd ${{ github.workspace }}\opencv\modules\python\test
 +        set PYTHONPATH=%PYTHONPATH%;${{ github.workspace }}\opencv-build\python_loader;${{ github.workspace }}\opencv-build\lib\python3
 +        set PATH=%PATH%;${{ github.workspace }}\opencv-build\bin;${{ github.workspace }}\opencv-build\lib\python3
 +        python test.py --repo ..\..\..\ -v
 +    - name: Java
 +      run: |
 +        cd ${{ github.workspace }}\opencv-build
 +        set PATH=%PATH%;${{ github.workspace }}\opencv-build\bin
 +        ${{ github.workspace }}\opencv\modules\ts\misc\run.py . -a -t java
 +
 +
 +  BuildContrib:
 +    runs-on: opencv-cn-win
 +    defaults:
 +      run:
 +        shell: cmd
 +    steps:
 +    - name: PR info
 +      run: |
 +        echo "PR Author: ${{ env.PR_AUTHOR }}"
 +        echo "Source branch name: ${{ env.SOURCE_BRANCH_NAME }}"
 +        echo "Target branch name: ${{ env.TARGET_BRANCH_NAME }}"
 +    - name: Clean
 +      run: cd ${{ github.workspace }} && rm -rf *
 +    - name: Fetch opencv
-         git pull -v "https://github.com/${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}"
++      run: cd ${{ github.workspace }} && git clone --branch ${{ env.TARGET_BRANCH_NAME }} --reference %GIT_CACHE%\opencv.git git@github.com:opencv/opencv.git
 +    - name: Merge opencv with ${{ env.SOURCE_BRANCH_NAME }} branch
 +      run: |
 +        cd ${{ github.workspace }}\opencv
 +        git config user.email "opencv.ci"
 +        git config user.name "opencv.ci"
-       run: cd ${{ github.workspace }} && git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} --reference ${{ env.GIT_CACHE }}\opencv_contrib.git --depth 1 https://github.com/opencv/opencv_contrib.git
++        git pull -v "git@github.com:${{ env.PR_AUTHOR_FORK }}" "${{ env.SOURCE_BRANCH_NAME }}"
 +    - name: Fetch opencv_contrib
++      run: cd ${{ github.workspace }} && git clone --single-branch --branch ${{ env.TARGET_BRANCH_NAME }} --reference %GIT_CACHE%\opencv_contrib.git --depth 1 git@github.com:opencv/opencv_contrib.git
++    - name: Merge opencv_contrib with ${{ env.SOURCE_BRANCH_NAME }} branch
++      shell: bash
++      run: |
++        OPENCV_CONTRIB_FORK=$(git ls-remote --heads "git@github.com:${{ env.PR_AUTHOR }}/opencv_contrib" "${{ env.SOURCE_BRANCH_NAME }}") || true
++        if [[ ! -z "$OPENCV_CONTRIB_FORK" ]]; then
++          echo "Merge opencv_contrib with ${{ env.SOURCE_BRANCH_NAME }} branch"
++          cd /opencv_contrib
++          git config user.email "opencv.ci"
++          git config user.name "opencv.ci"
++          git pull -v "git@github.com:${{ env.PR_AUTHOR }}/opencv_contrib" "${{ env.SOURCE_BRANCH_NAME }}"
++        else
++          echo "No merge since ${{ env.PR_AUTHOR }}/opencv_contrib does not have branch ${{ env.SOURCE_BRANCH_NAME }}"
++        fi
 +    - name: Configure OpenCV Contrib
 +      run: |
 +        mkdir ${{ github.workspace }}\opencv-contrib-build && cd ${{ github.workspace }}\opencv-contrib-build
 +        call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
 +        cmake -G Ninja ${{ env.EXTRA_CMAKE_OPTIONS }} -DOPENCV_EXTRA_MODULES_PATH=${{ github.workspace }}\opencv_contrib\modules ${{ github.workspace }}\opencv
 +    - name: Build OpenCV Contrib
 +      run: |
 +        cd ${{ github.workspace }}\opencv-contrib-build
 +        call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
 +        ninja
@@@ -2270,13 -2290,7 +2270,13 @@@ public
      const_iterator begin() const;
      const_iterator end() const;
  
-     //! template methods for for operation over all matrix elements.
 +    //reverse iterators
 +    std::reverse_iterator<iterator> rbegin();
 +    std::reverse_iterator<iterator> rend();
 +    std::reverse_iterator<const_iterator> rbegin() const;
 +    std::reverse_iterator<const_iterator> rend() const;
 +
+     //! template methods for operation over all matrix elements.
      // the operations take care of skipping gaps in the end of rows (if any)
      template<typename Functor> void forEach(const Functor& operation);
      template<typename Functor> void forEach(const Functor& operation) const;
Simple merge
Simple merge
@@@ -1119,9 -899,9 +1119,9 @@@ bool TiffEncoder::writeLibTiff( const s
          CV_TIFF_CHECK_CALL(TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG));
          CV_TIFF_CHECK_CALL(TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsPerStrip));
  
 -        CV_TIFF_CHECK_CALL(TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, depth >= CV_32F ? SAMPLEFORMAT_IEEEFP : SAMPLEFORMAT_UINT));
 +        CV_TIFF_CHECK_CALL(TIFFSetField(tif, TIFFTAG_SAMPLEFORMAT, sample_format));
  
-         if (page_compression != COMPRESSION_NONE)
+         if (page_compression == COMPRESSION_LZW || page_compression == COMPRESSION_ADOBE_DEFLATE || page_compression == COMPRESSION_DEFLATE)
          {
              CV_TIFF_CHECK_CALL(TIFFSetField(tif, TIFFTAG_PREDICTOR, predictor));
          }
@@@ -349,17 -219,49 +349,60 @@@ TEST(Imgcodecs_Tiff, readWrite_32FC3_RA
      EXPECT_EQ(0, remove(filenameOutput.c_str()));
  }
  
 +TEST(Imgcodecs_Tiff, read_palette_color_image)
 +{
 +    const string root = cvtest::TS::ptr()->get_data_path();
 +    const string filenameInput = root + "readwrite/test_palette_color_image.tif";
 +
 +    const Mat img = cv::imread(filenameInput, IMREAD_UNCHANGED);
 +    ASSERT_FALSE(img.empty());
 +    ASSERT_EQ(CV_8UC3, img.type());
 +}
 +
+ TEST(Imgcodecs_Tiff, readWrite_predictor)
+ {
+     /* see issue #21871
+      */
+     const uchar sample_data[160] = {
+         0xff, 0xff, 0xff, 0xff, 0x88, 0x88, 0xff, 0xff, 0x88, 0x88, 0xff, 0xff, 0xff, 0xff, 0xff, 0x88,
+         0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00,
+         0xff, 0x00, 0x00, 0x44, 0xff, 0xff, 0x88, 0xff, 0x33, 0x00, 0x66, 0xff, 0xff, 0x88, 0x00, 0x44,
+         0x88, 0x00, 0x44, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x44, 0xff, 0xff, 0x11, 0x00, 0xff,
+         0x11, 0x00, 0x88, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff,
+         0x11, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x33, 0x00, 0x88, 0xff, 0x00, 0x66, 0xff,
+         0x11, 0x00, 0x66, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x44, 0x33, 0x00, 0xff, 0xff,
+         0x88, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff,
+         0xff, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x33, 0x00, 0x00, 0x66, 0xff, 0xff,
+         0xff, 0xff, 0x88, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff
+     };
+     cv::Mat mat(10, 16, CV_8UC1, (void*)sample_data);
+     int methods[] = {
+         COMPRESSION_NONE,     COMPRESSION_LZW,
+         COMPRESSION_PACKBITS, COMPRESSION_DEFLATE,  COMPRESSION_ADOBE_DEFLATE
+     };
+     for (size_t i = 0; i < sizeof(methods) / sizeof(int); i++)
+     {
+         string out = cv::tempfile(".tif");
+         std::vector<int> params;
+         params.push_back(TIFFTAG_COMPRESSION);
+         params.push_back(methods[i]);
+         params.push_back(TIFFTAG_PREDICTOR);
+         params.push_back(PREDICTOR_HORIZONTAL);
+         EXPECT_NO_THROW(cv::imwrite(out, mat, params));
+         const Mat img = cv::imread(out, IMREAD_UNCHANGED);
+         ASSERT_FALSE(img.empty());
+         ASSERT_EQ(0, cv::norm(mat, img, cv::NORM_INF));
+         EXPECT_EQ(0, remove(out.c_str()));
+     }
+ }
 +
  //==================================================================================================
  
  typedef testing::TestWithParam<int> Imgcodecs_Tiff_Modes;
Simple merge
Simple merge