features2d: fix BRISK on sub-matrix images - #30831
`BRISK_Impl::smoothedIntensity()` indexes the image with its width as the row stride in the direct-pixel paths. For an image that is a region of a larger one (`img(roi)`) the row step differs from the width, so those samples were read from the wrong rows. `detect()`/`compute()` on such an image returned wrong keypoint angles (the orientation uses these samples) and wrong descriptor bytes (maximum byte difference 255), and both depended on the pixels around the region. The function now uses `image.step`; the integral image is a fresh continuous matrix and is unchanged. Proposed to 4.x because BRISK is no longer in the main repository on 5.x (it moved to opencv_contrib).
`Features2d_BRISK.descriptors_of_sub_matrix` computes keypoints, angles and descriptors on a continuous image and on a region of a larger image with unrelated pixels around it and requires identical output. On 4.x it fails (1 descriptor mismatch, 68 angle mismatches) and passes with the change. Continuous images are unchanged. Checks run on macOS arm64 (Release); the BRISK tests that read opencv_extra images were not run. The open PR #28194 also edits `brisk.cpp` (keypoint orientation in `compute()`) at different lines.
Thank you for taking a look.
### 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
* Get/Set functions for BRISK parameters, issue #11527.
Allows setting threshold and octaves parameters after creating a brisk object. These parameters do not affect the initial pattern initialization and can be changed later without re-initialization.
* Fix doc parameter name.
* Brisk get/set functions tests. Check for correct value and make tests independent of default parameter values.
* Add dummy implementations for BRISK get/set functions not to break API in case someone has overloaded the Feature2d::BRISK interface. This makes BRISK different from the other detectors/descriptors on the other hand, where get/set functions are pure virtual in the interface.
- removed tr1 usage (dropped in C++17)
- moved includes of vector/map/iostream/limits into ts.hpp
- require opencv_test + anonymous namespace (added compile check)
- fixed norm() usage (must be from cvtest::norm for checks) and other conflict functions
- added missing license headers