1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 07:13:02 +04:00

Merge pull request #26366 from shyama7004:fix-orb.cpp

Fix ORB inconsistency for masks with values 255 and 1. #26366

### Pull Request Readiness Checklist

The PR fixes : [25974](https://github.com/opencv/opencv/issues/25974)

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
This commit is contained in:
Skreg
2025-12-09 17:01:53 +05:30
committed by GitHub
parent 9a9ae12475
commit 2bf4f5c151
2 changed files with 33 additions and 2 deletions
+6 -2
View File
@@ -1036,7 +1036,11 @@ void ORB_Impl::detectAndCompute( InputArray _image, InputArray _mask,
bool useOCL = false;
#endif
Mat image = _image.getMat(), mask = _mask.getMat();
Mat image = _image.getMat(), mask;
if (!_mask.empty())
{
threshold(_mask, mask, 0, 255, THRESH_BINARY);
}
if( image.type() != CV_8UC1 )
cvtColor(_image, image, COLOR_BGR2GRAY);
@@ -1134,7 +1138,7 @@ void ORB_Impl::detectAndCompute( InputArray _image, InputArray _mask,
}
copyMakeBorder(currImg, extImg, border, border, border, border,
BORDER_REFLECT_101+BORDER_ISOLATED);
BORDER_REFLECT_101 + BORDER_ISOLATED);
if (!mask.empty())
copyMakeBorder(currMask, extMask, border, border, border, border,
BORDER_CONSTANT+BORDER_ISOLATED);