def process(self, _edObject=None): """ """ for i in range(2): execPlugin = self.loadPlugin(self.__strControlledPluginThumbnail) xsdin = XSDataInputExecThumbnail() xsdin.setInputArray(self.xsdImages[i]) xsdFile = XSDataFile() xsdFile.setPath(XSDataString(os.path.join(self.getWorkingDirectory(), "image%i.jpg" % self.xsdIdx[i].getValue()))) xsdin.setOutputPath(xsdFile) xsdin.setLevelsColorize(XSDataBoolean(1)) xsdin.setLevelsEqualize(XSDataBoolean(1)) execPlugin.setDataInput(xsdin) execPlugin.connectSUCCESS(self.doSuccessThumb) execPlugin.connectFAILURE(self.doFailureThumb) self.ACThumbnail.addAction(execPlugin) self.ACThumbnail.execute() while len(self.xsdThumb) < 2: time.sleep(1) for oneImage in self.xsdThumb: execPlugin = self.loadPlugin(self.__strControlledPluginSift) xsdin = XSDataInputSiftDescriptor() xsdin.setImage(oneImage) execPlugin.setDataInput(xsdin) execPlugin.connectSUCCESS(self.doSuccessSift) execPlugin.connectFAILURE(self.doFailureSift) self.ACSift.addAction(execPlugin) self.ACSift.execute() # # else: # strError = "There are only %s images in self.xsdThumb" % len(self.xsdThumb) # EDVerbose.ERROR(strError) # self.setFailure() # raise RuntimeError(strError) ################################################################################ # This should be executed only after the Sift actions cluster finishes ################################################################################ while len(self.xsdKeys) < 2: time.sleep(1) execPlugin = self.loadPlugin(self.__strControlledPluginAutopano) xsdin = XSDataInputMeasureOffsetSift() xsdin.setDescriptorFile(self.xsdKeys) execPlugin.setDataInput(xsdin) execPlugin.connectSUCCESS(self.doSuccessAutopano) execPlugin.connectFAILURE(self.doFailureAutopano) execPlugin.executeSynchronous()
def fileName2xml(filename): """Here we create the XML string to be passed to the EDNA plugin from the input filename This can / should be modified by the final user @param filename: full path of the input file @type filename: python string representing the path @rtype: XML string @return: python string """ if filename.endswith(".jpg"): xm = None else: upperDir = os.path.dirname(os.path.dirname(filename)) if not os.path.isdir(os.path.join(upperDir, "Thumbnail")): os.makedirs(os.path.join(upperDir, "Thumbnail"), int("775", 8)) destinationPath = os.path.join(upperDir, "Thumbnail") xsd = XSDataInputExecThumbnail() xsdFile = XSDataFile() xsdFile.setPath(XSDataString(filename)) xsd.setInputImagePath(xsdFile) xsdPath = XSDataFile() xsdPath.setPath(XSDataString(destinationPath)) xsd.setOutputPath(xsdPath) # xsd.setLevelsColorize(XSDataBoolean(True)) # xsd.setLevelsNormalize(XSDataBoolean(True)) xsd.setLevelsEqualize(XSDataBoolean(True)) # xsd.setLevelsGamma(XSDataDouble(gamma)) xsd.setLevelsMin(XSDataDouble(0.0)) xsdMax = XSDataDoubleWithUnit() xsdMax.setValue(99.9) xsdMax.setUnit(XSDataString("""%""")) xsd.setLevelsMax(xsdMax) # xsd.setLevelsAutoContrast(XSDataDouble(1.0)) xsd.setFilterBlur([XSDataInteger(5)]) xsd.setFilterDilatation([XSDataInteger(10)]) #xsd.setCropBorders(XSDataInteger(), XSDataInteger()) xsd.setLevelsInvert(XSDataBoolean(True)) xsd.setThumbHeight(XSDataInteger(256)) xsd.setThumbWidth(XSDataInteger(256)) xml = xsd.marshal() return xml
def fileName2xml(filename): """Here we create the XML string to be passed to the EDNA plugin from the input filename This can / should be modified by the final user @param filename: full path of the input file @type filename: python string representing the path @rtype: XML string @return: python string """ if filename.endswith(".jpg"): xm = None else: upperDir = os.path.dirname(os.path.dirname(filename)) if not os.path.isdir(os.path.join(upperDir, "Thumbnail")): os.makedirs(os.path.join(upperDir, "Thumbnail"), int("775", 8)) destinationPath = os.path.join(upperDir, "Thumbnail") xsd = XSDataInputExecThumbnail() xsdFile = XSDataFile() xsdFile.setPath(XSDataString(filename)) xsd.setInputImagePath(xsdFile) xsdPath = XSDataFile() xsdPath.setPath(XSDataString(destinationPath)) xsd.setOutputPath(xsdPath) # xsd.setLevelsColorize(XSDataBoolean(True)) # xsd.setLevelsNormalize(XSDataBoolean(True)) xsd.setLevelsEqualize(XSDataBoolean(True)) # xsd.setLevelsGamma(XSDataDouble(gamma)) xsd.setLevelsMin(XSDataDouble(0.0)) xsdMax = XSDataDoubleWithUnit() xsdMax.setValue(99.9) xsdMax.setUnit(XSDataString("""%""")) xsd.setLevelsMax(xsdMax) # xsd.setLevelsAutoContrast(XSDataDouble(1.0)) xsd.setFilterBlur([XSDataInteger(5)]) xsd.setFilterDilatation([XSDataInteger(10)]) # xsd.setCropBorders(XSDataInteger(), XSDataInteger()) xsd.setLevelsInvert(XSDataBoolean(True)) xsd.setThumbHeight(XSDataInteger(256)) xsd.setThumbWidth(XSDataInteger(256)) xml = xsd.marshal() return xml