ARToolKit 生成标记文件

内容纲要

ARToolKit 生成.dat与.hiro文件

一、相机校验 生成.dat文件

1、下载ARToolKit SDK

官网:artoolkit

2、打开命令提示符

键入:

./calib_camera

终端会输出:

Current working directory is '/Users/indeex'
CHESSBOARD_CORNER_NUM_X = 7
CHESSBOARD_CORNER_NUM_Y = 5
CHESSBOARD_PATTERN_WIDTH = 30.000000
CALIB_IMAGE_NUM = 10
Video parameter: -width=640 -height=480
Using supplied video config "-width=640 -height=480".
Video formatType is BGRA, size is 640x480.
Image size (x,y) = (640,480)

3、捕获校准图像

a、当相机可以清楚地看到所有中间角时,“X”标志变为红色,并且可以捕获校准图像

b、如果某些角落被相机框架的边缘遮挡,或者光线不足或反射不良,“X”将变绿

c、得到所有红色的’X’图像后,按键盘空格键

d、一旦所有的校准图像被捕获后,(默认是10个)按空格键,校准数据被列出,并且计算与相机设备相关联的数据。列表的校准数据将从命令行窗口中列出。此时,应用程序会提示输入文件名以将校准数据写入。

----------  1/10 -----------
  144.076370, 291.613403
  144.456818, 252.336823
  144.749252, 212.604477
  145.076935, 172.563477
  145.322845, 131.888062
  176.117798, 291.802124
  176.576157, 253.243393
  177.129333, 214.239731
  177.479813, 174.552658
  178.071030, 134.636795
  207.178284, 292.123047
  207.633133, 254.058655
  208.349854, 215.455887
  209.010834, 176.445145
  209.593765, 137.104828
  237.140656, 292.605072
  237.880585, 254.845963
  238.714752, 216.903198
  239.449921, 178.267014
  240.394409, 139.394958
  266.489899, 292.999084
  267.367889, 255.726318
  268.252960, 218.109665
  269.356354, 179.871567
  270.283875, 141.492859
  295.249390, 293.412689
  296.281433, 256.571411
  297.401459, 219.327545
  298.428589, 181.590149
  299.542358, 143.624557
  323.362274, 293.692261
  324.510162, 257.355408
  325.676300, 220.461243
  326.922394, 183.278748
  328.191101, 145.824615
----------  1/10 -----------
----------  2/10 -----------
  148.050690, 293.106384
  148.414490, 253.998062
  148.774414, 214.468643
  149.182388, 174.529022
  149.467361, 134.103973
  179.731491, 293.450256
  180.367905, 254.884293
  181.045914, 216.114410
  181.443024, 176.569839
  182.089340, 136.724365
  210.619583, 293.681030
  211.286148, 255.776764
  212.024734, 217.376785
  212.694183, 178.501968
  213.473358, 139.250153
  240.466492, 294.313446
  241.377625, 256.627411
  242.251205, 218.769958
  243.143188, 180.262177
  244.110855, 141.500137
  269.722961, 294.706543
  270.634094, 257.539307
  271.625610, 219.951859
  272.701599, 181.906219
  273.792236, 143.649017
  298.386902, 295.147797
  299.474823, 258.397278
  300.615479, 221.248398
  301.765320, 183.569580
  303.005432, 145.761093
  326.351868, 295.436584
  327.585724, 259.213715
  328.827087, 222.433777
  330.226166, 185.355087
  331.472870, 148.060959
----------  2/10 -----------
----------  3/10 -----------
  147.498947, 293.119263
  147.883179, 254.019272
  148.415573, 214.486771
  148.684967, 174.593918
  149.091690, 134.227646
  179.455032, 293.466339
  180.003616, 254.865768
  180.576416, 216.057159
  181.121155, 176.579559
  181.654922, 136.787933
  210.369919, 293.653381
  210.938843, 255.717880
  211.682419, 217.324966
  212.478592, 178.483063
  213.229279, 139.289459
  240.310745, 294.277191
  241.166946, 256.605560
  241.967392, 218.694977
  242.799835, 180.276917
  243.800751, 141.530243
  269.590637, 294.632385
  270.537109, 257.496490
  271.493378, 219.894333
  272.571198, 181.887146
  273.624817, 143.653000
  298.324127, 295.077576
  299.415924, 258.383240
  300.550629, 221.200409
  301.643951, 183.544464
  302.827118, 145.762772
  326.410156, 295.375397
  327.580933, 259.050964
  328.829865, 222.317810
  330.214905, 185.311523
  331.428741, 148.052521
----------  3/10 -----------
----------  4/10 -----------
  147.404877, 292.467773
  147.736572, 253.368301
  148.236679, 213.789017
  148.441345, 173.935043
  148.671219, 133.478012
  179.276840, 292.780884
  179.672180, 254.264832
  180.290619, 215.400833
  180.687347, 175.953705
  181.322006, 136.193863
  210.126740, 292.999237
  210.621307, 255.120209
  211.358810, 216.615921
  212.091476, 177.769547
  212.661774, 138.536850
  239.899918, 293.527222
  240.645935, 255.876511
  241.574982, 218.052917
  242.362076, 179.542572
  243.325027, 140.811127
  269.256470, 293.898315
  270.123260, 256.769836
  270.922729, 219.241013
  272.155121, 181.226852
  273.086029, 142.884735
  297.736908, 294.322235
  298.860382, 257.531799
  299.983643, 220.436447
  301.072510, 182.765381
  302.269379, 145.114380
  325.769409, 294.554260
  326.972412, 258.306488
  328.251434, 221.544556
  329.473083, 184.465958
  330.658691, 147.230652
----------  4/10 -----------
----------  5/10 -----------
  149.260559, 295.517792
  149.680573, 256.267395
  150.159592, 216.470856
  150.498886, 176.421814
  150.727448, 135.735687
  181.272278, 295.736420
  181.683975, 257.108704
  182.386627, 218.051971
  182.861603, 178.471375
  183.461609, 138.514038
  212.284485, 296.009369
  212.822861, 258.031555
  213.537674, 219.377121
  214.314728, 180.381744
  215.019836, 140.910797
  242.207825, 296.674042
  243.067505, 258.802368
  243.884872, 220.825027
  244.728394, 182.168182
  245.730469, 143.229156
  271.527985, 297.018860
  272.501251, 259.732147
  273.467896, 222.035095
  274.538910, 183.766388
  275.613922, 145.410767
  300.264648, 297.455322
  301.423309, 260.590332
  302.556732, 223.312790
  303.720428, 185.528992
  304.992432, 147.563705
  328.376648, 297.749695
  329.621216, 261.395416
  330.898895, 224.442474
  332.314117, 187.303024
  333.519836, 149.811874
----------  5/10 -----------
----------  6/10 -----------
  149.159988, 295.321747
  149.585617, 256.158905
  149.873108, 216.471313
  150.297806, 176.431381
  150.500092, 135.795685
  181.170990, 295.593689
  181.581512, 256.900909
  182.204208, 218.002502
  182.594162, 178.483704
  183.248322, 138.538803
  212.116318, 295.739594
  212.607574, 257.781738
  213.316269, 219.311081
  214.063004, 180.340515
  214.635437, 140.891129
  242.012604, 296.343536
  242.717697, 258.618134
  243.624008, 220.643448
  244.452728, 182.115707
  245.478226, 143.183472
  271.336731, 296.648834
  272.284363, 259.488495
  273.227905, 221.772537
  274.285828, 183.703171
  275.324341, 145.379120
  299.914551, 297.004242
  301.153778, 260.285858
  302.248138, 223.029572
  303.402344, 185.380173
  304.638855, 147.489197
  328.039948, 297.293610
  329.331451, 260.970245
  330.543579, 224.221283
  331.841553, 186.968338
  333.194031, 149.637436
----------  6/10 -----------
----------  7/10 -----------
  150.563599, 298.052155
  150.982834, 258.731842
  151.315750, 219.051651
  151.510208, 178.917633
  151.699280, 138.236862
  182.510666, 298.137787
  183.089264, 259.407410
  183.537567, 220.420563
  184.025070, 180.752304
  184.497925, 140.661209
  213.457581, 298.230042
  214.076172, 260.262238
  214.658585, 221.530624
  215.416733, 182.540192
  216.194412, 143.064957
  243.388336, 298.569550
  244.225113, 260.911835
  245.033157, 222.834137
  245.904953, 184.209778
  246.816574, 145.269211
  272.611053, 298.754944
  273.557190, 261.675568
  274.515076, 223.979874
  275.591614, 185.767700
  276.716125, 147.364685
  301.205139, 299.086914
  302.349670, 262.412720
  303.540985, 225.154495
  304.681335, 187.460251
  305.999176, 149.443176
  329.153198, 299.163391
  330.443207, 262.926086
  331.737701, 226.206818
  333.157684, 189.025238
  334.412323, 151.548965
----------  7/10 -----------
----------  8/10 -----------
  151.386826, 294.299194
  151.580322, 255.392044
  151.692703, 215.862106
  151.815140, 176.035858
  151.970261, 135.604233
  183.088547, 294.289612
  183.438126, 255.778519
  183.712326, 217.134323
  184.126663, 177.725403
  184.421524, 137.993500
  213.723038, 294.178436
  214.250641, 256.458130
  214.669434, 218.062439
  215.307709, 179.388107
  215.763123, 140.171814
  243.389938, 294.361206
  244.057465, 256.937225
  244.671021, 219.130997
  245.450760, 180.824646
  246.303833, 142.256790
  272.431610, 294.434021
  273.238525, 257.566101
  274.031647, 220.124283
  274.956787, 182.347549
  275.875671, 144.089508
  300.624603, 294.461456
  301.686798, 258.043091
  302.702820, 221.104492
  303.708984, 183.713104
  304.807953, 146.010620
  328.426270, 294.446381
  329.536926, 258.488098
  330.676819, 222.027298
  331.833008, 185.222794
  333.037354, 148.000397
----------  8/10 -----------
----------  9/10 -----------
  151.999924, 294.519348
  152.191147, 255.657196
  152.285187, 216.259827
  152.410339, 176.424194
  152.390259, 135.935760
  183.549072, 294.504761
  183.914734, 256.102875
  184.299225, 217.403717
  184.540085, 178.166611
  184.903809, 138.382050
  214.302765, 294.406921
  214.661896, 256.676575
  215.257401, 218.326523
  215.712219, 179.654877
  216.278931, 140.450974
  243.845139, 294.565460
  244.525909, 257.249298
  245.275208, 219.468231
  245.955780, 181.214432
  246.703430, 142.514359
  272.943512, 294.647400
  273.661194, 257.793854
  274.527283, 220.410416
  275.469116, 182.571045
  276.409088, 144.383026
  301.287018, 294.691528
  302.285461, 258.353577
  303.300293, 221.358780
  304.279999, 184.043228
  305.413788, 146.322037
  328.908569, 294.644348
  330.155701, 258.706512
  331.308502, 222.317932
  332.426880, 185.446381
  333.531494, 148.306839
----------  9/10 -----------
---------- 10/10 -----------
  149.210327, 289.635864
  149.338776, 251.056442
  149.413773, 211.706299
  149.385117, 172.212769
  149.482101, 131.905930
  180.753555, 289.658966
  181.040939, 251.403183
  181.329803, 212.928970
  181.523880, 173.800201
  181.844574, 134.361816
  211.363098, 289.444244
  211.677399, 251.987045
  212.160568, 213.758392
  212.561478, 175.360641
  213.098114, 136.343353
  240.770401, 289.538788
  241.449463, 252.404922
  242.134201, 214.841476
  242.645782, 176.692551
  243.456573, 138.395477
  269.777252, 289.543457
  270.472992, 252.844559
  271.232819, 215.638458
  272.097961, 178.133057
  272.891510, 140.173141
  298.108704, 289.566620
  298.939056, 253.301559
  299.839081, 216.539093
  300.722076, 179.471649
  301.731506, 141.940186
  325.625427, 289.484955
  326.654572, 253.645508
  327.735352, 217.354614
  328.799744, 180.691162
  329.765839, 143.824707
---------- 10/10 -----------
--------------------------------------
SIZE = 640, 480
Distortion factor: k1=-0.1139601320, k2=0.4718702137, p1=-0.0025231263, p2=0.0003442638
                  fx=528.066284, fy=687.449524, x0=353.831116, y0=237.499893, s=0.937337
563.36860 0.00000 353.83112 0.00000
0.00000 733.40694 237.49989 0.00000
0.00000 0.00000 1.00000 0.00000
--------------------------------------
Err[ 1]: 0.076778[pixel]
Err[ 2]: 0.080084[pixel]
Err[ 3]: 0.119460[pixel]
Err[ 4]: 0.078608[pixel]
Err[ 5]: 0.083900[pixel]
Err[ 6]: 0.084490[pixel]
Err[ 7]: 0.082097[pixel]
Err[ 8]: 0.081740[pixel]
Err[ 9]: 0.074089[pixel]
Err[10]: 0.090010[pixel]
Filename[camera_para.dat]:

e 、保存数据:

如果校准数据良好,每个图像中的估计误差应该非常低:小于1像素。大于2像素表示校准差,应放弃并重新开始。

此时,按键盘上的返回键或Enter键将数据保存在名为“camera_para.dat”文件。

f、其他选项:

Options:
  --pattRatio f: Specify the proportion of the marker width/height, occupied
             by the marker pattern. Range (0.0 - 1.0) (not inclusive).
             (I.e. 1.0 - 2*borderSize). Default value is 0.5.
  --borderSize f: DEPRECATED specify the width of the pattern border, as a
             percentage of the marker width. Range (0.0 - 0.5) (not inclusive).
             (I.e. (1.0 - pattRatio)/2). Default value is 0.25.
  -border=f: Alternate syntax for --borderSize f.
  --cpara <\camera parameter file for the camera>
  -cpara=<\camera parameter file for the camera>
  --vconf <\video parameter for the camera>
  --pattSize n: Specify the number of rows and columns in the pattern space
             for template (pictorial) markers.
             Default value 16 (required for compatibility with ARToolKit prior
             to version 5.2). Range is [16, 64] (inclusive).
  -h -help --help: show this message

二、生成识别图片

打开网页:marker

a、上传你的图片

b、获取生成的标记图像

c、下载包含图像元素的代码(此步骤用于其他,可忽略)

三、训练标记图片 生成hiro文件

a、键入./mk_patt命令打开相机

b、将相机直接对准你的标记

尽量让标记在屏幕上显示成矩形,并填满相机的视图。如果已经识别出标记,会有红色和绿色的线标出你的标记。

c、生成文件

让红色标记在你屏幕的左上角开始对其铺面屏幕,然后按鼠标左键(对于左撇子,你可能需要配置你的鼠标右键为你的主键)。接着捕获图像,并且,你会在终端窗口中会看到提示:

Enter filename:

键入你的文件位置和文件名保存到本地。

e、在训练标记(例如标记边框的大小)时,你可以自定义选项。使用–help选项得到帮助。

配置选项:./mk_patt (options)

                (not inclusive).
-border=f: specify the width of the pattern border, as a percentage
           of the marker width. Range (0.0 - 0.5) (not inclusive).
--cpara <\camera parameter file for the camera>
-cpara=<\camera parameter file for the camera>
--vconf <\video parameter for the camera>
-h -help --help: show this message

所有文件都已生成好。

Have Enjoy. ️️️️:-)


发表评论

您的电子邮箱地址不会被公开。