From fceaf397a1d7db2d9293e1715bb102c5312a7e16 Mon Sep 17 00:00:00 2001 From: Dehann Fourie Date: Sun, 17 Jan 2021 10:03:22 -0500 Subject: [PATCH 1/3] example written by @Affie, see #66 --- docs/src/index.md | 50 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/docs/src/index.md b/docs/src/index.md index 801a0f8..7b326f0 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -97,25 +97,47 @@ imshow(img_) # drawTags!(image, K, tags) ``` -## Example from Tests +## Example + +An easy (synthetic) verification example to test: ```julia -# see data/tagtest.jpg +using AprilTags +using Images detector = AprilTagDetector() -fx = 524.040 -fy = 524.040 -cx = 251.227 -cy = 319.254 -taglength = 0.172 -(tags, poses) = detectAndPose(detector, image, fx, fy, cx, cy, taglength) -# TODO test here -@test all(isapprox.(poses[1], [ 0.657276 -0.43653 0.614354 -0.236778; - 0.180276 0.882573 0.434242 0.268374; - -0.731771 -0.174663 0.65879 1.65107], - atol = 0.01)) -freeDetector!(detector) + +projImg = zeros(Gray{N0f8}, 480,640) +tag0 = kron(getAprilTagImage(0), ones(Gray{N0f8}, 4,4)) +projImg[221:260,301:340] = tag0 +projImg + +fx = 1000. +fy = 1000. +cx = 320. +cy = 240. + +K = [fx 0 cx; + 0 fy cy] + +tags = detector(projImg) + +imCol = RGB.(projImg) +foreach(tag->drawTagBox!(imCol, tag), tags) + +taglength = 0.1 +(tags, poses) = detectAndPose(detector, projImg, fx, fy, cx, cy, taglength) + +poses[1] +``` +results +``` +3×4 Array{Float64,2}: + 0.996868 0.00273632 0.079042 -0.000300523 + 0.00256118 0.99776 -0.0668423 -0.000417185 + -0.0790478 0.0668353 0.994628 3.1166 ``` +[copied from an issue discussion] ## Camera Calibration From 32b2f9732f7f3962445ccd37a6cb45a45c63500b Mon Sep 17 00:00:00 2001 From: Dehann Fourie Date: Sun, 17 Jan 2021 10:06:32 -0500 Subject: [PATCH 2/3] comment on conventions --- docs/src/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/src/index.md b/docs/src/index.md index 7b326f0..d4d7ed5 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -112,6 +112,7 @@ tag0 = kron(getAprilTagImage(0), ones(Gray{N0f8}, 4,4)) projImg[221:260,301:340] = tag0 projImg +# `img[i,j]` implies `width == x == j`, and `height == y == i` fx = 1000. fy = 1000. cx = 320. From 8bf0edc6ff048c00819ec000ccdb0db62af1138e Mon Sep 17 00:00:00 2001 From: Dehann Fourie Date: Sun, 17 Jan 2021 10:08:14 -0500 Subject: [PATCH 3/3] Update index.md --- docs/src/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/index.md b/docs/src/index.md index d4d7ed5..4fd5f24 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -112,7 +112,7 @@ tag0 = kron(getAprilTagImage(0), ones(Gray{N0f8}, 4,4)) projImg[221:260,301:340] = tag0 projImg -# `img[i,j]` implies `width == x == j`, and `height == y == i` +# `img[i,j]` implies `width == x == j`, and `height == y == i`, top left corner `(0,0)` fx = 1000. fy = 1000. cx = 320.