1. 程式人生 > >opencv自帶的blobtrack學習

opencv自帶的blobtrack學習

使用opencv自帶的原始碼編譯,執行命令列引數

簡單的:blobtrack 1.avi 可以看到檢測、跟蹤效果

生成軌跡:blobtrack track=a.txt 1.avi

生成跟蹤物體的軌跡,a.txt名字第一個字元必須是字母。a.txt組成:包含了每一個運動物體的出現幀數,ID,位置pos(x,y),大小size(w,h)

%YAML:1.0
a:
   -
      FrameBegin: 24
      VideoObj: a_obj0
   -
      FrameBegin: 33
      VideoObj: a_obj1
   -
      FrameBegin: 63
      VideoObj: a_obj2
a_obj0:
   Pos: [ 6.05657041e-001, 5.49433351e-001, 6.05041265e-001,
       5.70409596e-001, 6.07705355e-001, 5.91034651e-001,
       6.11671090e-001, 6.02965653e-001, 6.15886509e-001,
       6.14506066e-001, 6.21989548e-001, 6.46308124e-001,
       6.26994848e-001, 6.75745428e-001, 6.32889152e-001,
       7.10276842e-001, 6.40805483e-001, 7.71272004e-001,
       6.46168888e-001, 8.07017803e-001, 6.51469529e-001,
       8.37495387e-001, 6.59383953e-001, 8.65432203e-001,
       6.63581371e-001, 8.75175893e-001, 6.69758976e-001,
       8.91787291e-001, 6.72445297e-001, 9.10488307e-001,
       6.81046486e-001, 9.38663960e-001, 6.95377350e-001,
       9.54847693e-001, 6.97156131e-001, 9.98927236e-001,
       7.01714277e-001, 1.03178334e+000, 7.07432032e-001,
       1.06046951e+000 ]
   Size: [ 8.32954347e-002, 1.12898931e-001, 8.36512297e-002,
       1.13237537e-001, 8.43252838e-002, 1.15006931e-001,
       8.50024745e-002, 1.17249757e-001, 8.54693055e-002,
       1.23559617e-001, 8.61918852e-002, 1.30406603e-001,
       8.71349797e-002, 1.36504531e-001, 8.82987082e-002,
       1.44202247e-001, 9.02545974e-002, 1.49170339e-001,
       9.22612920e-002, 1.54534474e-001, 9.46004316e-002,
       1.65623859e-001, 9.71412808e-002, 1.74444407e-001,
       9.99653488e-002, 1.80939898e-001, 1.02629766e-001,
       1.85190767e-001, 1.04809739e-001, 1.86487123e-001,
       1.06407389e-001, 1.84395224e-001, 1.05771519e-001,
       1.80792883e-001, 1.05231509e-001, 1.79656446e-001,
       1.04759827e-001, 1.78663790e-001, 1.04346670e-001,
       1.77794293e-001 ]
a_obj1:
   Pos: [ 4.58485872e-001, 3.32928181e-001, 4.56482500e-001,
       3.42681766e-001, 4.54989642e-001, 3.49126756e-001,
       4.53084201e-001, 3.52397949e-001, 4.50817585e-001,
       3.67786169e-001, 4.48681921e-001, 3.81645054e-001,
       4.47126299e-001, 3.89336109e-001, 4.46003586e-001,
       3.96698028e-001, 4.42093849e-001, 4.15179133e-001,
       4.39698756e-001, 4.27043855e-001, 4.37610835e-001,
       4.41425294e-001, 4.34258044e-001, 4.65323180e-001,
       4.31634873e-001, 4.77379620e-001, 4.28066999e-001,
       4.97299463e-001, 4.25342530e-001, 5.18363416e-001,
       4.21871990e-001, 5.37050307e-001, 4.18278337e-001,
       5.62143922e-001, 4.13088381e-001, 5.94955802e-001,
       4.09593880e-001, 6.15630448e-001, 4.03840214e-001,
       6.44613087e-001, 3.98307204e-001, 6.88756049e-001,
       3.93275887e-001, 7.25354671e-001, 3.88343394e-001,
       7.68660903e-001, 3.79933625e-001, 8.24072957e-001,
       3.72832060e-001, 8.63406122e-001, 3.66840214e-001,
       8.84093821e-001, 3.62184227e-001, 9.02787924e-001,
       3.56497884e-001, 9.30652261e-001, 3.52623522e-001,
       9.48309004e-001, 3.48044723e-001, 9.82554078e-001,
       3.44887406e-001, 1.00886917e+000, 3.40228349e-001,
       1.03873026e+000 ]
   Size: [ 4.16635126e-002, 8.13770741e-002, 4.18367870e-002,
       8.14338624e-002, 4.21885140e-002, 8.20413828e-002,
       4.23785858e-002, 8.31675306e-002, 4.28189971e-002,
       8.46724510e-002, 4.33257967e-002, 8.59461725e-002,
       4.37454320e-002, 8.71931836e-002, 4.43020426e-002,
       8.86901915e-002, 4.47222181e-002, 9.08788070e-002,
       4.51629385e-002, 9.30351019e-002, 4.57389243e-002,
       9.55310315e-002, 4.65639010e-002, 9.75963548e-002,
       4.73867208e-002, 1.00199662e-001, 4.81609255e-002,
       1.03262223e-001, 4.91934046e-002, 1.07003428e-001,
       5.02257049e-002, 1.10246308e-001, 5.15526123e-002,
       1.14474021e-001, 5.30168116e-002, 1.19318701e-001,
       5.44123985e-002, 1.23825006e-001, 5.59225343e-002,
       1.29735172e-001, 5.81866428e-002, 1.36585131e-001,
       6.05236515e-002, 1.42823458e-001, 6.30393401e-002,
       1.51248693e-001, 6.55165389e-002, 1.60525337e-001,
       6.81361705e-002, 1.68419570e-001, 7.07419068e-002,
       1.74838573e-001, 7.31637478e-002, 1.78003997e-001,
       7.55487978e-002, 1.77357212e-001, 7.75497034e-002,
       1.74634010e-001, 7.84197524e-002, 1.67501092e-001,
       7.74625465e-002, 1.65836930e-001, 7.66119361e-002,
       1.64358094e-001 ]


指定一些引數:blobtrack_sample fg=FG_0s bd:hmin=0.08 bt=CCMSPF  btpp=Kalman bt_corr=PostProcRes btgen=YML track=a.txt btavi=b2.avi fgavi=f2.avi 2.avi

blobtrack.exe

[fg=<fg_name>] fg=FG_0,FG_0s,FG_!  前景檢測方法

[bd=<bd_name>]            

[bt=<bt_name>]  bt=CC,MS1,MS2,CCMSPF,

[btpp=<btpp_name>]  btpp=Kalman,None
          [bt_corr=<bt_corr_way>]    bt_corr = PostProcRes
          [trackgen=<btgen_name>]   btgen=YML,RawTracks
          [track=<track_file_name>]   track =a.txt//軌跡名稱
          [scale=<scale val>]
          [noise=<noise_name>]   No,

Gauss_10, Gauss_20,Salt&Pepper_0.01,Salt&Pepper_0.05

[IVar=<IVar_name>]  No,I+=0.1,I+=1

          [res=<res_file_name>]

[FGTrainFrames=<FGTrainFrames>]
          <yml_file video1 video2 video3>|<avi_file>

    [fg:<引數名1>=<引數值1>] [fg:<引數名2>=<引數值2>]
    [bd:<引數名1>=<引數值1>] [bd:<引數名2>=<引數值2>]
    [bt:<引數名1>=<引數值1>] [bt:<引數名2>=<引數值2>]
    [btgen:<引數名1>=<引數值1>] [btgen:<引數名2>=<引數值2>]
    [btpp:<引數名1>=<引數值1>]   [btpp:<引數名2>=<引數值2>]
    [bta:<引數名1>=<引數值1>]   [bta:<引數名2>=<引數值2>]


fg:alpha1=3.14  bd:hmin=0.08