Skip to content

Instantly share code, notes, and snippets.

@Jeija
Created October 16, 2016 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jeija/3b3f700512000fd7dd7a1d5cdf3f8ede to your computer and use it in GitHub Desktop.
Save Jeija/3b3f700512000fd7dd7a1d5cdf3f8ede to your computer and use it in GitHub Desktop.
OpenCV AruCo Detection
%YAML:1.0
calibration_time: "Sun 16 Oct 2016 11:18:00 CEST"
nframes: 10
image_width: 640
image_height: 480
board_width: 9
board_height: 6
square_size: 2.9999999329447746e-02
aspectRatio: 1.
flags: 2
camera_matrix: !!opencv-matrix
rows: 3
cols: 3
dt: d
data: [ 8.2177218160147447e+02, 0., 3.4694289806342221e+02, 0.,
8.2177218160147447e+02, 2.4795144956871457e+02, 0., 0., 1. ]
distortion_coefficients: !!opencv-matrix
rows: 5
cols: 1
dt: d
data: [ 4.4824308523616324e-02, -7.4951985348854000e-01,
3.7539708742088725e-03, 8.8931335565222442e-03,
3.7214188475390984e+00 ]
avg_reprojection_error: 2.8896017678188746e-01
per_view_reprojection_errors: !!opencv-matrix
rows: 10
cols: 1
dt: f
data: [ 2.54738390e-01, 4.25707459e-01, 1.60925105e-01,
2.25878492e-01, 2.45417923e-01, 4.03438717e-01, 2.41075248e-01,
4.09280896e-01, 1.59312382e-01, 1.94787249e-01 ]
extrinsic_parameters: !!opencv-matrix
rows: 10
cols: 6
dt: d
data: [ 1.7937174859949592e-01, 4.0640849425772524e-01,
-2.2425665025614197e-01, -2.2579129648352439e-01,
-2.8505723669972147e-02, 7.5730797789902959e-01,
2.4633716216322735e-01, 2.6185601518094359e-01,
1.0575999159381184e-01, -2.0293852871866147e-01,
-8.9695456667859969e-02, 6.9499647310859536e-01,
5.4087414349605833e-01, 2.3583338471086776e-01,
2.9341742791840641e-01, -6.2977362820020033e-02,
-1.4618027284098153e-01, 6.4606686452177653e-01,
3.2073788519081869e-01, -2.4864194022328839e-01,
3.6255682308587928e-01, -1.0808317332952429e-02,
-1.6003893447305009e-01, 5.6510387212887592e-01,
2.8011107512648437e-01, -4.9980634542371555e-01,
5.9663757214380775e-01, -1.7492672081032198e-01,
-1.5208441818999571e-01, 6.9260959553312362e-01,
-8.6688624318511001e-02, -4.0343303893565621e-02,
-1.2061532040739030e-01, -2.4367173721456067e-01,
-1.2503944924638385e-01, 6.7548686905293287e-01,
1.9691591632651262e-01, -4.0437061346892227e-02,
2.0000234586070950e-01, -1.6334727626337803e-01,
-1.0049404184131587e-01, 7.3484352156060506e-01,
3.4331325723403089e-01, 1.3936714265178798e-01,
-1.3542851586275018e-01, -6.1251885773964163e-02,
-1.5926215105717356e-01, 7.5591828149158391e-01,
7.4009727576793316e-01, 5.5377846426787364e-02,
-2.6841089574521276e-01, -2.4623198300142540e-01,
-8.2750573010586664e-03, 7.1961595730070171e-01,
7.5775474630993134e-01, -7.7815716221472694e-02,
2.6517668849785159e-01, -1.2997382471600449e-01,
-1.1840419413224856e-01, 6.5663487292194389e-01 ]
image_points: !!opencv-matrix
rows: 10
cols: 54
dt: "2f"
data: [ 1.04204643e+02, 2.17749710e+02, 1.29227234e+02,
2.11308655e+02, 1.54964264e+02, 2.04616165e+02, 1.82063156e+02,
1.97574371e+02, 2.09866882e+02, 1.90465408e+02, 2.38827408e+02,
1.82939285e+02, 2.69254639e+02, 1.75144928e+02, 3.00466919e+02,
1.67049286e+02, 3.33122742e+02, 1.58575745e+02, 1.13309219e+02,
2.48538742e+02, 1.38264343e+02, 2.42678619e+02, 1.64240311e+02,
2.36581436e+02, 1.91330505e+02, 2.30272644e+02, 2.19275131e+02,
2.23647949e+02, 2.48318741e+02, 2.16810165e+02, 2.78563354e+02,
2.09711395e+02, 3.10016602e+02, 2.02406693e+02, 3.42587555e+02,
1.94674057e+02, 1.22252739e+02, 2.79172150e+02, 1.47372910e+02,
2.73861938e+02, 1.73328949e+02, 2.68332428e+02, 2.00473572e+02,
2.62585999e+02, 2.28480850e+02, 2.56607239e+02, 2.57574707e+02,
2.50476227e+02, 2.87954254e+02, 2.44023285e+02, 3.19395111e+02,
2.37396652e+02, 3.52052429e+02, 2.30427322e+02, 1.31235733e+02,
3.09649628e+02, 1.56299210e+02, 3.04900970e+02, 1.82396133e+02,
2.99963623e+02, 2.09532394e+02, 2.94813049e+02, 2.37594711e+02,
2.89529907e+02, 2.66719452e+02, 2.83975006e+02, 2.97291504e+02,
2.78285858e+02, 3.28608093e+02, 2.72324432e+02, 3.61365753e+02,
2.66161346e+02, 1.39951813e+02, 3.39758423e+02, 1.65237946e+02,
3.35576080e+02, 1.91340042e+02, 3.31245789e+02, 2.18574081e+02,
3.26696472e+02, 2.46618713e+02, 3.21933685e+02, 2.75891052e+02,
3.17062592e+02, 3.06375793e+02, 3.11874359e+02, 3.37754791e+02,
3.06652496e+02, 3.70521667e+02, 3.01188843e+02, 1.48668808e+02,
3.69671112e+02, 1.73897919e+02, 3.66024963e+02, 2.00247284e+02,
3.62269318e+02, 2.27456604e+02, 3.58210022e+02, 2.55611404e+02,
3.54199677e+02, 2.84773895e+02, 3.49771759e+02, 3.15409698e+02,
3.45389801e+02, 3.46812836e+02, 3.40670776e+02, 3.79618042e+02,
3.35958221e+02, 1.09437416e+02, 1.42880524e+02, 1.40655640e+02,
1.46554642e+02, 1.72609329e+02, 1.50221298e+02, 2.05634354e+02,
1.54031433e+02, 2.39149612e+02, 1.57835968e+02, 2.73502136e+02,
1.61895737e+02, 3.08717560e+02, 1.65920242e+02, 3.44597473e+02,
1.70241943e+02, 3.81483826e+02, 1.74408676e+02, 1.09179718e+02,
1.77372894e+02, 1.40267792e+02, 1.81319504e+02, 1.71835098e+02,
1.85381485e+02, 2.04610519e+02, 1.89489731e+02, 2.37804932e+02,
1.93714249e+02, 2.71928802e+02, 1.98122772e+02, 3.06734863e+02,
2.02577209e+02, 3.42437927e+02, 2.07125488e+02, 3.78637177e+02,
2.11751282e+02, 1.09087997e+02, 2.11214752e+02, 1.39692551e+02,
2.15456955e+02, 1.71262695e+02, 2.19810242e+02, 2.03539825e+02,
2.24402893e+02, 2.36560410e+02, 2.28992737e+02, 2.70248779e+02,
2.33626221e+02, 3.04893036e+02, 2.38524429e+02, 3.40022888e+02,
2.43429504e+02, 3.76061768e+02, 2.48456940e+02, 1.08769135e+02,
2.44626266e+02, 1.39284317e+02, 2.49317261e+02, 1.70496918e+02,
2.54025589e+02, 2.02586777e+02, 2.58841736e+02, 2.35305801e+02,
2.63795563e+02, 2.68598724e+02, 2.68846771e+02, 3.02902710e+02,
2.74039398e+02, 3.37785400e+02, 2.79403381e+02, 3.73501190e+02,
2.84744354e+02, 1.08478592e+02, 2.77386688e+02, 1.38834366e+02,
2.82365631e+02, 1.69741516e+02, 2.87437531e+02, 2.01499863e+02,
2.92528381e+02, 2.33937698e+02, 2.97861938e+02, 2.66933380e+02,
3.03246460e+02, 3.00985748e+02, 3.08758423e+02, 3.35498657e+02,
3.14398376e+02, 3.70785492e+02, 3.20214081e+02, 1.08299301e+02,
3.09565155e+02, 1.38273285e+02, 3.14859558e+02, 1.69005798e+02,
3.20196777e+02, 2.00482422e+02, 3.25715240e+02, 2.32497208e+02,
3.31318146e+02, 2.65297028e+02, 3.37069641e+02, 2.99002930e+02,
3.42785950e+02, 3.33316193e+02, 3.48826019e+02, 3.68292236e+02,
3.54886749e+02, 2.67488556e+02, 6.30057602e+01, 3.02357513e+02,
7.43362427e+01, 3.37856659e+02, 8.56093140e+01, 3.74228912e+02,
9.74893417e+01, 4.10994568e+02, 1.09246048e+02, 4.48315948e+02,
1.21419807e+02, 4.86513580e+02, 1.33659637e+02, 5.25066956e+02,
1.46349884e+02, 5.64390259e+02, 1.58931213e+02, 2.61472229e+02,
9.76691513e+01, 2.95572998e+02, 1.08873383e+02, 3.30167389e+02,
1.20423302e+02, 3.65555603e+02, 1.32069397e+02, 4.01315430e+02,
1.44039108e+02, 4.37594086e+02, 1.56005188e+02, 4.74707886e+02,
1.68376450e+02, 5.12303528e+02, 1.80773026e+02, 5.50419250e+02,
1.93562073e+02, 2.55863922e+02, 1.30622849e+02, 2.89038147e+02,
1.41971848e+02, 3.22800110e+02, 1.53374664e+02, 3.57284180e+02,
1.65221481e+02, 3.92101776e+02, 1.76915207e+02, 4.27405853e+02,
1.89017960e+02, 4.63568665e+02, 2.01268234e+02, 5.00020599e+02,
2.13784546e+02, 5.37014648e+02, 2.26289108e+02, 2.50446747e+02,
1.62407471e+02, 2.82823181e+02, 1.73594147e+02, 3.15613098e+02,
1.85115616e+02, 3.49372192e+02, 1.96704819e+02, 3.83235504e+02,
2.08583466e+02, 4.17655457e+02, 2.20511765e+02, 4.52758484e+02,
2.32785187e+02, 4.88361267e+02, 2.45157913e+02, 5.24386047e+02,
2.57775299e+02, 2.45337952e+02, 1.92488373e+02, 2.76832886e+02,
2.03652924e+02, 3.08929108e+02, 2.15065796e+02, 3.41690674e+02,
2.26676132e+02, 3.74759460e+02, 2.38441895e+02, 4.08372742e+02,
2.50420120e+02, 4.42604889e+02, 2.62566254e+02, 4.77263733e+02,
2.74889374e+02, 5.12317749e+02, 2.87411957e+02, 2.40322845e+02,
2.21286743e+02, 2.71282806e+02, 2.32461517e+02, 3.02484131e+02,
2.43740097e+02, 3.34475769e+02, 2.55375656e+02, 3.66681152e+02,
2.67024139e+02, 3.99478302e+02, 2.78947662e+02, 4.32876984e+02,
2.90967407e+02, 4.66584442e+02, 3.03268982e+02, 5.00737579e+02,
3.15686859e+02, 3.32382141e+02, 1.58513155e+01, 3.70955536e+02,
3.23321152e+01, 4.08763702e+02, 4.82113152e+01, 4.45742310e+02,
6.39899559e+01, 4.81689545e+02, 7.88490906e+01, 5.16651672e+02,
9.37390213e+01, 5.51054932e+02, 1.08010124e+02, 5.84355652e+02,
1.22098755e+02, 6.16893677e+02, 1.35491791e+02, 3.15647430e+02,
5.69990044e+01, 3.54236725e+02, 7.25645294e+01, 3.91611572e+02,
8.77763062e+01, 4.28443878e+02, 1.02606384e+02, 4.64028961e+02,
1.17188889e+02, 4.98819000e+02, 1.30947235e+02, 5.32944458e+02,
1.44800827e+02, 5.66013367e+02, 1.57926743e+02, 5.98425232e+02,
1.71087234e+02, 2.99695129e+02, 9.68817368e+01, 3.37798492e+02,
1.11803299e+02, 3.75098938e+02, 1.26264236e+02, 4.11548767e+02,
1.40455475e+02, 4.47029938e+02, 1.54090820e+02, 4.81503510e+02,
1.67561600e+02, 5.15469421e+02, 1.80543121e+02, 5.48449829e+02,
1.93287476e+02, 5.80457214e+02, 2.05527832e+02, 2.84142517e+02,
1.36253632e+02, 3.21997009e+02, 1.50344193e+02, 3.58876434e+02,
1.64118942e+02, 3.95213898e+02, 1.77526016e+02, 4.30400269e+02,
1.90615372e+02, 4.64675201e+02, 2.03275085e+02, 4.98374969e+02,
2.15808762e+02, 5.31268250e+02, 2.27760986e+02, 5.63003601e+02,
2.39570526e+02, 2.69283142e+02, 1.74182190e+02, 3.06713013e+02,
1.87541458e+02, 3.43446289e+02, 2.00635483e+02, 3.79448547e+02,
2.13481110e+02, 4.14362335e+02, 2.25852905e+02, 4.48448822e+02,
2.37997147e+02, 4.81871063e+02, 2.49759598e+02, 5.14431335e+02,
2.61374176e+02, 5.46249573e+02, 2.72538086e+02, 2.54653305e+02,
2.11130569e+02, 2.91988312e+02, 2.23821609e+02, 3.28389557e+02,
2.36344406e+02, 3.64127808e+02, 2.48531570e+02, 3.98748291e+02,
2.60329529e+02, 4.32641174e+02, 2.71827820e+02, 4.65916504e+02,
2.83183167e+02, 4.98275299e+02, 2.94062988e+02, 5.29840027e+02,
3.04735626e+02, 1.42005447e+02, 6.90616608e+01, 1.70544861e+02,
8.88074112e+01, 1.98192596e+02, 1.07900085e+02, 2.24640564e+02,
1.26224968e+02, 2.50281479e+02, 1.43695374e+02, 2.74733734e+02,
1.60534546e+02, 2.98540344e+02, 1.76737396e+02, 3.21382080e+02,
1.92354248e+02, 3.43355469e+02, 2.07259033e+02, 1.21643082e+02,
9.75754242e+01, 1.50700150e+02, 1.16815727e+02, 1.78470856e+02,
1.35179840e+02, 2.05481079e+02, 1.52868240e+02, 2.31278656e+02,
1.69759338e+02, 2.56088837e+02, 1.86043915e+02, 2.80225433e+02,
2.01698273e+02, 3.03274994e+02, 2.16655563e+02, 3.25531372e+02,
2.31091904e+02, 1.01688652e+02, 1.26126602e+02, 1.31003983e+02,
1.44530899e+02, 1.59201248e+02, 1.62357269e+02, 1.86366806e+02,
1.79378662e+02, 2.12525146e+02, 1.95665161e+02, 2.37561951e+02,
2.11366058e+02, 2.62074219e+02, 2.26488983e+02, 2.85376282e+02,
2.40899704e+02, 3.07747925e+02, 2.54781921e+02, 8.18286285e+01,
1.54450897e+02, 1.11464584e+02, 1.72436523e+02, 1.39873947e+02,
1.89387878e+02, 1.67471222e+02, 2.05883514e+02, 1.93792236e+02,
2.21534378e+02, 2.19343277e+02, 2.36692535e+02, 2.43852722e+02,
2.51288284e+02, 2.67572723e+02, 2.65269104e+02, 2.90277313e+02,
2.78539368e+02, 6.24532242e+01, 1.82653458e+02, 9.23082123e+01,
1.99654251e+02, 1.21093628e+02, 2.16337692e+02, 1.48874863e+02,
2.31975754e+02, 1.75504593e+02, 2.47244308e+02, 2.01277954e+02,
2.61648804e+02, 2.26174149e+02, 2.75731415e+02, 2.50085724e+02,
2.89076050e+02, 2.73048065e+02, 3.02097534e+02, 4.30931969e+01,
2.10395493e+02, 7.33776093e+01, 2.27109314e+02, 1.02422279e+02,
2.42703705e+02, 1.30512848e+02, 2.58145386e+02, 1.57476013e+02,
2.72542419e+02, 1.83416138e+02, 2.86583282e+02, 2.08563705e+02,
2.99926117e+02, 2.32637909e+02, 3.12960602e+02, 2.55988098e+02,
3.25355103e+02, 5.30218658e+01, 9.72093964e+01, 8.93472672e+01,
9.29701538e+01, 1.25658638e+02, 8.89518967e+01, 1.62011505e+02,
8.47074432e+01, 1.98050293e+02, 8.06580658e+01, 2.33905228e+02,
7.65343857e+01, 2.69920654e+02, 7.24903641e+01, 3.05566589e+02,
6.84966736e+01, 3.41217468e+02, 6.45210495e+01, 5.62670441e+01,
1.32703705e+02, 9.27020340e+01, 1.28524704e+02, 1.29117844e+02,
1.24309631e+02, 1.65535583e+02, 1.20131996e+02, 2.01591736e+02,
1.15871132e+02, 2.37627686e+02, 1.11701340e+02, 2.73708618e+02,
1.07580154e+02, 3.09483398e+02, 1.03529991e+02, 3.45147797e+02,
9.94131622e+01, 5.95650368e+01, 1.68497742e+02, 9.61612244e+01,
1.64182129e+02, 1.32547348e+02, 1.59924149e+02, 1.69100403e+02,
1.55546249e+02, 2.05301025e+02, 1.51350739e+02, 2.41413055e+02,
1.47137085e+02, 2.77461548e+02, 1.42764160e+02, 3.13442596e+02,
1.38567307e+02, 3.49130981e+02, 1.34565430e+02, 6.29467239e+01,
2.04651062e+02, 9.95508575e+01, 2.00324417e+02, 1.36078979e+02,
1.95849396e+02, 1.72627625e+02, 1.91523834e+02, 2.09034897e+02,
1.87222824e+02, 2.45238968e+02, 1.82781967e+02, 2.81417572e+02,
1.78641190e+02, 3.17399323e+02, 1.74413162e+02, 3.53143677e+02,
1.69970428e+02, 6.63891449e+01, 2.40799225e+02, 1.03084801e+02,
2.36339142e+02, 1.39578629e+02, 2.31869659e+02, 1.76354401e+02,
2.27409271e+02, 2.12676880e+02, 2.22931793e+02, 2.49066742e+02,
2.18583878e+02, 2.85399200e+02, 2.14146988e+02, 3.21344513e+02,
2.09743958e+02, 3.57218597e+02, 2.05461273e+02, 6.98234177e+01,
2.77097778e+02, 1.06542755e+02, 2.72527130e+02, 1.43286179e+02,
2.67968994e+02, 1.80049896e+02, 2.63433472e+02, 2.16531021e+02,
2.58878387e+02, 2.52855972e+02, 2.54427048e+02, 2.89333099e+02,
2.49895966e+02, 3.25384521e+02, 2.45427261e+02, 3.61320526e+02,
2.41006836e+02, 1.65294525e+02, 1.35828354e+02, 1.98083359e+02,
1.42469437e+02, 2.30878265e+02, 1.49057709e+02, 2.63714050e+02,
1.55671036e+02, 2.96441864e+02, 1.62312576e+02, 3.28811340e+02,
1.68873276e+02, 3.61425262e+02, 1.75412094e+02, 3.93625183e+02,
1.81969391e+02, 4.25703308e+02, 1.88419540e+02, 1.60001587e+02,
1.68664032e+02, 1.92611511e+02, 1.75222763e+02, 2.25223816e+02,
1.81699982e+02, 2.57790253e+02, 1.88273819e+02, 2.90187408e+02,
1.94748642e+02, 3.22379089e+02, 2.01170731e+02, 3.54613129e+02,
2.07606491e+02, 3.86571320e+02, 2.14044327e+02, 4.18441528e+02,
2.20379349e+02, 1.54980148e+02, 2.01067688e+02, 1.87307755e+02,
2.07451492e+02, 2.19572342e+02, 2.13833511e+02, 2.51908783e+02,
2.20285324e+02, 2.84025452e+02, 2.26575958e+02, 3.15934296e+02,
2.32996338e+02, 3.47970917e+02, 2.39299423e+02, 3.79637543e+02,
2.45500214e+02, 4.11339020e+02, 2.51856628e+02, 1.49817932e+02,
2.33004517e+02, 1.82021469e+02, 2.39378677e+02, 2.13999908e+02,
2.45591034e+02, 2.46192764e+02, 2.51930740e+02, 2.77898010e+02,
2.58186157e+02, 3.09592926e+02, 2.64373291e+02, 3.41430389e+02,
2.70606110e+02, 3.72798126e+02, 2.76808868e+02, 4.04273560e+02,
2.82945038e+02, 1.45027023e+02, 2.64310516e+02, 1.76730377e+02,
2.70461365e+02, 2.08575241e+02, 2.76633759e+02, 2.40436737e+02,
2.82785217e+02, 2.72055969e+02, 2.88944550e+02, 3.03445679e+02,
2.95082153e+02, 3.35032471e+02, 3.01234711e+02, 3.66245026e+02,
3.07282806e+02, 3.97328796e+02, 3.13359558e+02, 1.40161758e+02,
2.94967224e+02, 1.71670715e+02, 3.01118408e+02, 2.03261185e+02,
3.07209503e+02, 2.34801193e+02, 3.13270752e+02, 2.66212494e+02,
3.19306519e+02, 2.97388855e+02, 3.25308350e+02, 3.28625671e+02,
3.31296997e+02, 3.59591675e+02, 3.37291901e+02, 3.90507660e+02,
3.43213593e+02, 2.80086334e+02, 7.46673050e+01, 3.11820404e+02,
7.00841751e+01, 3.44266357e+02, 6.52334976e+01, 3.77095001e+02,
6.05003548e+01, 4.10425018e+02, 5.55367317e+01, 4.43944824e+02,
5.06962738e+01, 4.78341644e+02, 4.55079842e+01, 5.12784119e+02,
4.05111809e+01, 5.47947205e+02, 3.54617767e+01, 2.86166412e+02,
1.07115646e+02, 3.17615112e+02, 1.02662682e+02, 3.49498840e+02,
9.82341614e+01, 3.82035583e+02, 9.36175461e+01, 4.14636719e+02,
8.91074600e+01, 4.47951050e+02, 8.43985291e+01, 4.81700226e+02,
7.97223816e+01, 5.15768982e+02, 7.49194183e+01, 5.50370117e+02,
7.00459976e+01, 2.92153839e+02, 1.38568344e+02, 3.23185242e+02,
1.34464767e+02, 3.54564789e+02, 1.30236679e+02, 3.86598969e+02,
1.25985954e+02, 4.19018372e+02, 1.21564888e+02, 4.51654388e+02,
1.17308258e+02, 4.85127197e+02, 1.12661255e+02, 5.18600830e+02,
1.08298439e+02, 5.52729309e+02, 1.03781036e+02, 2.97851349e+02,
1.69463043e+02, 3.28529236e+02, 1.65514130e+02, 3.59540039e+02,
1.61599976e+02, 3.91301788e+02, 1.57493851e+02, 4.23121002e+02,
1.53476288e+02, 4.55506836e+02, 1.49323196e+02, 4.88288025e+02,
1.45184570e+02, 5.21559814e+02, 1.40928833e+02, 5.54919922e+02,
1.36633682e+02, 3.03486237e+02, 1.99206223e+02, 3.33648468e+02,
1.95561203e+02, 3.64417969e+02, 1.91767548e+02, 3.95578217e+02,
1.88052521e+02, 4.27188995e+02, 1.84168762e+02, 4.58946503e+02,
1.80344650e+02, 4.91521271e+02, 1.76338379e+02, 5.24152283e+02,
1.72423126e+02, 5.57371460e+02, 1.68375473e+02, 3.08822083e+02,
2.28243240e+02, 3.38716614e+02, 2.24723053e+02, 3.69012207e+02,
2.21332611e+02, 3.99932281e+02, 2.17672775e+02, 4.30996979e+02,
2.14165787e+02, 4.62521545e+02, 2.10480499e+02, 4.94506042e+02,
2.06746887e+02, 5.26773682e+02, 2.02992767e+02, 5.59453918e+02,
1.99261246e+02, 6.84729843e+01, 2.38952072e+02, 9.93422089e+01,
2.31282715e+02, 1.30617096e+02, 2.23527710e+02, 1.62543777e+02,
2.15529205e+02, 1.94889191e+02, 2.07519852e+02, 2.27649460e+02,
1.99360825e+02, 2.61293091e+02, 1.91058136e+02, 2.94927032e+02,
1.82610092e+02, 3.29373138e+02, 1.74096039e+02, 8.42339478e+01,
2.62423035e+02, 1.14446037e+02, 2.55220230e+02, 1.44999741e+02,
2.47697037e+02, 1.76288971e+02, 2.40188339e+02, 2.07728348e+02,
2.32516022e+02, 2.39804703e+02, 2.24747894e+02, 2.72475800e+02,
2.16833481e+02, 3.05482117e+02, 2.08804489e+02, 3.38803955e+02,
2.00734604e+02, 9.92915344e+01, 2.84765076e+02, 1.28673981e+02,
2.77790405e+02, 1.58622955e+02, 2.70738861e+02, 1.89212891e+02,
2.63519928e+02, 2.20078033e+02, 2.56274658e+02, 2.51331268e+02,
2.48797043e+02, 2.83301666e+02, 2.41328323e+02, 3.15367950e+02,
2.33667206e+02, 3.47999084e+02, 2.25892044e+02, 1.13527451e+02,
3.06204376e+02, 1.42467300e+02, 2.99521271e+02, 1.71652054e+02,
2.92763580e+02, 2.01568604e+02, 2.85852936e+02, 2.31663864e+02,
2.79000275e+02, 2.62344482e+02, 2.71852631e+02, 2.93429077e+02,
2.64672302e+02, 3.24847046e+02, 2.57429291e+02, 3.56598938e+02,
2.50137833e+02, 1.27218369e+02, 3.26402863e+02, 1.55421478e+02,
3.20133118e+02, 1.84102509e+02, 3.13609924e+02, 2.13322357e+02,
3.07088806e+02, 2.42760498e+02, 3.00406799e+02, 2.72589325e+02,
2.93653809e+02, 3.03158691e+02, 2.86702728e+02, 3.33686584e+02,
2.79902100e+02, 3.64858307e+02, 2.72793945e+02, 1.40137238e+02,
3.45750519e+02, 1.67815384e+02, 3.39665466e+02, 1.95863495e+02,
3.33541718e+02, 2.24486130e+02, 3.27226105e+02, 2.53354828e+02,
3.20863647e+02, 2.82509003e+02, 3.14421204e+02, 3.12336639e+02,
3.07769714e+02, 3.42344971e+02, 3.01193390e+02, 3.72648529e+02,
2.94526337e+02, 1.85582520e+02, 1.00905579e+02, 2.22051208e+02,
1.09448486e+02, 2.58320312e+02, 1.18016769e+02, 2.94192993e+02,
1.26423271e+02, 3.29580688e+02, 1.34789734e+02, 3.64518616e+02,
1.42990204e+02, 3.99422211e+02, 1.51252441e+02, 4.33587982e+02,
1.59233704e+02, 4.67515381e+02, 1.67259094e+02, 1.80640762e+02,
1.30260300e+02, 2.16272644e+02, 1.38473145e+02, 2.51300598e+02,
1.46541534e+02, 2.86362030e+02, 1.54647049e+02, 3.20616821e+02,
1.62516678e+02, 3.54716064e+02, 1.70427628e+02, 3.88538483e+02,
1.78182571e+02, 4.21858521e+02, 1.85908264e+02, 4.54800507e+02,
1.93457626e+02, 1.76299316e+02, 1.58008438e+02, 2.10624664e+02,
1.65745911e+02, 2.44823715e+02, 1.73544754e+02, 2.78759003e+02,
1.81218231e+02, 3.12360931e+02, 1.88828125e+02, 3.45350494e+02,
1.96289612e+02, 3.78376160e+02, 2.03718796e+02, 4.10713043e+02,
2.11014526e+02, 4.42797974e+02, 2.18337219e+02, 1.71798645e+02,
1.84308304e+02, 2.05459503e+02, 1.91789566e+02, 2.38579193e+02,
1.99163513e+02, 2.71724274e+02, 2.06542007e+02, 3.04273499e+02,
2.13711823e+02, 3.36512085e+02, 2.20909668e+02, 3.68578125e+02,
2.27969910e+02, 4.00198975e+02, 2.35062317e+02, 4.31437775e+02,
2.41966583e+02, 1.67817795e+02, 2.09158112e+02, 2.00424347e+02,
2.16263885e+02, 2.32857651e+02, 2.23385956e+02, 2.65039948e+02,
2.30304840e+02, 2.96729462e+02, 2.37303055e+02, 3.28145905e+02,
2.44038315e+02, 3.59418488e+02, 2.50888474e+02, 3.90211884e+02,
2.57602631e+02, 4.20656494e+02, 2.64297241e+02, 1.63939377e+02,
2.32602234e+02, 1.95725418e+02, 2.39467804e+02, 2.27297180e+02,
2.46171234e+02, 2.58626495e+02, 2.52925674e+02, 2.89535461e+02,
2.59520325e+02, 3.20211945e+02, 2.66140381e+02, 3.50671295e+02,
2.72583313e+02, 3.80668304e+02, 2.79002350e+02, 4.10533752e+02,
2.85409027e+02 ]
%YAML:1.0
# See http://docs.opencv.org/trunk/d1/dcd/structcv_1_1aruco_1_1DetectorParameters.html for documentation
adaptiveThreshWinSizeMin: 3
adaptiveThreshWinSizeMax: 23
adaptiveThreshWinSizeStep: 10
adaptiveThreshConstant: 7
minMarkerPerimeterRate: 0.03
maxMarkerPerimeterRate: 4.0
polygonalApproxAccuracyRate: 0.03
minCornerDistanceRate: 0.05
minDistanceToBorder: 3
minMarkerDistanceRate: 0.05
doCornerRefinement: false
cornerRefinementWinSize: 5
cornerRefinementMaxIterations: 30
cornerRefinementMinAccuracy: 0.1
markerBorderBits: 1
perspectiveRemovePixelPerCell: 4
perspectiveRemoveIgnoredMarginPerCell: 0.13
maxErroneousBitsInBorderRate: 0.45
minOtsuStdDev: 5.0
errorCorrectionRate: 0.6
/*
By downloading, copying, installing or using the software you agree to this
license. If you do not agree to this license, do not download, install,
copy or use the software.
License Agreement
For Open Source Computer Vision Library
(3-clause BSD License)
Copyright (C) 2013, OpenCV Foundation, all rights reserved.
Third party copyrights are property of their respective owners.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the names of the copyright holders nor the names of the contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
This software is provided by the copyright holders and contributors "as is" and
any express or implied warranties, including, but not limited to, the implied
warranties of merchantability and fitness for a particular purpose are
disclaimed. In no event shall copyright holders or contributors be liable for
any direct, indirect, incidental, special, exemplary, or consequential damages
(including, but not limited to, procurement of substitute goods or services;
loss of use, data, or profits; or business interruption) however caused
and on any theory of liability, whether in contract, strict liability,
or tort (including negligence or otherwise) arising in any way out of
the use of this software, even if advised of the possibility of such damage.
*/
#include <opencv2/highgui.hpp>
#include <opencv2/aruco.hpp>
#include <iostream>
using namespace std;
using namespace cv;
namespace {
const char* about = "Basic marker detection";
const char* keys =
"{d | | dictionary: DICT_4X4_50=0, DICT_4X4_100=1, DICT_4X4_250=2,"
"DICT_4X4_1000=3, DICT_5X5_50=4, DICT_5X5_100=5, DICT_5X5_250=6, DICT_5X5_1000=7, "
"DICT_6X6_50=8, DICT_6X6_100=9, DICT_6X6_250=10, DICT_6X6_1000=11, DICT_7X7_50=12,"
"DICT_7X7_100=13, DICT_7X7_250=14, DICT_7X7_1000=15, DICT_ARUCO_ORIGINAL = 16}"
"{v | | Input from video file, if ommited, input comes from camera }"
"{ci | 0 | Camera id if input doesnt come from video (-v) }"
"{c | | Camera intrinsic parameters. Needed for camera pose }"
"{l | 0.1 | Marker side lenght (in meters). Needed for correct scale in camera pose }"
"{dp | | File of marker detector parameters }"
"{r | | show rejected candidates too }";
}
/**
*/
static bool readCameraParameters(string filename, Mat &camMatrix, Mat &distCoeffs) {
FileStorage fs(filename, FileStorage::READ);
if(!fs.isOpened())
return false;
fs["camera_matrix"] >> camMatrix;
fs["distortion_coefficients"] >> distCoeffs;
return true;
}
/**
*/
static bool readDetectorParameters(string filename, aruco::DetectorParameters &params) {
FileStorage fs(filename, FileStorage::READ);
if(!fs.isOpened())
return false;
fs["adaptiveThreshWinSizeMin"] >> params.adaptiveThreshWinSizeMin;
fs["adaptiveThreshWinSizeMax"] >> params.adaptiveThreshWinSizeMax;
fs["adaptiveThreshWinSizeStep"] >> params.adaptiveThreshWinSizeStep;
fs["adaptiveThreshConstant"] >> params.adaptiveThreshConstant;
fs["minMarkerPerimeterRate"] >> params.minMarkerPerimeterRate;
fs["maxMarkerPerimeterRate"] >> params.maxMarkerPerimeterRate;
fs["polygonalApproxAccuracyRate"] >> params.polygonalApproxAccuracyRate;
fs["minCornerDistanceRate"] >> params.minCornerDistanceRate;
fs["minDistanceToBorder"] >> params.minDistanceToBorder;
fs["minMarkerDistanceRate"] >> params.minMarkerDistanceRate;
fs["doCornerRefinement"] >> params.doCornerRefinement;
fs["cornerRefinementWinSize"] >> params.cornerRefinementWinSize;
fs["cornerRefinementMaxIterations"] >> params.cornerRefinementMaxIterations;
fs["cornerRefinementMinAccuracy"] >> params.cornerRefinementMinAccuracy;
fs["markerBorderBits"] >> params.markerBorderBits;
fs["perspectiveRemovePixelPerCell"] >> params.perspectiveRemovePixelPerCell;
fs["perspectiveRemoveIgnoredMarginPerCell"] >> params.perspectiveRemoveIgnoredMarginPerCell;
fs["maxErroneousBitsInBorderRate"] >> params.maxErroneousBitsInBorderRate;
fs["minOtsuStdDev"] >> params.minOtsuStdDev;
fs["errorCorrectionRate"] >> params.errorCorrectionRate;
return true;
}
/**
*/
int main(int argc, char *argv[]) {
CommandLineParser parser(argc, argv, keys);
parser.about(about);
if(argc < 2) {
parser.printMessage();
return 0;
}
int dictionaryId = parser.get<int>("d");
bool showRejected = parser.has("r");
bool estimatePose = parser.has("c");
float markerLength = parser.get<float>("l");
aruco::DetectorParameters detectorParams;
if(parser.has("dp")) {
bool readOk = readDetectorParameters(parser.get<string>("dp"), detectorParams);
if(!readOk) {
cerr << "Invalid detector parameters file" << endl;
return 0;
}
}
detectorParams.doCornerRefinement = true; // do corner refinement in markers
int camId = parser.get<int>("ci");
String video;
if(parser.has("v")) {
video = parser.get<String>("v");
}
if(!parser.check()) {
parser.printErrors();
return 0;
}
aruco::Dictionary dictionary =
aruco::getPredefinedDictionary(aruco::PREDEFINED_DICTIONARY_NAME(dictionaryId));
Mat camMatrix, distCoeffs;
if(estimatePose) {
bool readOk = readCameraParameters(parser.get<string>("c"), camMatrix, distCoeffs);
if(!readOk) {
cerr << "Invalid camera file" << endl;
return 0;
}
}
VideoCapture inputVideo;
int waitTime;
if(!video.empty()) {
inputVideo.open(video);
waitTime = 0;
} else {
inputVideo.open(camId);
waitTime = 10;
}
long totalIterations = 0;
while(inputVideo.grab()) {
totalIterations++;
Mat image, imageCopy;
inputVideo.retrieve(image);
double tick = (double)getTickCount();
vector< int > ids;
vector< vector< Point2f > > corners, rejected;
vector< Vec3d > rvecs, tvecs;
// detect markers and estimate pose
aruco::detectMarkers(image, dictionary, corners, ids, detectorParams, rejected);
if(estimatePose && ids.size() > 0)
aruco::estimatePoseSingleMarkers(corners, markerLength, camMatrix, distCoeffs, rvecs,
tvecs);
double currentTime = ((double)getTickCount() - tick) / getTickFrequency();
if(totalIterations % 10 == 0)
cout << "# Detection Time = " << currentTime * 1000 << " ms" << endl;
// draw results
image.copyTo(imageCopy);
if(ids.size() > 0) {
aruco::drawDetectedMarkers(imageCopy, corners, ids);
if(estimatePose) {
for(unsigned int i = 0; i < ids.size(); i++) {
aruco::drawAxis(imageCopy, camMatrix, distCoeffs, rvecs[i], tvecs[i], markerLength * 0.5f);
cout << ids[i] << " at " << tvecs[i] << endl;
}
} else {
for(unsigned int i = 0; i < ids.size(); ++i)
cout << ids[i] << endl;
}
}
if(showRejected && rejected.size() > 0)
aruco::drawDetectedMarkers(imageCopy, rejected, noArray(), Scalar(100, 0, 255));
imshow("OpenCV AruCo Detector", imageCopy);
char key = (char)waitKey(waitTime);
if(key == 27) break;
}
return 0;
}
TARGET := arucodetect
CXX := g++
# MARKERSIZE: Marker side length in meters
DICTIONARY := 0
MARKERSIZE := 0.2
CAMPARAM := c270.yml
DETECTPARAM := config.yml
all: main.cpp
$(CXX) -ggdb `pkg-config --cflags --libs opencv` main.cpp -o ./$(TARGET)
run: all
./$(TARGET) -d=$(DICTIONARY) -l=$(MARKERSIZE) --dp=$(DETECTPARAM)
run_pose: all
./$(TARGET) -d=$(DICTIONARY) -l=$(MARKERSIZE) --dp=$(DETECTPARAM) -c=$(CAMPARAM)
clean:
$(RM) ./$(TARGET)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment