def bundlerChain(imagePath): # PMVS path pmvsPath = os.path.join(imagePath,"pmvs") # build chain imageSource = Sources.ImageSource(imagePath, "jpg") sift = FeatureExtraction.Sift(imageSource, False, "SiftHess") keyMatch = FeatureMatch.KeyMatch(sift, False, "KeyMatchFull") bundler = BundleAdjustment.Bundler([keyMatch, imageSource], forceRun=True) radialUndistort = Cluster.RadialUndistort([bundler, imageSource], forceRun=True) prepCmvsPmvs = Cluster.PrepCmvsPmvs(radialUndistort, pmvsPath, forceRun=True) # cmvs not build on 32bit Linux yet if (Common.Utility.PlatformName != "Linux32bit"): cmvs = Cluster.CMVS(prepCmvsPmvs, forceRun=True) pmvs = Cluster.PMVS(cmvs, forceRun=True) else: pmvs = Cluster.PMVS(prepCmvsPmvs, forceRun=True) # render chain print Chain.Render(pmvs,"UnitTest-bundlerChain-log.txt")
def sfmChainBuild(chainFilePath, imagePath): # build chain imageSource = Sources.ImageSource(imagePath, "jpg") sift = FeatureExtraction.Sift(imageSource, False, "SiftHess") keyMatch = FeatureMatch.KeyMatch(sift, False, "KeyMatchFull") bundler = BundleAdjustment.Bundler([keyMatch, imageSource]) radialUndistort = Cluster.RadialUndistort([bundler, imageSource]) prepCmvsPmvs = Cluster.PrepCmvsPmvs(radialUndistort, os.path.join(imagePath, "pmvs")) cmvs = Cluster.CMVS(prepCmvsPmvs) pmvs = Cluster.PMVS(cmvs) # persist chain Chain.StageRegistry.Save(chainFilePath)
# Copyright (c) 2012, Adam J. Rossi. All rights reserved. See README for licensing details. import sys, os sys.path.append(os.path.abspath(".")) import Chain # Chain must be imported first, requirement of registry import Sources, FeatureExtraction, FeatureMatch, BundleAdjustment, Cluster, Common # path to images / PMVS imagePath = os.path.abspath("../Datasets/ET") pmvsPath = os.path.join(imagePath, "pmvs") # build chain imageSourceJpg = Sources.ImageSource(imagePath, "jpg") imageSource = Sources.ImageConvert(imageSourceJpg, imagePath, "pgm") asift = FeatureExtraction.ASIFT(imageSource) keyMatch = FeatureMatch.ASIFTMatch(asift) bundler = BundleAdjustment.Bundler([keyMatch, imageSource]) radialUndistort = Cluster.RadialUndistort([bundler, imageSourceJpg]) prepCmvsPmvs = Cluster.PrepCmvsPmvs(radialUndistort, pmvsPath) cmvs = Cluster.CMVS(prepCmvsPmvs) pmvs = Cluster.PMVS(cmvs) # render chain print Chain.Render(pmvs, "asift.txt")