Merged
Conversation
invSqrt SIMD_SCALABLE implementation & HAL tests refactoring opencv#26887 Enable CV_SIMD_SCALABLE for invSqrt. * Banana Pi BF3 (SpacemiT K1) RISC-V * Compiler: Syntacore Clang 18.1.4 (build 2024.12) ``` Geometric mean (ms) Name of Test baseline simd simd scalable scalable vs baseline (x-factor) InvSqrtf::InvSqrtfFixture::(127x61, 32FC1) 0.163 0.051 3.23 InvSqrtf::InvSqrtfFixture::(127x61, 64FC1) 0.241 0.103 2.35 InvSqrtf::InvSqrtfFixture::(640x480, 32FC1) 6.460 1.893 3.41 InvSqrtf::InvSqrtfFixture::(640x480, 64FC1) 9.687 3.999 2.42 InvSqrtf::InvSqrtfFixture::(1280x720, 32FC1) 19.292 5.701 3.38 InvSqrtf::InvSqrtfFixture::(1280x720, 64FC1) 29.452 11.963 2.46 InvSqrtf::InvSqrtfFixture::(1920x1080, 32FC1) 43.326 12.805 3.38 InvSqrtf::InvSqrtfFixture::(1920x1080, 64FC1) 65.566 26.881 2.44 ```
This should quiet some fuzzer bugs
Bump openjp2 to v2.5.3
Further optimization of cv::merge RVV HAL for 8U and 16S opencv#26923 ### Pull Request Readiness Checklist * Banana Pi BF3 (SpacemiT K1) RISC-V * Compiler: Syntacore Clang 18.1.4 (build 2024.12) ``` Geometric mean (ms) Name of Test baseline pr pr merge vs baseline merge (x-factor) merge::Size_SrcDepth_DstChannels::(127x61, 8UC1, 2) 0.013 0.003 3.76 merge::Size_SrcDepth_DstChannels::(127x61, 8UC1, 3) 0.020 0.006 3.46 merge::Size_SrcDepth_DstChannels::(127x61, 8UC1, 4) 0.026 0.010 2.61 merge::Size_SrcDepth_DstChannels::(127x61, 8UC1, 5) 0.043 0.028 1.56 merge::Size_SrcDepth_DstChannels::(127x61, 8UC1, 6) 0.054 0.035 1.53 merge::Size_SrcDepth_DstChannels::(127x61, 8UC1, 7) 0.065 0.050 1.30 merge::Size_SrcDepth_DstChannels::(127x61, 8UC1, 8) 0.070 0.036 1.95 merge::Size_SrcDepth_DstChannels::(127x61, 16SC1, 2) 0.015 0.008 1.82 merge::Size_SrcDepth_DstChannels::(127x61, 16SC1, 3) 0.022 0.015 1.48 merge::Size_SrcDepth_DstChannels::(127x61, 16SC1, 4) 0.029 0.018 1.63 merge::Size_SrcDepth_DstChannels::(127x61, 16SC1, 5) 0.067 0.044 1.54 merge::Size_SrcDepth_DstChannels::(127x61, 16SC1, 6) 0.088 0.056 1.58 merge::Size_SrcDepth_DstChannels::(127x61, 16SC1, 7) 0.104 0.076 1.38 merge::Size_SrcDepth_DstChannels::(127x61, 16SC1, 8) 0.116 0.065 1.79 merge::Size_SrcDepth_DstChannels::(640x480, 8UC1, 2) 0.421 0.176 2.39 merge::Size_SrcDepth_DstChannels::(640x480, 8UC1, 3) 0.792 0.284 2.79 merge::Size_SrcDepth_DstChannels::(640x480, 8UC1, 4) 1.090 0.370 2.95 merge::Size_SrcDepth_DstChannels::(640x480, 8UC1, 5) 1.835 1.399 1.31 merge::Size_SrcDepth_DstChannels::(640x480, 8UC1, 6) 2.389 1.776 1.35 merge::Size_SrcDepth_DstChannels::(640x480, 8UC1, 7) 3.000 2.471 1.21 merge::Size_SrcDepth_DstChannels::(640x480, 8UC1, 8) 3.178 2.104 1.51 merge::Size_SrcDepth_DstChannels::(640x480, 16SC1, 2) 0.490 0.377 1.30 merge::Size_SrcDepth_DstChannels::(640x480, 16SC1, 3) 1.348 0.602 2.24 merge::Size_SrcDepth_DstChannels::(640x480, 16SC1, 4) 1.827 0.813 2.25 merge::Size_SrcDepth_DstChannels::(640x480, 16SC1, 5) 3.283 2.692 1.22 merge::Size_SrcDepth_DstChannels::(640x480, 16SC1, 6) 4.922 3.334 1.48 merge::Size_SrcDepth_DstChannels::(640x480, 16SC1, 7) 5.725 4.399 1.30 merge::Size_SrcDepth_DstChannels::(640x480, 16SC1, 8) 6.278 4.748 1.32 merge::Size_SrcDepth_DstChannels::(1280x720, 8UC1, 2) 1.267 0.603 2.10 merge::Size_SrcDepth_DstChannels::(1280x720, 8UC1, 3) 2.394 0.934 2.56 merge::Size_SrcDepth_DstChannels::(1280x720, 8UC1, 4) 3.236 1.434 2.26 merge::Size_SrcDepth_DstChannels::(1280x720, 8UC1, 5) 5.398 4.345 1.24 merge::Size_SrcDepth_DstChannels::(1280x720, 8UC1, 6) 7.127 5.459 1.31 merge::Size_SrcDepth_DstChannels::(1280x720, 8UC1, 7) 8.590 7.298 1.18 merge::Size_SrcDepth_DstChannels::(1280x720, 8UC1, 8) 9.360 6.152 1.52 merge::Size_SrcDepth_DstChannels::(1280x720, 16SC1, 2) 1.482 1.242 1.19 merge::Size_SrcDepth_DstChannels::(1280x720, 16SC1, 3) 4.008 1.817 2.21 merge::Size_SrcDepth_DstChannels::(1280x720, 16SC1, 4) 6.079 2.468 2.46 merge::Size_SrcDepth_DstChannels::(1280x720, 16SC1, 5) 11.300 8.644 1.31 merge::Size_SrcDepth_DstChannels::(1280x720, 16SC1, 6) 15.125 12.126 1.25 merge::Size_SrcDepth_DstChannels::(1280x720, 16SC1, 7) 17.555 14.804 1.19 merge::Size_SrcDepth_DstChannels::(1280x720, 16SC1, 8) 18.890 14.163 1.33 merge::Size_SrcDepth_DstChannels::(1920x1080, 8UC1, 2) 2.910 1.326 2.19 merge::Size_SrcDepth_DstChannels::(1920x1080, 8UC1, 3) 5.351 1.997 2.68 merge::Size_SrcDepth_DstChannels::(1920x1080, 8UC1, 4) 7.290 2.629 2.77 merge::Size_SrcDepth_DstChannels::(1920x1080, 8UC1, 5) 12.426 9.611 1.29 merge::Size_SrcDepth_DstChannels::(1920x1080, 8UC1, 6) 16.453 12.162 1.35 merge::Size_SrcDepth_DstChannels::(1920x1080, 8UC1, 7) 19.420 16.190 1.20 merge::Size_SrcDepth_DstChannels::(1920x1080, 8UC1, 8) 20.588 13.699 1.50 merge::Size_SrcDepth_DstChannels::(1920x1080, 16SC1, 2) 3.400 2.640 1.29 merge::Size_SrcDepth_DstChannels::(1920x1080, 16SC1, 3) 8.986 3.952 2.27 merge::Size_SrcDepth_DstChannels::(1920x1080, 16SC1, 4) 11.972 5.273 2.27 merge::Size_SrcDepth_DstChannels::(1920x1080, 16SC1, 5) 20.544 17.996 1.14 merge::Size_SrcDepth_DstChannels::(1920x1080, 16SC1, 6) 28.677 22.086 1.30 merge::Size_SrcDepth_DstChannels::(1920x1080, 16SC1, 7) 32.958 27.713 1.19 merge::Size_SrcDepth_DstChannels::(1920x1080, 16SC1, 8) 36.499 27.439 1.33 ``` See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
core: vectorize cv::normalize / cv::norm opencv#26885 Checklist: | | normInf | normL1 | normL2 | | ---- | ------- | ------ | ------ | | bool | - | - | - | | 8u | √ | √ | √ | | 8s | √ | √ | √ | | 16u | √ | √ | √ | | 16s | √ | √ | √ | | 16f | - | - | - | | 16bf | - | - | - | | 32u | - | - | - | | 32s | √ | √ | √ | | 32f | √ | √ | √ | | 64u | - | - | - | | 64s | - | - | - | | 64f | √ | √ | √ | *: Vectorization of data type bool, 16f, 16bf, 32u, 64u and 64s needs to be done on 5.x. ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
replace deprecated np.fromstring() by np.frombuffer()
Enable SIMD_SCALABLE for exp and sqrt opencv#26886 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake ``` CPU - Banana Pi k1, compiler - clang 18.1.4 ``` ``` Geometric mean (ms) Name of Test baseline hal ui hal ui vs vs baseline baseline (x-factor) (x-factor) Exp::ExpFixture::(127x61, 32FC1) 0.358 -- 0.033 -- 10.70 Exp::ExpFixture::(640x480, 32FC1) 14.304 -- 1.167 -- 12.26 Exp::ExpFixture::(1280x720, 32FC1) 42.785 -- 3.538 -- 12.09 Exp::ExpFixture::(1920x1080, 32FC1) 96.206 -- 7.927 -- 12.14 Exp::ExpFixture::(127x61, 64FC1) 0.433 0.050 0.098 8.59 4.40 Exp::ExpFixture::(640x480, 64FC1) 17.315 1.935 3.813 8.95 4.54 Exp::ExpFixture::(1280x720, 64FC1) 52.181 5.877 11.519 8.88 4.53 Exp::ExpFixture::(1920x1080, 64FC1) 117.082 13.157 25.854 8.90 4.53 ``` Additionally, this PR brings Sqrt optimization with UI: ``` Geometric mean (ms) Name of Test baseline ui ui vs baseline (x-factor) Sqrt::SqrtFixture::(127x61, 5, false) 0.111 0.027 4.11 Sqrt::SqrtFixture::(127x61, 6, false) 0.149 0.053 2.82 Sqrt::SqrtFixture::(640x480, 5, false) 4.374 0.967 4.52 Sqrt::SqrtFixture::(640x480, 6, false) 5.885 2.046 2.88 Sqrt::SqrtFixture::(1280x720, 5, false) 12.960 2.915 4.45 Sqrt::SqrtFixture::(1280x720, 6, false) 17.648 6.107 2.89 Sqrt::SqrtFixture::(1920x1080, 5, false) 29.178 6.524 4.47 Sqrt::SqrtFixture::(1920x1080, 6, false) 39.709 13.670 2.90 ``` Reference Muller, J.-M. Elementary Functions: Algorithms and Implementation. 2nd ed. Boston: Birkhäuser, 2006. https://www.springer.com/gp/book/9780817643720
Impl RISC-V HAL for cv::flip | Add perf test for flip opencv#26943 Implement through the existing `cv_hal_flip` interfaces. Add perf test for `cv::flip`. The reason why select these args for testing: - **size**: copied from perf_lut - **type**: - U8C1: basic situation - U8C3: unaligned element size - U8C4: large element size Tested on - MUSE-PI (vlen=256) - Compiler: gcc 14.2 (riscv-collab/riscv-gnu-toolchain Nightly: December 16, 2024) ```sh $ opencv_test_core --gtest_filter="Core_Flip/ElemWiseTest.*" $ opencv_perf_core --gtest_filter="Size_MatType_FlipCode*" --perf_min_samples=300 --perf_force_samples=300 ``` ``` Geometric mean (ms) Name of Test scalar ui rvv ui rvv vs vs scalar scalar (x-factor) (x-factor) flip::Size_MatType_FlipCode::(320x240, 8UC1, FLIP_X) 0.026 0.033 0.031 0.81 0.84 flip::Size_MatType_FlipCode::(320x240, 8UC1, FLIP_XY) 0.206 0.212 0.091 0.97 2.26 flip::Size_MatType_FlipCode::(320x240, 8UC1, FLIP_Y) 0.185 0.189 0.082 0.98 2.25 flip::Size_MatType_FlipCode::(320x240, 8UC3, FLIP_X) 0.070 0.084 0.084 0.83 0.83 flip::Size_MatType_FlipCode::(320x240, 8UC3, FLIP_XY) 0.616 0.612 0.235 1.01 2.62 flip::Size_MatType_FlipCode::(320x240, 8UC3, FLIP_Y) 0.587 0.603 0.204 0.97 2.88 flip::Size_MatType_FlipCode::(320x240, 8UC4, FLIP_X) 0.263 0.110 0.109 2.40 2.41 flip::Size_MatType_FlipCode::(320x240, 8UC4, FLIP_XY) 0.930 0.831 0.316 1.12 2.95 flip::Size_MatType_FlipCode::(320x240, 8UC4, FLIP_Y) 1.175 1.129 0.313 1.04 3.75 flip::Size_MatType_FlipCode::(640x480, 8UC1, FLIP_X) 0.303 0.118 0.111 2.57 2.73 flip::Size_MatType_FlipCode::(640x480, 8UC1, FLIP_XY) 0.949 0.836 0.405 1.14 2.34 flip::Size_MatType_FlipCode::(640x480, 8UC1, FLIP_Y) 0.784 0.783 0.409 1.00 1.92 flip::Size_MatType_FlipCode::(640x480, 8UC3, FLIP_X) 1.084 0.360 0.355 3.01 3.06 flip::Size_MatType_FlipCode::(640x480, 8UC3, FLIP_XY) 3.768 3.348 1.364 1.13 2.76 flip::Size_MatType_FlipCode::(640x480, 8UC3, FLIP_Y) 4.361 4.473 1.296 0.97 3.37 flip::Size_MatType_FlipCode::(640x480, 8UC4, FLIP_X) 1.252 0.469 0.451 2.67 2.78 flip::Size_MatType_FlipCode::(640x480, 8UC4, FLIP_XY) 5.732 5.220 1.303 1.10 4.40 flip::Size_MatType_FlipCode::(640x480, 8UC4, FLIP_Y) 5.041 5.105 1.203 0.99 4.19 flip::Size_MatType_FlipCode::(1920x1080, 8UC1, FLIP_X) 2.382 0.903 0.903 2.64 2.64 flip::Size_MatType_FlipCode::(1920x1080, 8UC1, FLIP_XY) 8.606 7.508 2.581 1.15 3.33 flip::Size_MatType_FlipCode::(1920x1080, 8UC1, FLIP_Y) 8.421 8.535 2.219 0.99 3.80 flip::Size_MatType_FlipCode::(1920x1080, 8UC3, FLIP_X) 6.312 2.416 2.429 2.61 2.60 flip::Size_MatType_FlipCode::(1920x1080, 8UC3, FLIP_XY) 29.174 26.055 12.761 1.12 2.29 flip::Size_MatType_FlipCode::(1920x1080, 8UC3, FLIP_Y) 25.373 25.500 13.382 1.00 1.90 flip::Size_MatType_FlipCode::(1920x1080, 8UC4, FLIP_X) 7.620 3.204 3.115 2.38 2.45 flip::Size_MatType_FlipCode::(1920x1080, 8UC4, FLIP_XY) 32.876 29.310 12.976 1.12 2.53 flip::Size_MatType_FlipCode::(1920x1080, 8UC4, FLIP_Y) 28.831 29.094 14.919 0.99 1.93 ``` The optimization for vlen <= 256 and > 256 are different, but I have no real hardware with vlen > 256. So accuracy tests for that like 512 and 1024 are conducted on QEMU built from the `riscv-collab/riscv-gnu-toolchain`. ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [ ] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
Co-authored-by: Liutong HAN <liutong2020@iscas.ac.cn>
Add a test related IMWRITE_PNG_COMPRESSION parameter opencv#26973 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
videoio: print test params instead of indexes opencv#26948 _videoio_ test names changed - use string instead of index. E.g. `videoio_read.threads/0` is now `videoio_read.threads/h264_0_RAW`. It allows to filter tests independently of the platform. **Notes:** - not all tests has been updated - only simpler ones and those which have varying parameters depending on platform
Imgcodecs: gif: support Disposal Method opencv#26930 Close opencv#26924 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
…ed creation of 'Ort::Env' before it
Backported some C API cleanup from 5.x to 4.x to reduce conflicts in 4.x->5.x merge
G-API/ORT: Workaround exception during OV EP append
Impl RISC-V HAL for norm_hamming
fix: qnx7.0 build
Some minor fixes opencv#26992 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
…Transform-for-singular-case Fix getPerspectiveTransform for singular case opencv#26926 ### Pull Request Readiness Checklist Fix opencv#26916 See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
Fix Logical defect in FilterSpecklesImpl opencv#26996 Fixes : opencv#24963 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
Documentation to enable FastCV based OpenCV HAL and Extensions opencv#26910 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [ ] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
Optimize undistort points opencv#26988 Skips unnecessary rotation with identity matrix if no R or P mats are given. --------- Co-authored-by: Daniel <daniel@mail.de>
Contributor
Wrong |
ae2bdad to
68db677
Compare
68db677 to
db40139
Compare
Contributor
Author
|
@fengyuentau I ported your changes for cv::norm to 5.x. Could you take a look on the solution. I'm not sure that it's accurate enough. |
fengyuentau
approved these changes
Mar 6, 2025
mshabunin
approved these changes
Mar 6, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Contrib: opencv/opencv_contrib#3897
Extra: opencv/opencv_extra#1240
#26885 from fengyuentau:4x/core/normalize_simd
#26886 from sk1er52:feature/exp64f
#26887 from kyler1cartesis:4.x
#26910 from CodeLinaro:FastcvHAL_Documentation
#26918 from GenshinImpactStarts:norm_hamming
#26923 from dkurt:merge_rvv_opt
#26926 from MaximSmolskiy:fix-getPerspectiveTransform-for-singular-case
#26930 from Kumataro:fix26924
#26942 from vrabaud:png_leak
#26943 from GenshinImpactStarts:flip_hal_rvv
#26948 from mshabunin:fix-videoio-test-params
#26949 from shyama7004:Fix
#26973 from sturkmen72:png_test
#26982 from asmorkalov:as/backport_c_api
#26983 from AsyaPronina:wa_for_ort_env
#26985 from xi-guo-0:fix-qnx7.0-build
#26988 from DanBmh:opt_undistort
#26992 from Anshuprem:4.x
#26996 from shyama7004:outofBound
Previous "Merge 4.x": #26939