昨天立了flag,今天要学SfM过程,大概看了看SfM的各个文件目录,build&make出来的linux-release-x86大概叫这个名字的文件夹里面有很多可执行文件,直接根据文档里给的参数跑就可以,要搞源码的话实在是搞不起,太复杂,太庞大了。下面的代码是从他给出的easy to use的python脚本中截取的核心代码,注释的也很赞,清晰明确。
SfM global pipeline代码1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31print ("1. Intrinsics analysis")
pIntrisics = subprocess.Popen( [os.path.join(OPENMVG_SFM_BIN, "openMVG_main_SfMInit_ImageListing"), "-i", input_dir, "-o", matches_dir, "-d", camera_file_params] )
pIntrisics.wait()
print ("2. Compute features")
pFeatures = subprocess.Popen( [os.path.join(OPENMVG_SFM_BIN, "openMVG_main_ComputeFeatures"), "-i", matches_dir+"/sfm_data.json", "-o", matches_dir, "-m", "SIFT"] )
pFeatures.wait()
print ("3. Compute matches")
pMatches = subprocess.Popen( [os.path.join(OPENMVG_SFM_BIN, "openMVG_main_ComputeMatches"), "-i", matches_dir+"/sfm_data.json", "-o", matches_dir, "-g", "e"] )
pMatches.wait()