天天看點

opencv提供的帶參數例程

     如果僅僅是簡單的拼接,可以采用stitching.cpp就差不多了;但是如果采用stitching_detailed.cpp的話,首先要解決的就是"編譯問題",而後解決的是分析不同參數下的拼接結果和比對效果;最後是能夠了解一些原理。

     OK,曆經一些調試,編譯成功,首先看一下有哪些參數可以調整。其實光靠這個就可以寫一個簡單的帶調整的界面了。

F:\06.項目項目\opencv拼接\imageStitching\imageStitching>imageStitching.exe

Rotation model images stitcher.

stitching_detailed img1 img2 [...imgN] [flags]

Flags:

--preview

      Run stitching in the preview mode. Works faster than usual mode,

      but output image will have lower resolution.

  --try_gpu (yes|no)

      Try to use GPU. The default value is 'no'. All default values

      are for CPU mode.

Motion Estimation Flags:

  --work_megapix <float>

      Resolution for image registration step. The default is 0.6 Mpx.

  --features (surf|orb)

      Type of features used for images matching. The default is surf.

  --match_conf <float>

      Confidence for feature matching step. The default is 0.65 for surf and 0.3 for orb.  這個我可能會單獨配置

  --conf_thresh <float>

      Threshold for two images are from the same panorama confidence.

      The default is 1.0.

  --ba (reproj|ray)

      Bundle adjustment cost function. The default is ray.

  --ba_refine_mask (mask)

      Set refinement mask for bundle adjustment. It looks like 'x_xxx',

      where 'x' means refine respective parameter and '_' means don't

      refine one, and has the following format:

      <fx><skew><ppx><aspect><ppy>. The default mask is 'xxxxx'. If bundle

      adjustment doesn't support estimation of selected parameter then

      the respective flag is ignored.

  --wave_correct (no|horiz|vert)

      Perform wave effect correction. The default is 'horiz'.

  --save_graph <file_name>

      Save matches graph represented in DOT language to <file_name> file.

      Labels description: Nm is number of matches, Ni is number of inliers,

      C is confidence.

Compositing Flags:

  --warp (plane|cylindrical|spherical|fisheye|stereographic|compressedPlaneA2B1|

compressedPlaneA1.5B1|compressedPlanePortraitA2B1|compressedPlanePortraitA1.5B1|

paniniA2B1|paniniA1.5B1|paniniPortraitA2B1|paniniPortraitA1.5B1|mercator|transve

rseMercator)

      Warp surface type. The default is 'spherical'.

  --seam_megapix <float>

      Resolution for seam estimation step. The default is 0.1 Mpx.

  --seam (no|voronoi|gc_color|gc_colorgrad)

      Seam estimation method. The default is 'gc_color'.

  --compose_megapix <float>

      Resolution for compositing step. Use -1 for original resolution.

      The default is -1.

  --expos_comp (no|gain|gain_blocks)

      Exposure compensation method. The default is 'gain_blocks'.

  --blend (no|feather|multiband)

      Blending method. The default is 'multiband'.

  --blend_strength <float>

      Blending strength from [0,100] range. The default is 5.

  --output <result_img>

      The default is 'result.jpg'.

測試圖檔:

第一組:

opencv提供的帶參數例程
opencv提供的帶參數例程
opencv提供的帶參數例程

--全部預設參數,80秒,結果

opencv提供的帶參數例程

--preview 約80秒,這個圖檔拼接的不錯,但是時間太長了。

opencv提供的帶參數例程

 --work_megapix <float>是用于尋找的,改為0.1後時間為30秒

opencv提供的帶參數例程

      --features (surf|orb) 改成orb後速度顯著提升

 --match_conf <float>也應該是數值越小比對越快,但是失敗的可能也越大。這個是不斷調整參數的過程。

  --ba (reproj|ray)預設是ray,改為reproj後,速度更快!更快

然後,就是 --warp 這一塊,參數比較多

plane

cylindrical

fisheye

spherical

opencv提供的帶參數例程
來自為知筆記(Wiz)

目前方向:圖像拼接融合、圖像識别

聯系方式:[email protected]

繼續閱讀