opencv/modules/objdetect/src
Maxim Smolskiy 46dbc57a86
Merge pull request #26968 from MaximSmolskiy:fix-Aruco-marker-incorrect-detection-near-image-edge
Fix Aruco marker incorrect detection near image edge #26968

### Pull Request Readiness Checklist

Fix #26922 

As I understood the algorithm, at the first stage we search for the contours of the marker several times (adaptive threshold with different windows sizes). Therefore, for the same marker, we get several contours (inner and outer with different sizes due to the different windows sizes). In the second stage, we group the contours for the same marker into one group, from which we take the largest contour as the best candidate (which should best match the border of the marker).

The problem is that using the `minDistanceToBorder` parameter, we discard contours at the first stage. Thus, we discard the best candidates most appropriate to the marker border, and inner contours may remain, representing a significantly smaller marker border (which we observe in the issue).

But if we use the `minDistanceToBorder` parameter to discard the best candidate of the group at the second stage, then there will be no such problems and we will completely discard markers located too close to the border of the image.

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.
- [x] The feature is well documented and sample code can be built with the project CMake
2025-03-12 09:47:49 +03:00
..
aruco Merge pull request #26968 from MaximSmolskiy:fix-Aruco-marker-incorrect-detection-near-image-edge 2025-03-12 09:47:49 +03:00
barcode_decoder Fixed barcode to be built without DNN 2023-06-16 15:12:49 +03:00
barcode_detector Merge pull request #24903 from cristidbr-adapta:feature-barcode-detector-parameters 2024-05-20 09:53:22 +03:00
opencl fix test failure on ODROID-N2 2020-04-28 21:46:31 +09:00
barcode.cpp Merge pull request #24903 from cristidbr-adapta:feature-barcode-detector-parameters 2024-05-20 09:53:22 +03:00
cascadedetect_convert.cpp backport: checks and fixes from static code analyzers results 2020-09-02 19:05:47 +00:00
cascadedetect.cpp Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2021-12-03 12:32:49 +00:00
cascadedetect.hpp Merge remote-tracking branch 'upstream/3.4' into merge-3.4 2019-07-25 19:21:47 +00:00
detection_based_tracker.cpp Merge pull request #21107 from take1014:remove_assert_21038 2021-11-27 18:34:52 +00:00
face_detect.cpp WinRT/UWP build: fix some specific warnings 2024-10-25 22:32:44 +03:00
face_recognize.cpp WinRT/UWP build: fix some specific warnings 2024-10-25 22:32:44 +03:00
graphical_code_detector_impl.hpp Merge pull request #24548 from dkurt:qrcode_struct_append_decode 2024-02-01 16:15:14 +03:00
graphical_code_detector.cpp added graphicalCodeDetector, remove QRCodeDetectorBase 2023-06-08 14:50:58 +03:00
hog.cpp Clean up the Universal Intrinsic API. 2023-10-13 19:23:30 +08:00
main.cpp IPPInitSingelton was added to contain IPP related global variables; 2015-10-01 09:58:48 +03:00
precomp.hpp Merge pull request #23736 from seanm:c++11-simplifications 2024-01-19 16:53:08 +03:00
qrcode_encoder_table.inl.hpp Merge pull request #24299 from dkurt:qrcode_decode 2023-11-24 11:35:36 +03:00
qrcode_encoder.cpp objdetect: fix invalid vector access in QR encoder 2024-11-29 14:40:53 +03:00
qrcode.cpp Merge pull request #26650 from FantasqueX:fix-26642 2024-12-23 11:36:39 +03:00