apriltag icon indicating copy to clipboard operation
apriltag copied to clipboard

Frequently no detection on clearly visible tags

Open n-gineer opened this issue 3 years ago • 3 comments

Clearly visible tags will sometimes be detected, and sometimes not at all. Shining a flashlight on the tag seemed to help, so I added a ring light to my raspberry pi, which did not seem to help. I've gotten detections on very bad lighting conditions, so I was not expecting such poor performance.

Steps to reproduce the behavior: Run apriltag detector on the attached input image.

Expected behavior Detects both tags

** Input Image** gray_fail

Operating Sytem PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"

** Installation Method** I built AprilTag from source following the instructions in the README

** Code version ** current github HEAD (v3.1.4).

Additional context My intended usage is in the particular lighting scenario of an enclosed garage with one or two tags visible.

running with debug shows that the tag is not detected as a quad.

debug_quads.pdf

The debug lines file seems to indicate the detector doesn't even recognize most of the lines on the tag.

debug_lines.pdf

EXAMPLE DETECTIONS IN POOR LIGHTING

n-gineer avatar Jul 17 '21 21:07 n-gineer

Thanks for the interesting test case. I downloaded the image you have and got a slightly different result (after converting it to a .pnm file for use with the apriltag_demo binary). For me, the tag on the left was detected but the tag on the right was not.

The reason the tag on the right is not detected is because of the sharp lighting gradient on the bottom left corner. This causes the adaptive thresholding (see debug_threshold.pnm) to classify a chunk of the white border as black, which causes the derived edge (see debug_clusters.pnm) to loop all the way back around the outside of the tag.

debug_threshold debug_clusters

There's two ways this could be fixed: a) by improving the adaptive thresholding or b) by detecting and deleting the parts of an edge that loop around likes this. I'm not sure what the best fix is, I'll have to think about it.

A more practical solution would be to remove any lamination from the tag or print it on something which is more matte and has less specular reflections.

mkrogius avatar Jul 17 '21 22:07 mkrogius

Thanks for the help debugging! I noticed that blur =2.0 went from being able to detect neither to both. I'm using the python bindings that came with the library, which I believe calls apriltag_demo. Apart from blur, I kept everything else defaulted.

Do you guys have a recommended printing method/product to make weatherproof tags? This tag is open to the weather pretty much any time other than my garage.

n-gineer avatar Jul 18 '21 17:07 n-gineer

The default settings may be different between the python interface and apriltag_demo, which may explain the difference. it's interesting that blur was able to fix the problem in the end.

In the past I have used bought tags printed on plastic from FedEx, but it is more expensive than laminating paper.

On Sun, Jul 18, 2021, 13:22 n-gineer @.***> wrote:

Thanks for the help debugging! I noticed that blur =2.0 went from being able to detect neither to both. I'm using the python bindings that came with the library, which I believe calls apriltag_demo. Apart from blur, I kept everything else defaulted.

Do you guys have a recommended printing method/product to make weatherproof tags? This tag is open to the weather pretty much any time other than my garage.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/AprilRobotics/apriltag/issues/161#issuecomment-882090385, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABF4RZOBIINAVYCX5YJMWBTTYMETVANCNFSM5AROPS6Q .

mkrogius avatar Jul 19 '21 22:07 mkrogius

Blurring the image helps.

With the converted jpeg image 126049372-14e3e0d3-6bb4-409c-915b-af4024f9ec3d

and blur of 2 sigma:

./apriltag_demo -d -x 1 -b 2 126049372-14e3e0d3-6bb4-409c-915b-af4024f9ec3d.jpg

I get a detection for both tags:

detection   0: id (36x11)-576 , hamming 0, margin   46.279
detection   1: id (36x11)-576 , hamming 0, margin   38.775

debug_output

christian-rauch avatar Feb 05 '24 21:02 christian-rauch