Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect ARUCO detection with bigger markers #2811

Closed
Chris-Bee opened this issue Jan 12, 2021 · 3 comments
Closed

Incorrect ARUCO detection with bigger markers #2811

Chris-Bee opened this issue Jan 12, 2021 · 3 comments
Assignees

Comments

@Chris-Bee
Copy link

Chris-Bee commented Jan 12, 2021

System information (version)
  • OpenCV 4.2.* and 4.5.1

  • Operating System: Linux Ubuntu 64 Bit

  • Tag family is: DICT_7X7_250

  • Image resolution: 2056x2542

  • Images are grayscale

Detailed description

This issue concerns the implementation of the ARUCO marker detection. I observed, that the corner-detection / detection of squares in the image shows incorrect results. This issue is especially visible with bigger tag sizes (e.g. 0.3-0.5 meters). It appears that the corners or the squares are detected 2/3 into the outer border of the marker which results in incorrect height information. This issue does not occur in all conditions and seems especially related to the orientation of the tags. If the sides of the tag are aligned with the image frame (which basically means that the yaw rotation of the tag is a multiple of 90°) then this issue does not occur (compare attached image zero_yaw_rot.png). However, if the orientation is ~30-60°, then the size of the tag is incorrect (see image non_zero_yaw_rot.png below).

The sizes of the tags in image are [id, size in meter]:
"97: 0.15, 98: 0.15, 99: 0.3, 100: 0.1, 101: 0.15, 102: 0.5, 103: 0.15, 104: 0.1, 105: 0.3, 106: 0.15, 107: 0.15"

I verified that this is not only a problem in visualization, the height information does actually change if the issue occurs. A quick workaround was to transform the grayscale images into black and white images which results in correct detections.

I'm using a ROS package (https://github.com/UbiquityRobotics/fiducials) which implements the aruco detection with OpenCV. However, the attached python script will produce similar results.

tag_issue_images.zip
tag_detect_issue.py.zip

ID 102, the middle tag is detected incorrect:
non_zero_yaw_rot
ID105, the tag to the right, is detected incorrect:
zero_yaw_rot

@paroj
Copy link
Contributor

paroj commented Mar 26, 2021

#2900 maybe?

@Chris-Bee
Copy link
Author

@paroj Thank you for your reply! I found the issue on my side and it might actually be the underlining issue for #2900.

I'm using a 3 Megapixel Camera/Image, I assume the default values for the aruco settings are done for ~VGA resolution. Most parameters are relative to the image resolution, however, the threshold window sizes are not. Thus, the default values are too low and because of this, the thresholding was incorrect.
I visualized the threshold with the default parameter, and my adapted threshold window size parameter (see images below). With that, the detection works reliably. #2900 seems to have the same issue by locking at the inner contours.

Adapted parameter:

# Parameter for 3MegaPixel Images
aruco_params.adaptiveThreshWinSizeMin = 141  # default 3
aruco_params.adaptiveThreshWinSizeMax = 251  # default 23
aruco_params.adaptiveThreshWinSizeStep = 20  # default 10
aruco_params.adaptiveThreshConstant = 4      # default 7

Default parameter, incorrect threshold:
default_param_thr_wrong
Default parameter, incorrect detection:
default_param_wrong_detect
Adapted parameter, correct threshold:
adapt_param_thr_correct
Adapted parameter, correct detection:
adapt_param_correct_detect

Eventually, this can be mentioned in the tutorial, or the parameter could be rendered as relative values, but the pixel to threshold relation is probably not linear.

This issue can be closed in my opinion.

@AleksandrPanov
Copy link
Contributor

add info to FAQ in #3200

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants