def keymatchChains(imagePath): # KeyMatchFull, KeyMatchGPU imageSource = Sources.ImageSource(imagePath, "pgm") sift = FeatureExtraction.Sift(imageSource, False, "SiftHess") keyMatch = FeatureMatch.KeyMatch(sift, True, "KeyMatchFull", forceRun=True) print Chain.Render(keyMatch,"UnitTest-keymatchChains-KeyMatchFull-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)
def siftChains(imagePath): #SiftWin32, SiftHess, SiftGPU, VLFeat imageSource = Sources.ImageSource(imagePath, "pgm") sift = FeatureExtraction.Sift(imageSource, False, "SiftWin32", forceRun=True) # SiftWin32 only on windows if (Common.Utility.OSName=="Windows"): print Chain.Render(sift,"UnitTest-siftChains-SiftWin32-log.txt") sift.SetProperty("Sift Method", "VLFeat") print Chain.Render(sift,"UnitTest-siftChains-VLFeat-log.txt") # daisy only on windows (note: this should not be the last test, as the descriptors are for ROIs) if (Common.Utility.OSName=="Windows"): imageSource = Sources.ImageSource(imagePath, "jpg") daisy = FeatureExtraction.Daisy(imageSource, False, roi="0,0,50,50", forceRun=True) print Chain.Render(daisy,"UnitTest-siftChains-daisy-log.txt") sift.SetProperty("Sift Method", "SiftHess") print Chain.Render(sift,"UnitTest-siftChains-SiftHess-log.txt")
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")
# 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, Common # path to images imagePath = os.path.abspath("../Datasets/ET") # build chain imageSource = Sources.ImageSource(imagePath, "jpg") # insert tap point stage with print function tap = Common.TapPoint( imageSource, {Common.sfmImages: lambda x: "Image Path: " + x.GetPath()}) # insert tap point stage without print function tap = Common.TapPoint(tap) sift = FeatureExtraction.Sift(tap, False, "SiftHess") # render chain print Chain.Render(sift, "tapPoint.txt")
# Copyright (c) 2014, 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 # path to images / PMVS imagePath = os.path.abspath("../Datasets/ET") 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]) radialUndistort = Cluster.RadialUndistort([bundler, imageSource]) prepCmvsPmvs = Cluster.PrepCmvsPmvs(radialUndistort, pmvsPath) cmvs = Cluster.CMVS(prepCmvsPmvs) pmvs = Cluster.PMVS(cmvs) # render chain print Chain.Render(pmvs, "sfm.txt")