Exemplo n.º 1
0
def sfmChainRestoreRender(chainFilePath):

    # load the sfm chain
    headStages, tailStages = Chain.StageRegistry.Load(chainFilePath)

    # render the tail stage (pmvs)
    print Chain.Render(tailStages[0], "persistence.txt")
Exemplo n.º 2
0
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")
Exemplo n.º 3
0
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")
Exemplo n.º 4
0
    def renderChain2(self):
        self.statusBox.clear()

        if (not self.__visualizationsInitialized):

            # get all tail stages, build "force run" map
            tails = []
            forceRuns = {}
            for stage in Chain.StageRegistry.registry.GetStageInstances():
                if (len(stage.GetOutputStages()) == 0): tails.append(stage)
                if ("Force Run" in stage.GetPropertyMap().keys()):
                    forceRuns[stage] = stage.GetProperty("Force Run")

            try:
                # render once with the chain state as the user defined it
                Chain.Render(tails)

            except:
                pass

            finally:
                # set all force runs to False as image views are initialized
                for stage in forceRuns.keys():
                    stage.SetProperty("Force Run", False)

                self.initializeVisualizations()
                self.__visualizationsInitialized = True

                for vis in self.__visualizations:
                    try:
                        vis.refresh()
                    except:
                        pass

                # revert force runs
                for stage, fr in forceRuns.iteritems():
                    stage.SetProperty("Force Run", fr)

        else:
            #for stage in self.__stages: stage.Reset()

            for vis in self.__visualizations:
                try:
                    vis.refresh()
                except:
                    pass
Exemplo n.º 5
0
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")
Exemplo n.º 6
0
    def renderChain(self):
        self.statusBox.clear()

        tails = []
        for stage in Chain.StageRegistry.registry.GetStageInstances():
            if (len(stage.GetOutputStages()) == 0): tails.append(stage)
        try:
            Chain.Render(tails)
        except:
            pass

        if (not self.__visualizationsInitialized):
            self.initializeVisualizations()
            self.__visualizationsInitialized = True

        for vis in self.__visualizations:
            try:
                vis.refresh()
            except:
                pass

        for pe in self.__propertyEditors.values():
            pe.SetProperties()
Exemplo n.º 7
0
# 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")
Exemplo n.º 8
0
 def performRender(self, stageObject):
     print
     print Chain.Render(stageObject,"log.txt")
            
            self._properties["Prefix Name"] = prefixName


    def GetOutputImagePath(self, inputImagePath):

        # construct the output image path, including the prefix name
        return os.path.join(self._properties["Output Image Path"],
                            self._properties["Prefix Name"] + 
                            os.path.splitext(os.path.basename(inputImagePath))[0] +
                            "."+self._properties["Image Extension"])
    
    def ProcessImage(self, inputImagePath, outputImagePath):

        # copy the input to output
        shutil.copy(inputImagePath, outputImagePath)


#################################################################################
        
# input/output image path
imagePath = os.path.abspath("../Datasets/ET")
imagePathOut = os.path.join(imagePath, "test")
Common.Utility.MakeDir(imagePathOut)

imageSource = Sources.ImageSource(imagePath, "jpg")

imageCopy = CopyImages(imageSource, "test-", imagePathOut, "jpg")

print Chain.Render(imageCopy)
Exemplo n.º 10
0
# 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")
Exemplo n.º 11
0
# 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
import Sources, OpenCV

imagePath = os.path.abspath("../Datasets/ET")
imageSource = Sources.ImageSource(imagePath, "jpg")

fd = OpenCV.FeatureDetector(imageSource, forceRun=True)

fm = OpenCV.FeatureMatcher(fd,
                           "BruteForce",
                           os.path.join(imagePath, "matches.txt"),
                           forceRun=True)

print(Chain.Render(fm, 'openCV.txt'))
Exemplo n.º 12
0
def imageConvertChain(imagePath):
    
    imageSource = Sources.ImageSource(imagePath, "jpg")
    imageConvert = Sources.ImageConvert(imageSource, imagePath, "pgm")
    print Chain.Render(imageConvert,"UnitTest-imageConvertChain-log.txt")
Exemplo n.º 13
0
# 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, OpenCV

# path to images / PMVS
imagePath = os.path.abspath("../Datasets/ET")
pmvsPath = os.path.join(imagePath, "pmvs")

# build chain
imageSource = Sources.ImageSource(imagePath, "jpg")
sift = OpenCV.FeatureDetector(imageSource)
keyMatch = OpenCV.FeatureMatcher(sift)
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, "sfmOpenCV.txt")
Exemplo n.º 14
0
# 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")