Skip to content

Unable to detect Aruco marker under some circumstances #3192

@pla66

Description

@pla66
System information (version)
  • OpenCV => : 4.5.5
  • Operating System / Platform => : Ubuntu 18.04.5
  • Compiler => : CLion 2020.3
Detailed description

I have found that the function cv::aruco::detectMarkers() can not detect ArUco marker in some cases using latest OpenCV 4.5.5, but the function works well in older version of OpenCV (3.2.0). This happens only when the input image is blurred. If the input image has high resolution, both functions in 4.5.5 and 3.2.0 can detect it correctly.

So I read and compare the source codes in 4.5.5 and 3.2.0 and found some differences, I think it is maybe a bug, or maybe I was wrong if there are deeper reasons for this.

The source codes of function cv::aruco::detectMarkers() in 4.5.5 and 3.2.0 both has a pretreatment step of input image: _filterTooCloseCandidates(), which aims to "check candidates that are too close to each other" because maybe two or more boxes are drawn near the same place and are almost coincident. Both codes in 3.2.0 and 4.5.5 marked these candidates and keep only one of them. However, usually there has one case that some of detected candidates are not close to each other, which should also be retained for subsequent identification. The codes in 3.2.0 keeps these candidates, but codes in 4.5.5 does not. That is to say, codes in 4.5.5 only keep candidates that detected twice or more, and remove candidates that detected only once, which may lead to missed detection.

I wonder whether the author deliberately designed it like this in latest version. I think whether a candidate is an ArUco can be identified in the following function _identifyCandidates() rather than delete it in function _filterTooCloseCandidates() in advance. So there is maybe a mistake.

Steps to reproduce

Use this image can reproduce the mistake. Parameters DetectorParameters are all set to default.
0

Using OpenCV 4.5.5, the detect result like this:
111

Using OpenCV 3.2.0, the detect result like this:
222

Because in version 4.5.5, in function _detectInitialCandidates(), 6 candidates are detected on the right marker, but only 1 candidate is detected on the left, and therefore, the left one candidate is removed from the data in function _filterTooCloseCandidates(), if it is add mannualy, it can also be identified correctly:
333

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions