其他分享
首页 > 其他分享> > OpenMVG运行tutorial_demo.py错误解决

OpenMVG运行tutorial_demo.py错误解决

作者:互联网

CMake编译好OpenMVG然后运行tutorial_demo.py,报错如下:

CleanGraph_KeepLargestBiEdge_Nodes():: => connected Component: 0
Invalid input image graph for global SfM
5. Colorize Structure

The input SfM_Data file "D:\OpenCV_SFM_Dependency\openMVG\build\software\SfM\tutorial_out\reconstruction_global/sfm_data.bin" cannot be read.
4. Structure from Known Poses (robust triangulation)
Compute Structure from the provided poses

The input SfM_Data file "D:\OpenCV_SFM_Dependency\openMVG\build\software\SfM\tutorial_out\reconstruction_global/sfm_data.bin" cannot be read.

问题是我们没有设置相机焦距参数,需要修改一下tutorial_demo.py的这部分代码:

修改前:

pIntrisics = subprocess.Popen( [os.path.join(OPENMVG_SFM_BIN, "openMVG_main_SfMInit_ImageListing"),
                                 "-i", input_dir, "-o", matches_dir, "-d", camera_file_params, "-c", "3"] )

修改后:

pIntrisics = subprocess.Popen( [os.path.join(OPENMVG_SFM_BIN, "openMVG_main_SfMInit_ImageListing"), "-i", input_dir,\
                                "-o", matches_dir, "-d", camera_file_params, "-f", "1228.8"]);

注意这里焦距f的设置github说明 f = max(Width, Height) * 1.2,也就是图像宽高中的最大值乘以1.2,我的图像宽高是1024*768,

所以1024 * 1.2 = 1228.8

更改之后,设置直接的重建图片路径,就可以生成sfm_data.bin,接下来就参考这篇文章继续往下做吧https://blog.csdn.net/X_kh_2001/article/details/83690094

https://github.com/cdcseacave/openMVS/wiki/Usage 

标签:OpenMVG,demo,py,SFM,SfM,dir,openMVG,input,tutorial
来源: https://blog.51cto.com/u_14009161/2896572