From 13cc01d64ba8b3d00bcf4e449f945dfd025ad071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20De=20Lillo?= Date: Mon, 17 Jul 2023 11:00:14 +0200 Subject: [PATCH] First implementation --- README.md | 4 + meshroomMicmac/__init__.py | 0 meshroomMicmac/custom/__init__.py | 1 + meshroomMicmac/custom/node.py | 59 +++ meshroomMicmac/micmac/AperiCloud.py | 141 +++++++ meshroomMicmac/micmac/C3DC.py | 127 ++++++ meshroomMicmac/micmac/GCPBascule.py | 115 ++++++ meshroomMicmac/micmac/Martini.py | 102 +++++ meshroomMicmac/micmac/Micmac.py | 64 +++ meshroomMicmac/micmac/Pims2Mnt.py | 133 +++++++ meshroomMicmac/micmac/SaisieMasqQT.py | 55 +++ meshroomMicmac/micmac/SetExif.py | 75 ++++ meshroomMicmac/micmac/Tapas.py | 474 +++++++++++++++++++++++ meshroomMicmac/micmac/TapiocaAll.py | 82 ++++ meshroomMicmac/micmac/TapiocaFile.py | 82 ++++ meshroomMicmac/micmac/TapiocaGeoref.py | 87 +++++ meshroomMicmac/micmac/TapiocaGraph.py | 85 ++++ meshroomMicmac/micmac/TapiocaLine.py | 98 +++++ meshroomMicmac/micmac/TapiocaMulScale.py | 91 +++++ meshroomMicmac/micmac/Tawny.py | 177 +++++++++ meshroomMicmac/micmac/Tequila.py | 143 +++++++ meshroomMicmac/micmac/TiPunch.py | 95 +++++ meshroomMicmac/micmac/__init__.py | 0 scripts/addMicmacNode.py | 346 +++++++++++++++++ 24 files changed, 2636 insertions(+) create mode 100644 README.md create mode 100644 meshroomMicmac/__init__.py create mode 100644 meshroomMicmac/custom/__init__.py create mode 100644 meshroomMicmac/custom/node.py create mode 100644 meshroomMicmac/micmac/AperiCloud.py create mode 100644 meshroomMicmac/micmac/C3DC.py create mode 100644 meshroomMicmac/micmac/GCPBascule.py create mode 100644 meshroomMicmac/micmac/Martini.py create mode 100644 meshroomMicmac/micmac/Micmac.py create mode 100644 meshroomMicmac/micmac/Pims2Mnt.py create mode 100644 meshroomMicmac/micmac/SaisieMasqQT.py create mode 100644 meshroomMicmac/micmac/SetExif.py create mode 100644 meshroomMicmac/micmac/Tapas.py create mode 100644 meshroomMicmac/micmac/TapiocaAll.py create mode 100644 meshroomMicmac/micmac/TapiocaFile.py create mode 100644 meshroomMicmac/micmac/TapiocaGeoref.py create mode 100644 meshroomMicmac/micmac/TapiocaGraph.py create mode 100644 meshroomMicmac/micmac/TapiocaLine.py create mode 100644 meshroomMicmac/micmac/TapiocaMulScale.py create mode 100644 meshroomMicmac/micmac/Tawny.py create mode 100644 meshroomMicmac/micmac/Tequila.py create mode 100644 meshroomMicmac/micmac/TiPunch.py create mode 100644 meshroomMicmac/micmac/__init__.py create mode 100644 scripts/addMicmacNode.py diff --git a/README.md b/README.md new file mode 100644 index 0000000..6d2ba4a --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# Meshroom x Micmac + +Meshroom x Micmac + diff --git a/meshroomMicmac/__init__.py b/meshroomMicmac/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/meshroomMicmac/custom/__init__.py b/meshroomMicmac/custom/__init__.py new file mode 100644 index 0000000..83ad5cb --- /dev/null +++ b/meshroomMicmac/custom/__init__.py @@ -0,0 +1 @@ +"""Package that group up all the core utilities of MRRS: the Inputs and Ouptuts, common geometric operation and utility functions""" \ No newline at end of file diff --git a/meshroomMicmac/custom/node.py b/meshroomMicmac/custom/node.py new file mode 100644 index 0000000..4cbc766 --- /dev/null +++ b/meshroomMicmac/custom/node.py @@ -0,0 +1,59 @@ +from meshroom.core import desc +import re +import psutil +import shlex + +class MicmacNode(desc.CommandLineNode): + category = 'Micmac' + + inputs = [ + desc.File( + name='projectDirectory', + label='Project Directory', + description='Project Directory.', + value="", + group="micmac", + uid=[0], + ), + ] + + def buildCommandLine(self, chunk): + ''' + Fix command line for MicMac + ''' + cmdline = desc.CommandLineNode.buildCommandLine(self, chunk) # build node command line + cmdline = re.sub('(True|False)', lambda m: str(int(m.group(1) == 'True')), cmdline) # use 0 / 1 instead of False / True + cmdline = re.sub('--(\w+)\s', lambda m: '{name}='.format(name=m.group(1)), cmdline) # use "name=value" instead of "--name value" + cmdline = re.sub('(\w+=\"\"\s)', lambda m: '', cmdline) # remove value with empty string (optional parameter) + return cmdline + + def processChunk(self, chunk): + try: + with open(chunk.logFile, 'w') as logF: + cmd = self.buildCommandLine(chunk) + projectDir = chunk.node._cmdVars['projectDirectoryValue'].replace('"','') # get project directory from parameter (and remove quotes) + chunk.status.commandLine = cmd + chunk.saveStatusFile() + print(' - commandLine: {}'.format(cmd)) + print(' - logFile: {}'.format(chunk.logFile)) + print(' - projectDir: {}'.format(projectDir)) + chunk.subprocess = psutil.Popen(shlex.split(cmd), stdout=logF, stderr=logF, cwd=projectDir) # execute in project directory + + # store process static info into the status file + # chunk.status.env = node.proc.environ() + # chunk.status.createTime = node.proc.create_time() + + chunk.statThread.proc = chunk.subprocess + stdout, stderr = chunk.subprocess.communicate() + chunk.subprocess.wait() + + chunk.status.returnCode = chunk.subprocess.returncode + + if chunk.subprocess.returncode != 0: + with open(chunk.logFile, 'r') as logF: + logContent = ''.join(logF.readlines()) + raise RuntimeError('Error on node "{}":\nLog:\n{}'.format(chunk.name, logContent)) + except: + raise + finally: + chunk.subprocess = None \ No newline at end of file diff --git a/meshroomMicmac/micmac/AperiCloud.py b/meshroomMicmac/micmac/AperiCloud.py new file mode 100644 index 0000000..47faea1 --- /dev/null +++ b/meshroomMicmac/micmac/AperiCloud.py @@ -0,0 +1,141 @@ +__version__ = "1.1.1" + +from meshroom.core import desc +from meshroomMicmac.custom import node + +class AperiCloud(node.MicmacNode): + commandLine = 'mm3d AperiCloud {imagePatternValue} {orientationDirValue} {allParams}' + documentation = '''AperiCloud''' + + inputs = [ + desc.File( + name='projectDirectory', + label='Project Directory', + description='Project Directory.', + value="", + group="micmac", + uid=[0], + ), + desc.File( + name='imagePattern', + label='Image Pattern', + description='Image Pattern.', + group='unnamedParams', + value="", + uid=[0], + ), + desc.File( + name='SH', + label='Homol Directory', + description="Homol Directory.", + uid=[0], + value="", + ), + desc.File( + name='orientationDir', + label='Orientation Directory', + description='Orientation directory name.', + group='unnamedParams', + value="", + uid=[0], + ), + desc.BoolParam( + name='ExpTxt', + label='Exp Txt', + description='Tie Point use txt format', + value=False, + uid=[0], + ), + desc.BoolParam( + name='Bin', + label='Bin', + description='PLY in binary mode.', + value=True, + uid=[0], + ), + desc.BoolParam( + name='RGB', + label='RGB', + description='Use RGB image to color points.', + value=True, + uid=[0], + ), + desc.FloatParam( + name='SeuilEc', + label='Seuil Ec', + description='Max residual.', + value=10.0, + range=(0.0, 100.0, 0.1), + uid=[0], + ), + desc.FloatParam( + name='LimBsH', + label='Lim BsH', + description='Limit ratio base to height.', + value=1e-2, + range=(0.0, 100.0, 0.1), + uid=[0], + ), + desc.BoolParam( + name='WithPoints', + label='With Points', + description='Add point cloud.', + value=True, + uid=[0], + ), + desc.BoolParam( + name='CalPerIm', + label='Cal Per Im', + description='Calibration per image was used.', + value=False, + uid=[0], + ), + desc.BoolParam( + name='WithCam', + label='With Cam', + description='Camera representation.', + value=True, + uid=[0], + ), + desc.FloatParam( + name='StepIm', + label='Step Im', + description='if image in camera are wanted, indicate reduction factor.', + value=-1.0, + range=(-1.0, 100.0, 0.1), + uid=[0], + ), + desc.FloatParam( + name='ProfCam', + label='Prof Cam', + description='Size of focal exageration factor for pyramid representing camera.', + value=0.3, + range=(0.0, 100.0, 0.1), + uid=[0], + ), + desc.FloatParam( + name='RabDrBundle', + label='Rab Dr Bundle', + description='Lenght to add in budle drawing.', + value=0.0, + range=(0.0, 100.0, 0.1), + uid=[0], + ), + desc.BoolParam( + name='SavePtsCol', + label='Save Pts Col', + description='Don t store point color element in PLY file to save disk space.', + value=True, + uid=[0], + ), + ] + + outputs = [ + desc.File( + name='Out', + label='Point Cloud', + description='Output PLY point cloud name.', + value='AperiCloud.ply', + uid=[0], + ), + ] diff --git a/meshroomMicmac/micmac/C3DC.py b/meshroomMicmac/micmac/C3DC.py new file mode 100644 index 0000000..15a28d8 --- /dev/null +++ b/meshroomMicmac/micmac/C3DC.py @@ -0,0 +1,127 @@ +__version__ = "1.1.1" + +from meshroom.core import desc +from meshroomMicmac.custom import node + +class C3DC(node.MicmacNode): + commandLine = 'mm3d C3DC {modeValue} {imagePatternValue} {orientationDirValue} {allParams}' + documentation = '''C3DC''' + + inputs = [ + desc.File( + name='projectDirectory', + label='Project Directory', + description='Project Directory.', + value="", + group="micmac", + uid=[0], + ), + desc.File( + name='imagePattern', + label='Image Pattern', + description='Image Pattern.', + value="", + group='unnamedParams', + uid=[0], + ), + desc.File( + name='SH', + label='Homol Directory', + description="Homol Directory.", + uid=[0], + value="", + ), + desc.File( + name='orientationDir', + label='Orientation Directory', + description='Orientation directory name.', + group='unnamedParams', + value='', + uid=[0], + ), + desc.ChoiceParam( + name="mode", + label="Mode", + description="Mode.", + group='unnamedParams', + value="MicMac", + values=["Ground", "Statue", "Forest", "TestIGN", "QuickMac", "MicMac", "BigMac", "MTDTmp"], + exclusive=True, + uid=[0], + ), + desc.StringParam( + name='Masq3D', + label='Masq 3D', + description='3D masq for point selection.', + value="", + uid=[0], + ), + desc.IntParam( + name='SzNorm', + label='Sz Norm', + description='Size of param for normal evaluation (<=0 if none, 2 means 5x5).', + value=2, + range=(-1, 20, 1), + uid=[0], + ), + desc.BoolParam( + name='PlyCoul', + label='Ply Coul', + description='Colour in ply.', + value=True, + uid=[0], + ), + desc.BoolParam( + name='Purge', + label='Purge', + description='Purge result.', + value=True, + uid=[0], + ), + desc.BoolParam( + name='UseGpu', + label='Use Gpu', + description='Use CUDA.', + value=False, + uid=[0], + ), + desc.BoolParam( + name='ExpTxt', + label='Exp Txt', + description='Use txt tie points for determining image pairs.', + value=False, + uid=[0], + ), + desc.BoolParam( + name='Bin', + label='Bin', + description='PLY in binary mode.', + value=True, + uid=[0], + ), + desc.BoolParam( + name='NormByC', + label='Norm By C', + description='Replace normal with camera position in PLY.', + value=False, + uid=[0], + ), + desc.FloatParam( + name='TetaOpt', + label='Teta Opt', + description='For the choice of secondary images: Optimal angle of stereoscopy, in radian.', + value=0.17, + range=(0.0, 7.0, 0.01), + uid=[0], + ), + ] + + outputs = [ + desc.File( + name='Out', + label='Point Cloud', + description='Output PLY point cloud name.', + value='C3DC.ply', + uid=[0], + ), + ] diff --git a/meshroomMicmac/micmac/GCPBascule.py b/meshroomMicmac/micmac/GCPBascule.py new file mode 100644 index 0000000..de3e5be --- /dev/null +++ b/meshroomMicmac/micmac/GCPBascule.py @@ -0,0 +1,115 @@ +__version__ = "1.1.1" + +import sys +from meshroom.core import desc +from meshroomMicmac.custom import node + +class GCPBascule(node.MicmacNode): + commandLine = 'mm3d GCPBascule {imagePatternValue} {orientationInValue} {orientationOutValue} {groundControlPointsFileValue} {imageMeasurementsFileValue} {allParams}' + documentation = 'GCPBascule' + + inputs = [ + desc.File( + name='projectDirectory', + label='Project Directory', + description='Project Directory.', + value="", + group="micmac", + uid=[0], + ), + desc.File( + name='imagePattern', + label='Image Pattern', + description='Image Pattern.', + group='unnamedParams', + value="", + uid=[0], + ), + desc.StringParam( + name='orientationIn', + label='Orientation In', + description="Orientation in", + uid=[0], + value="", + ), + desc.StringParam( + name='orientationOut', + label='Orientation Out', + description="Orientation out", + uid=[0], + value="", + ), + desc.File( + name='groundControlPointsFile', + label='Ground Control Points File', + description="Ground Control Points File", + uid=[0], + value="", + ), + desc.File( + name='imageMeasurementsFile', + label='Image Measurements File', + description="Image Measurements File", + uid=[0], + value="", + ), + desc.BoolParam( + name='L1', + label='L1', + description="L1 minimisation vs L2", + uid=[0], + value=False, + ), + desc.BoolParam( + name='CPI', + label='C P I', + description="when Calib Per Image has to be used", + uid=[0], + value=False, + ), + desc.BoolParam( + name='ShowU', + label='Show U', + description="Show unused point", + uid=[0], + value=True, + ), + desc.BoolParam( + name='ShowD', + label='Show D', + description="Show details", + uid=[0], + value=False, + ), + desc.StringParam( + name='PatNLD', + label='Pat N L D', + description="Pattern for Non linear deformation, with aerial like geometry", + uid=[0], + value="", + ), + desc.BoolParam( + name='NLFR', + label='N L F R', + description="Non Linear : Force True Rot", + uid=[0], + value=True, + ), + desc.BoolParam( + name='NLShow', + label='N L Show', + description="Non Linear : Show Details", + uid=[0], + value=False, + ), + desc.File( + name='ForceSol', + label='Force Sol', + description="To Force Sol from existing solution (xml file)", + uid=[0], + value="", + ), + ] + + outputs = [ + ] diff --git a/meshroomMicmac/micmac/Martini.py b/meshroomMicmac/micmac/Martini.py new file mode 100644 index 0000000..80a18a6 --- /dev/null +++ b/meshroomMicmac/micmac/Martini.py @@ -0,0 +1,102 @@ +__version__ = "1.1.1" + +from meshroom.core import desc +from meshroomMicmac.custom import node + +class Martini(node.MicmacNode): + commandLine = 'mm3d Martini {imagePatternValue} {allParams}' + documentation = '''Martini''' + + inputs = [ + desc.File( + name='projectDirectory', + label='Project Directory', + description='Project Directory.', + value="", + group="micmac", + uid=[0], + ), + desc.File( + name='imagePattern', + label='Image Pattern', + description='Image Pattern.', + group='unnamedParams', + value="", + uid=[0], + ), + desc.BoolParam( + name='Exe', + label='Exe', + description='If false, only print.', + value=True, + uid=[0], + ), + desc.File( + name='OriCalib', + label='Ori Calib', + description='Orientation for calibration.', + value='', + uid=[0], + ), + desc.File( + name='SH', + label='Homol Directory', + description="Homol Directory.", + uid=[0], + value="", + ), + desc.StringParam( + name='ExtName', + label='Ext Name', + description="User's added Prefix.", + value='', + uid=[0], + ), + desc.BoolParam( + name='ExpTxt', + label='Exp Txt', + description='Is Homol in text format?.', + value=False, + uid=[0], + ), + desc.StringParam( + name='ModeNO', + label='Mode NO', + description="Mode (TTK StdNoTTK OnlyHomogr).", + value='Std', + uid=[0], + ), + desc.BoolParam( + name='Debug', + label='Debug', + description='Debug', + value=False, + uid=[0], + ), + desc.BoolParam( + name='AUS', + label='AUS', + description='Accept non symetric homologous point.', + value=True, + uid=[0], + ), + desc.IntParam( + name='QNbPtTrip', + label='Q Nb Pt Trip', + description='Max num of triplets per edge (Quick mode).', + value=8, + range=(1, 20, 1), + uid=[0], + ), + desc.IntParam( + name='NbTrip', + label='Nb Trip', + description='Min num of points to calculate a triplet.', + value=5, + range=(1, 20, 1), + uid=[0], + ), + ] + + outputs = [ + ] diff --git a/meshroomMicmac/micmac/Micmac.py b/meshroomMicmac/micmac/Micmac.py new file mode 100644 index 0000000..b35fa0e --- /dev/null +++ b/meshroomMicmac/micmac/Micmac.py @@ -0,0 +1,64 @@ +__version__ = "1.0" + +from meshroom.core import desc +import os +import shutil +import json + +class Micmac(desc.Node): + category = 'Micmac' + documentation = '''Project node for Micmac pipeline. Copy CameraInit images into the node folder.''' + + inputs = [ + desc.File( + name='input', + label='SfMData', + description='SfMData file.', + value='', + uid=[0], + ), + desc.ChoiceParam( + name='verboseLevel', + label='Verbose Level', + description='Verbosity level (fatal, error, warning, info, debug, trace).', + value='info', + values=['fatal', 'error', 'warning', 'info', 'debug', 'trace'], + exclusive=True, + uid=[], + ), + ] + + outputs = [ + desc.File( + name='projectDirectory', + label='Project Directory', + description='Project Directory.', + group='micmac', + value=os.path.join(desc.Node.internalFolder, 'project'), + uid=[], + ), + ] + + def processChunk(self, chunk): + try: + chunk.logManager.start(chunk.node.verboseLevel.value) + chunk.logger.info("Copy images from input SfMData file") + + projectDir = os.path.normpath(chunk.node.projectDirectory.value).replace('\\', '/') + + chunk.logger.debug('Create output directory: ' + projectDir) + os.makedirs(projectDir, exist_ok=True) + + with open(chunk.node.input.value, 'r', encoding='utf-8', errors='ignore') as f: + data = json.load(f) + + views = [{k: v for k, v in item.items()} for item in data.get("views", [])] + for view in views: + inputPath = view['path'] + outputPath = os.path.normpath(os.path.join(projectDir, os.path.basename(inputPath))).replace('\\', '/') + chunk.logger.debug('Copy of image: ' + inputPath) + shutil.copy2(inputPath, outputPath) + + finally: + chunk.logger.info('Images have been copied in directory: ' + projectDir) + chunk.logManager.end() \ No newline at end of file diff --git a/meshroomMicmac/micmac/Pims2Mnt.py b/meshroomMicmac/micmac/Pims2Mnt.py new file mode 100644 index 0000000..d70c776 --- /dev/null +++ b/meshroomMicmac/micmac/Pims2Mnt.py @@ -0,0 +1,133 @@ +__version__ = "1.1.1" + +import sys +from meshroom.core import desc +from meshroomMicmac.custom import node + +class Pims2Mnt(node.MicmacNode): + commandLine = 'mm3d Pims2Mnt {dirOrPIMValue} {allParams}' + documentation = 'Pims2Mnt' + + inputs = [ + desc.File( + name='projectDirectory', + label='Project Directory', + description='Project Directory.', + value="", + group="micmac", + uid=[0], + ), + desc.File( + name='dirOrPIM', + label='Dir Or PIM-Type', + description="Dir or PIM-Type (QuickMac ....)", + group='unnamedParams', + uid=[0], + value="", + ), + desc.FloatParam( + name='DS', + label='D S', + description="Downscale, Def=1.0", + uid=[0], + value=1.0, + range=(-float('inf'), float('inf'), 0.01), + ), + desc.StringParam( + name='Repere', + label='Repere', + description="Repair (Euclid or Cyl)", + uid=[0], + value="", + ), + desc.BoolParam( + name='DoMnt', + label='Do Mnt', + description="Compute DTM (use false to return only ortho)", + uid=[0], + value=True, + ), + desc.BoolParam( + name='DoOrtho', + label='Do Ortho', + description="Generate ortho photo", + uid=[0], + value=False, + ), + desc.StringParam( + name='MasqImGlob', + label='Masq Im Glob', + description="Global Masq for ortho: if used, give full name of masq (e.g. MasqGlob.tif)", + uid=[0], + value="", + ), + desc.BoolParam( + name='UseTA', + label='Use T A', + description="Use TA as filter when exist", + uid=[0], + value=False, + ), + desc.FloatParam( + name='RI', + label='R I', + description="Resol Im, def=1", + uid=[0], + value=1.0, + range=(0.0, 10.0, 0.01), + ), + desc.FloatParam( + name='SeuilE', + label='Seuil E', + description="Seuil d'etirement des triangle, Def=5", + uid=[0], + value=5.0, + range=(0.0, 100.0, 0.01), + ), + desc.IntParam( + name='ZoomF', + label='Zoom F', + description="ZoomF", + uid=[0], + value=2, + range=(-sys.maxsize, sys.maxsize, 1), + ), + desc.File( + name='DirMTD', + label='Dir M T D', + description="Subdirectory where the temporary results will be stored", + uid=[0], + value="PIMs-TmpMnt/", + ), + desc.File( + name='DirOrtho', + label='Dir Ortho', + description="Subdirectory for ortho images", + uid=[0], + value="PIMs-ORTHO/", + ), + desc.File( + name='DirBasc', + label='Dir Basc', + description="Subdirectory for surface model", + uid=[0], + value="PIMs-TmpBasc/", + ), + desc.StringParam( + name='NameMerge', + label='Name Merge', + description="BaseName of the surface model (*.xml)", + uid=[0], + value="PIMs-Merged.xml", + ), + desc.BoolParam( + name='Debug', + label='Debug', + description="Debug mode", + uid=[0], + value=False, + ), + ] + + outputs = [ + ] diff --git a/meshroomMicmac/micmac/SaisieMasqQT.py b/meshroomMicmac/micmac/SaisieMasqQT.py new file mode 100644 index 0000000..0a18168 --- /dev/null +++ b/meshroomMicmac/micmac/SaisieMasqQT.py @@ -0,0 +1,55 @@ +__version__ = "1.1.1" + +from meshroom.core import desc +from meshroomMicmac.custom import node + +class SaisieMasqQT(node.MicmacNode): + commandLine = 'mm3d SaisieMasqQT {filePathValue} {allParams}' + documentation = '''SaisieMasqQT''' + + inputs = [ + desc.File( + name='projectDirectory', + label='Project Directory', + description='Project Directory.', + value="", + group="micmac", + uid=[0], + ), + desc.File( + name='filePath', + label='File Path', + description='''Path of the file to open (image or PLY or camera XML).''', + group='unnamedParams', + value="", + uid=[0], + ), + desc.GroupAttribute( + name='SzW', + label='Window Size', + description='''Window Size in pixels.''', + joinChar=",", + groupDesc=[ + desc.IntParam(name="x", label="x", description="", value=900, uid=[0], range=(100, 1920, 1)), + desc.IntParam(name="y", label="y", description="", value=700, uid=[0], range=(100, 1080, 1)), + ] + ), + desc.StringParam( + name='Post', + label='File Postfix', + description='''Output file postfix.''', + value="_Masq", + uid=[0], + ), + ] + + outputs = [ + desc.File( + name='output', + label='Output', + description='Output folder', + group='', + value=desc.Node.internalFolder, + uid=[], + ), + ] diff --git a/meshroomMicmac/micmac/SetExif.py b/meshroomMicmac/micmac/SetExif.py new file mode 100644 index 0000000..5501b33 --- /dev/null +++ b/meshroomMicmac/micmac/SetExif.py @@ -0,0 +1,75 @@ +__version__ = "1.1.1" + +from meshroom.core import desc +from meshroomMicmac.custom import node + +class SetExif(node.MicmacNode): + commandLine = 'mm3d SetExif {imagePatternValue} {allParams}' + documentation = '''SetExif''' + + inputs = [ + desc.File( + name='projectDirectory', + label='Project Directory', + description='Project Directory.', + value="", + group="micmac", + uid=[0], + ), + desc.File( + name='imagePattern', + label='Image Pattern', + description='Image Pattern.', + group='unnamedParams', + value="", + uid=[0], + ), + desc.FloatParam( + name='F', + label='F', + description='Focal lenght.', + value=50.0, + range=(0.0, 800.0, 0.1), + uid=[0], + ), + desc.FloatParam( + name='F35', + label='F35', + description='Focal lenght equiv 35mm.', + value=50.0, + range=(0.0, 800.0, 0.1), + uid=[0], + ), + desc.StringParam( + name='Cam', + label='Cam', + description='Camera model.', + value='', + uid=[0], + ), + desc.StringParam( + name='Tps', + label='Tps', + description='Image timestamp.', + value='', + uid=[0], + ), + desc.BoolParam( + name='Purge', + label='Purge', + description='Purge created exiv2 command file.', + value=True, + uid=[0], + ), + ] + + outputs = [ + desc.File( + name='output', + label='Output', + description='Output folder', + group='', + value=desc.Node.internalFolder, + uid=[], + ), + ] diff --git a/meshroomMicmac/micmac/Tapas.py b/meshroomMicmac/micmac/Tapas.py new file mode 100644 index 0000000..2ddcdcd --- /dev/null +++ b/meshroomMicmac/micmac/Tapas.py @@ -0,0 +1,474 @@ +__version__ = "1.1.1" + +import sys +from meshroom.core import desc +from meshroomMicmac.custom import node + +class Tapas(node.MicmacNode): + commandLine = 'mm3d Tapas {calibrationModelValue} {imagePatternValue} {allParams}' + documentation = 'Tapas' + + inputs = [ + desc.File( + name='projectDirectory', + label='Project Directory', + description='Project Directory.', + value="", + group="micmac", + uid=[0], + ), + desc.File( + name='imagePattern', + label='Image Pattern', + description='Image Pattern.', + group='unnamedParams', + value="", + uid=[0], + ), + desc.File( + name='SH', + label='Homol Directory', + description="Homol Directory.", + uid=[0], + value="", + ), + desc.ChoiceParam( + name='calibrationModel', + label='Calibration Model', + description='Calibration model.', + group='unnamedParams', + value='RadialBasic', + values=['RadialBasic', 'RadialExtended', 'Fraser', 'FishEyeEqui', 'AutoCal', 'Figee', 'HemiEqui', 'RadialStd', 'FraserBasic', 'FishEyeBasic', 'FE_EquiSolBasic', 'Four7x2', 'Four11x2', 'Four15x2', 'Four19x2', 'AddFour7x2', 'AddFour11x2', 'AddFour15x2', 'Four19x2', 'AddPolyDeg0', 'AddPolyDeg1', 'AddPolyDeg2', 'AddPolyDeg3', 'AddPolyDeg4', 'AddPolyDeg5', 'AddPolyDeg6', 'AddPolyDeg7', 'Ebner', 'Brown', 'FishEyeStereo'], + exclusive=True, + uid=[0], + ), + desc.BoolParam( + name='ExpTxt', + label='Exp Txt', + description="Export in text format.", + uid=[0], + value=False, + ), + + ] + + outputs = [ + desc.File( + name='Out', + label='Orientation Directory', + description="Directory of Output Orientation", + uid=[0], + value="Tapas", + ), + ] + + +# TODO: Add useful parameters +""" + desc.File( + name='InCal', + label='In Cal', + description="Directory of Input Internal Orientation (Calibration)", + uid=[0], + value="", + ), + desc.File( + name='InOri', + label='In Ori', + description="Directory of Input External Orientation", + uid=[0], + value="", + ), + desc.BoolParam( + name='DoC', + label='Do C', + description="Do Compensation", + uid=[0], + value=False, + ), + desc.IntParam( + name='ForCalib', + label='For Calib', + description="Is for calibration (Change def value of LMV and prop diag)?", + uid=[0], + value=-1, + range=(-1, 16000, 1), + ), + desc.GroupAttribute( + name='Focs', + label='Focs', + description="Keep images with focal length inside range [A,B] (A,B in mm)", + brackets='[]', + joinChar=',', + groupDesc=[ + desc.FloatParam( + name="x", + label="X", + description="x.", + value=0.0, + range=(1.0, 10000.0, 0.01), + uid=[0], + ), + desc.FloatParam( + name="y", + label="Y", + description="y.", + value=10000.0, + range=(1.0, 10000.0, 0.01), + uid=[0], + ), + ]), + desc.GroupAttribute( + name='PPRel', + label='P P Rel', + description="Principal point shift", + brackets='[]', + joinChar=',', + groupDesc=[ + desc.FloatParam( + name="x", + label="X", + description="x.", + value=-1.0, + range=(-5000.0, 5000.0, 0.01), + uid=[0], + ), + desc.FloatParam( + name="y", + label="Y", + description="y.", + value=-1.0, + range=(-5000.0, 5000.0, 0.01), + uid=[0], + ), + ]), + desc.IntParam( + name='Decentre', + label='Decentre', + description="Principal point is shifted", + uid=[0], + value=-1, + range=(-1, 1, 1), + ), + desc.FloatParam( + name='PropDiag', + label='Prop Diag', + description="Hemi-spherik fisheye diameter to diagonal ratio", + uid=[0], + value=-1.0, + range=(-1.0, 10000.0, 0.01), + ), + desc.StringParam( + name='ImInit', + label='Im Init', + description="Force first image", + uid=[0], + value="", + ), + desc.BoolParam( + name='MOI', + label='M O I', + description="MOI", + uid=[0], + value=False, + ), + desc.IntParam( + name='DBF', + label='D B F', + description="Debug (internal use : DebugPbCondFaisceau=true)", + uid=[0], + value=0, + range=(-sys.maxsize, sys.maxsize, 1), + ), + desc.BoolParam( + name='Debug', + label='Debug', + description="Partial file for debug", + uid=[0], + value=False, + ), + desc.IntParam( + name='DegFree', + label='Deg Free', + description="When specified degree of freedom of parameters generiqs", + uid=[0], + value=100, + range=(0, 360, 1), + ), + desc.IntParam( + name='DegAdd', + label='Deg Add', + description="When specified, degree of additionnal parameter", + uid=[0], + value=0, + range=(0, 360, 1), + ), + desc.IntParam( + name='DegRadMax', + label='Deg Rad Max', + description="Max degree of radial, default model dependent", + uid=[0], + value=100, + range=(0, 360, 1), + ), + desc.IntParam( + name='DegGen', + label='Deg Gen', + description="Max degree of general polynome, default model dependent (generally 0 or 1)", + uid=[0], + value=100, + range=(0, 360, 1), + ), + desc.BoolParam( + name='LibAff', + label='Lib Aff', + description="Free affine parameter", + uid=[0], + value=True, + ), + desc.StringParam( + name='RapTxt', + label='Rap Txt', + description="RapTxt", + uid=[0], + value="", + ), + desc.FloatParam( + name='LinkPPaPPs', + label='Link P Pa P Ps', + description="Link PPa and PPs (double)", + uid=[0], + value=0.0, + range=(-float('inf'), float('inf'), 0.01), + ), + desc.StringParam( + name='FrozenPoses', + label='Frozen Poses', + description="List of frozen poses (pattern)", + uid=[0], + value="", + ), + desc.StringParam( + name='FrozenCenters', + label='Frozen Centers', + description="List of frozen centers of poses (pattern)", + uid=[0], + value="", + ), + desc.StringParam( + name='FrozenOrients', + label='Frozen Orients', + description="List of frozen orients of poses (pattern)", + uid=[0], + value="", + ), + desc.BoolParam( + name='FreeCalibInit', + label='Free Calib Init', + description="Free calibs as soon as created.", + uid=[0], + value=False, + ), + desc.StringParam( + name='FrozenCalibs', + label='Frozen Calibs', + description="List of frozen calibration (pattern)", + uid=[0], + value="", + ), + desc.StringParam( + name='FreeCalibs', + label='Free Calibs', + description="List of free calibration", + uid=[0], + value=".*", + ), + + desc.BoolParam( + name='RefineAll', + label='Refine All', + description="More refinement at all step, safer and more accurate, but slower", + uid=[0], + value=True, + ), + desc.FloatParam( + name='EcMax', + label='Ec Max', + description="Final threshold for residual0", + uid=[0], + value=5.0, + range=(-float('inf'), float('inf'), 0.01), + ), + desc.GroupAttribute( + name='EcInit', + label='Ec Init', + description="Inital threshold for residual", + brackets='[]', + joinChar=',', + groupDesc=[ + desc.FloatParam( + name="x", + label="X", + description="x.", + value=100.0, + range=(0.0, 10000.0, 0.01), + uid=[0], + ), + desc.FloatParam( + name="y", + label="Y", + description="y.", + value=5.0, + range=(0.0, 10000.0, 0.01), + uid=[0], + ), + ]), + desc.FloatParam( + name='CondMaxPano', + label='Cond Max Pano', + description="Precaution for conditionning with Panoramic images.", + uid=[0], + value=1e4, + range=(0.0, 1.0, 0.000001), + ), + desc.IntParam( + name='RankInitF', + label='Rank Init F', + description="Order of focal initialisation, ref id distotion =2", + uid=[0], + value=3, + range=(0, 10, 1), + ), + desc.IntParam( + name='RankInitPP', + label='Rank Init P P', + description="Order of Principal point initialisation, ref id distotion =2", + uid=[0], + value=4, + range=(0, 10, 1), + ), + desc.FloatParam( + name='MulLVM', + label='Mul L V M', + description="Multipier Levenberg Markard", + uid=[0], + value=1.0, + range=(-float('inf'), float('inf'), 0.01), + ), + desc.BoolParam( + name='MultipleBlock', + label='Multiple Block', + description="Multiple block need special caution (only related to Levenberg Markard)", + uid=[0], + value=False, + ), + desc.BoolParam( + name='FocFree', + label='Foc Free', + description="Foc Free.", + uid=[0], + value=True, + ), + desc.BoolParam( + name='PPFree', + label='P P Free', + description="Principal Point Free.", + uid=[0], + value=True, + ), + desc.BoolParam( + name='AffineFree', + label='Affine Free', + description="Affine Parameter.", + uid=[0], + value=True, + ), + desc.IntParam( + name='DRMax', + label='D R Max', + description="When specified degree of freedom of radial parameters", + uid=[0], + value=0, + range=(-sys.maxsize, sys.maxsize, 1), + ), + desc.BoolParam( + name='LibPP', + label='Lib P P', + description="Free principal point", + uid=[0], + value=True, + ), + desc.BoolParam( + name='LibFoc', + label='Lib Foc', + description="Free focal", + uid=[0], + value=True, + ), + desc.BoolParam( + name='LibCP', + label='Lib C P', + description="Free distorsion center, Def context dependant", + uid=[0], + value=True, + ), + desc.BoolParam( + name='LibCD', + label='Lib C D', + description="Free distorsion center, Def context dependant. Principal Point should be also free if CD is free", + uid=[0], + value=True, + ), + desc.BoolParam( + name='LibDec', + label='Lib Dec', + description="Free decentric parameter, Def context dependant", + uid=[0], + value=True, + ), + desc.IntParam( + name='SElimB', + label='S Elim B', + description="Print stat on reason for bundle elimination (0,1,2)", + uid=[0], + value=1, + range=(0, 2, 1), + ), + desc.BoolParam( + name='ExpMatMark', + label='Exp Mat Mark', + description="Export Cov Matrix to Matrix Market Format+Eigen/cmp", + uid=[0], + value=False, + ), + desc.IntParam( + name='VitesseInit', + label='Vitesse Init', + description="VitesseInit.", + uid=[0], + value=2, + range=(-sys.maxsize, sys.maxsize, 1), + ), + desc.BoolParam( + name='UBR4I', + label='UBR4I', + description="UBR4I", + uid=[0], + value=False, + ), + desc.StringParam( + name='SauvAutom', + label='Sauv Autom', + description="Save intermediary results to, Set NONE if dont want any.", + uid=[0], + value="", + ), + desc.FloatParam( + name='RatioMaxDistCS', + label='Ratio Max Dist C S', + description="Ratio max of distance P-Center.", + uid=[0], + value=30.0, + range=(0.0, 10000.0, 0.01), + ), +""" \ No newline at end of file diff --git a/meshroomMicmac/micmac/TapiocaAll.py b/meshroomMicmac/micmac/TapiocaAll.py new file mode 100644 index 0000000..dfd6b59 --- /dev/null +++ b/meshroomMicmac/micmac/TapiocaAll.py @@ -0,0 +1,82 @@ +__version__ = "1.1.1" + +from meshroom.core import desc +from meshroomMicmac.custom import node + +class TapiocaAll(node.MicmacNode): + commandLine = 'mm3d Tapioca All {imagePatternValue} {imageSizeValue} {allParams}' + documentation = '''Tapioca All''' + + inputs = [ + desc.File( + name='projectDirectory', + label='Project Directory', + description='Project Directory.', + value="", + group="micmac", + uid=[0], + ), + desc.File( + name='imagePattern', + label='Image Pattern', + description='Image Pattern.', + value='.*.(jpg|jpeg|JPG|png|PNG|tif|tiff|TIF|TIFF|arw|ARW|crw|CRW|nef|NEF)', + group='unnamedParams', + uid=[0], + ), + desc.IntParam( + name='imageSize', + label='Image Size', + description='Size of image.', + group='unnamedParams', + value=-1, + range=(-1, 16000, 10), + uid=[0], + ), + desc.BoolParam( + name='ExpTxt', + label='Export Files In Txt', + description='Export files in text format (if false binary).', + value=False, + uid=[0], + ), + desc.BoolParam( + name='NoMax', + label='No Max', + description='No max.', + value=False, + uid=[0], + ), + desc.BoolParam( + name='NoMin', + label='No Min', + description='No min.', + value=False, + uid=[0], + ), + desc.BoolParam( + name='NoUnknown', + label='No Unknown', + description='No unknown.', + value=False, + uid=[0], + ), + desc.FloatParam( + name='Ratio', + label='ANN Ratio', + description='ANN closeness ration.', + value=0.6, + range=(0.1, 1.0, 0.1), + uid=[0], + ), + ] + + outputs = [ + desc.File( + name='PostFix', + label='Homol Directory', # Directory Postfix + description='Homol Directory.', + value="Tapioca", + uid=[0], + ), + ] \ No newline at end of file diff --git a/meshroomMicmac/micmac/TapiocaFile.py b/meshroomMicmac/micmac/TapiocaFile.py new file mode 100644 index 0000000..801ddd5 --- /dev/null +++ b/meshroomMicmac/micmac/TapiocaFile.py @@ -0,0 +1,82 @@ +__version__ = "1.1.1" + +from meshroom.core import desc +from meshroomMicmac.custom import node + +class TapiocaFile(node.MicmacNode): + commandLine = 'mm3d Tapioca File {xmlPathValue} {resolutionValue} {allParams}' + documentation = '''Tapioca File''' + + inputs = [ + desc.File( + name='projectDirectory', + label='Project Directory', + description='Project Directory.', + value="", + group="micmac", + uid=[0], + ), + desc.File( + name='xmlPath', + label='XML File Path', + description='XML file path of pair.', + group='unnamedParams', + value="", + uid=[0], + ), + desc.IntParam( + name='resolution', + label='Resolution', + description='Resolution.', + group='unnamedParams', + value=-1, + range=(-1, 16000, 10), + uid=[0], + ), + desc.BoolParam( + name='ExpTxt', + label='Export Files In Txt', + description='Export files in text format (if false binary).', + value=False, + uid=[0], + ), + desc.BoolParam( + name='NoMax', + label='No Max', + description='No max.', + value=False, + uid=[0], + ), + desc.BoolParam( + name='NoMin', + label='No Min', + description='No min.', + value=False, + uid=[0], + ), + desc.BoolParam( + name='NoUnknown', + label='No Unknown', + description='No unknown.', + value=False, + uid=[0], + ), + desc.FloatParam( + name='Ratio', + label='ANN Ratio', + description='ANN closeness ration.', + value=0.6, + range=(0.1, 1.0, 0.1), + uid=[0], + ), + ] + + outputs = [ + desc.File( + name='PostFix', + label='Homol Directory', # Directory Postfix + description='Homol Directory.', + value="Tapioca", + uid=[0], + ), + ] diff --git a/meshroomMicmac/micmac/TapiocaGeoref.py b/meshroomMicmac/micmac/TapiocaGeoref.py new file mode 100644 index 0000000..e8a6897 --- /dev/null +++ b/meshroomMicmac/micmac/TapiocaGeoref.py @@ -0,0 +1,87 @@ +__version__ = "1.1.1" + +from meshroom.core import desc +from meshroomMicmac.custom import node + +class TapiocaGeoref(node.MicmacNode): + commandLine = 'mm3d Tapioca Georef {imagePatternValue} {orientationDirValue} {allParams}' + documentation = '''Tapioca Georef''' + + inputs = [ + desc.File( + name='projectDirectory', + label='Project Directory', + description='Project Directory.', + value="", + group="micmac", + uid=[0], + ), + desc.File( + name='imagePattern', + label='Image Pattern', + description='Image Pattern.', + group='unnamedParams', + value="", + uid=[0], + ), + desc.StringParam( + name='orientationDir', + label='Orientation Directory', + description='Orientation directory name.', + group='unnamedParams', + value='', + uid=[0], + ), + desc.GroupAttribute( + name='Grid', + label='Grid', + description='Tie points grid.', + joinChar=',', + brackets='[]', + groupDesc=[ + desc.IntParam( + name='x', + label='X', + description='Tie points grid (x).', + value=25, + range=(1, 100, 1), + uid=[0], + ), + desc.IntParam( + name='y', + label='Y', + description='Tie points grid (y).', + value=25, + range=(1, 100, 1), + uid=[0], + ), + ] + ), + desc.IntParam( + name='Zoom0', + label='Zoom 0', + description='Zoom init, pow of 2.', + value=16, + range=(1, 1024, 1), + uid=[0], + ), + desc.FloatParam( + name='Cor', + label='Cor', + description='Corelation threshold.', + value=0.6, + range=(0.1, 10.0, 0.1), + uid=[0], + ), + ] + + outputs = [ + desc.File( + name='output', + label='Output', + description='Output folder', + group='', + value=desc.Node.internalFolder, + uid=[], + ), + ] diff --git a/meshroomMicmac/micmac/TapiocaGraph.py b/meshroomMicmac/micmac/TapiocaGraph.py new file mode 100644 index 0000000..c2f83bf --- /dev/null +++ b/meshroomMicmac/micmac/TapiocaGraph.py @@ -0,0 +1,85 @@ +__version__ = "1.1.1" + +from meshroom.core import desc +from meshroomMicmac.custom import node + +class TapiocaGraph(node.MicmacNode): + commandLine = 'mm3d Tapioca Graph {imagePatternValue} {imageSizeValue} {allParams}' + documentation = '''Tapioca Graph''' + + inputs = [ + desc.File( + name='projectDirectory', + label='Project Directory', + description='Project Directory.', + value="", + group="micmac", + uid=[0], + ), + desc.File( + name='imagePattern', + label='Image Pattern', + description='Image Pattern.', + group='unnamedParams', + value="", + uid=[0], + ), + desc.IntParam( + name='imageSize', + label='Image Size', + description='Size of image (greater dimension).', + group='unnamedParams', + value=-1, + range=(-1, 16000, 10), + uid=[0], + ), + desc.IntParam( + name='MaxPoint', + label='Max Point', + description='Number of points used per image to construct the graph.', + value=200, + range=(1, 1000, 1), + uid=[0], + ), + desc.FloatParam( + name="MinScale", + label="Min Scale", + description='Points with a lesser scale are ignored.', + value=0.0, + range=(0.0, 10000000000.0, 0.1), + uid=[0], + ), + desc.FloatParam( + name="MaxScale", + label="Max Scale", + description='Points with a greater scale are ignored.', + value=10000000000.0, + range=(0.0, 10000000000.0, 0.1), + uid=[0], + ), + desc.IntParam( + name='NbRequired', + label='Nb Required', + description='Number of matches to create a connexion between two images.', + value=1, + range=(1, 10000, 1), + uid=[0], + ), + desc.BoolParam( + name='PrintGraph', + label='Print Graph', + description='Print result graph in standard output.', + value=False, + uid=[0], + ), + ] + + outputs = [ + desc.File( + name='Out', + label='Connectivity Graph', + description='Name of the produced XML file.', + value="tapioca_connectivity_graph.xml", + uid=[0], + ), + ] diff --git a/meshroomMicmac/micmac/TapiocaLine.py b/meshroomMicmac/micmac/TapiocaLine.py new file mode 100644 index 0000000..abd761f --- /dev/null +++ b/meshroomMicmac/micmac/TapiocaLine.py @@ -0,0 +1,98 @@ +__version__ = "1.1.1" + +from meshroom.core import desc +from meshroomMicmac.custom import node + +class TapiocaLine(node.MicmacNode): + commandLine = 'mm3d Tapioca Line {imagePatternValue} {imageSizeValue} {nbAdjacentImagesValue} {allParams}' + documentation = '''Tapioca Line''' + + inputs = [ + desc.File( + name='projectDirectory', + label='Project Directory', + description='Project Directory.', + value="", + group="micmac", + uid=[0], + ), + desc.File( + name='imagePattern', + label='Image Pattern', + description='Image Pattern.', + group='unnamedParams', + value="", + uid=[0], + ), + desc.IntParam( + name='imageSize', + label='Image Size', + description='Size of image.', + group='unnamedParams', + value=-1, + range=(-1, 16000, 10), + uid=[0], + ), + desc.IntParam( + name='nbAdjacentImages', + label='Nb Adjacent Images', + description='Number of adjacent images to look for.', + group='unnamedParams', + value=5, + range=(1, 100, 1), + uid=[0], + ), + desc.BoolParam( + name='ExpTxt', + label='Export Files In Txt', + description='Export files in text format (if false binary).', + value=False, + uid=[0], + ), + desc.BoolParam( + name='ForceAdSupResol', + label='Force Ad Sup Resol', + description='To force computation even when Resol < Adj.', + value=False, + uid=[0], + ), + desc.BoolParam( + name='NoMax', + label='No Max', + description='No max.', + value=False, + uid=[0], + ), + desc.BoolParam( + name='NoMin', + label='No Min', + description='No min.', + value=False, + uid=[0], + ), + desc.BoolParam( + name='NoUnknown', + label='No Unknown', + description='No unknown.', + value=False, + uid=[0], + ), + desc.FloatParam( + name='Ratio', + label='ANN Ratio', + description='ANN closeness ration.', + value=0.6, + range=(0.1, 1.0, 0.1), + uid=[0], + ), + ] + + outputs = [ + desc.File( + name='PostFix', + label='Homol Directory', # Directory Postfix + description='Homol Directory.', + value="Tapioca", + uid=[0], + ), + ] diff --git a/meshroomMicmac/micmac/TapiocaMulScale.py b/meshroomMicmac/micmac/TapiocaMulScale.py new file mode 100644 index 0000000..791d0e3 --- /dev/null +++ b/meshroomMicmac/micmac/TapiocaMulScale.py @@ -0,0 +1,91 @@ +__version__ = "1.1.1" + +from meshroom.core import desc +from meshroomMicmac.custom import node + +class TapiocaMulScale(node.MicmacNode): + commandLine = 'mm3d Tapioca MulScale {imagePatternValue} {imageSizeLowResolutionValue} {imageSizeHighResolutionValue} {allParams}' + documentation = '''Tapioca MulScale''' + + inputs = [ + desc.File( + name='projectDirectory', + label='Project Directory', + description='Project Directory.', + value="", + group="micmac", + uid=[0], + ), + desc.File( + name='imagePattern', + label='Image Pattern', + description='Image Pattern.', + group='unnamedParams', + value="", + uid=[0], + ), + desc.IntParam( + name='imageSizeLowResolution', + label='Image Size Low', + description='Size of low resolution images.', + group='unnamedParams', + value=300, + range=(-1, 10000, 1), + uid=[0], + ), + desc.IntParam( + name='imageSizeHighResolution', + label='Image Size High', + description='Size of high resolution images.', + group='unnamedParams', + value=-1, + range=(-1, 10000, 1), + uid=[0], + ), + desc.BoolParam( + name='ExpTxt', + label='Export Files In Txt', + description='Export files in text format (if false binary).', + value=False, + uid=[0], + ), + desc.BoolParam( + name='NoMax', + label='No Max', + description='No max.', + value=False, + uid=[0], + ), + desc.BoolParam( + name='NoMin', + label='No Min', + description='No min.', + value=False, + uid=[0], + ), + desc.BoolParam( + name='NoUnknown', + label='No Unknown', + description='No unknown.', + value=False, + uid=[0], + ), + desc.FloatParam( + name='Ratio', + label='ANN Ratio', + description='ANN closeness ration.', + value=0.6, + range=(0.1, 1.0, 0.1), + uid=[0], + ), + ] + + outputs = [ + desc.File( + name='PostFix', + label='Homol Directory', # Directory Postfix + description='Homol Directory.', + value="Tapioca", + uid=[0], + ), + ] diff --git a/meshroomMicmac/micmac/Tawny.py b/meshroomMicmac/micmac/Tawny.py new file mode 100644 index 0000000..19f2b69 --- /dev/null +++ b/meshroomMicmac/micmac/Tawny.py @@ -0,0 +1,177 @@ +__version__ = "1.1.1" + +import sys +from meshroom.core import desc +from meshroomMicmac.custom import node + +class Tawny(node.MicmacNode): + commandLine = 'mm3d Tawny {dataDirectoryValue} {allParams}' + documentation = 'Tawny' + + inputs = [ + desc.File( + name='projectDirectory', + label='Project Directory', + description='Project Directory.', + value="", + group="micmac", + uid=[0], + ), + desc.File( + name='dataDirectory', + label='Data Directory', + description="Data directory", + group='unnamedParams', + uid=[0], + value="", + ), + desc.BoolParam( + name='RadiomEgal', + label='Radiom Egal', + description="Perform or not radiometric egalization", + uid=[0], + value=True, + ), + desc.IntParam( + name='DEq', + label='D Eq', + description="Degree of equalization", + uid=[0], + value=1, + range=(-sys.maxsize, sys.maxsize, 1), + ), + desc.GroupAttribute( + name='DEqXY', + label='D Eq X Y', + description="Degree of equalization, if diff in X and Y", + brackets='[]', + joinChar=',', + groupDesc=[ + desc.IntParam( + name="x", + label="X", + description="x.", + value=0, + range=(-sys.maxsize, sys.maxsize, 1), + uid=[0], + ), + desc.IntParam( + name="y", + label="Y", + description="y.", + value=0, + range=(-sys.maxsize, sys.maxsize, 1), + uid=[0], + ), + ]), + desc.BoolParam( + name='AddCste', + label='Add Cste', + description="Add unknown constant for equalization", + uid=[0], + value=False, + ), + desc.IntParam( + name='DegRap', + label='Deg Rap', + description="Degree of rappel to initial values", + uid=[0], + value=0, + range=(-sys.maxsize, sys.maxsize, 1), + ), + desc.GroupAttribute( + name='DegRapXY', + label='Deg Rap X Y', + description="Degree of rappel to initial values", + brackets='[]', + joinChar=',', + groupDesc=[ + desc.IntParam( + name="x", + label="X", + description="x.", + value=0, + range=(-sys.maxsize, sys.maxsize, 1), + uid=[0], + ), + desc.IntParam( + name="y", + label="Y", + description="y.", + value=0, + range=(-sys.maxsize, sys.maxsize, 1), + uid=[0], + ), + ]), + desc.BoolParam( + name='RGP', + label='R G P', + description="Rappel glob on physically equalized", + uid=[0], + value=True, + ), + desc.FloatParam( + name='DynG', + label='Dyn G', + description="Global Dynamic (to correct saturation problems)", + uid=[0], + value=0.0, + range=(-float('inf'), float('inf'), 0.01), + ), + desc.StringParam( + name='ImPrio', + label='Im Prio', + description="Pattern of image with high prio", + uid=[0], + value=".*", + ), + desc.IntParam( + name='SzV', + label='Sz V', + description="Sz of Window for equalization (1 means 3x3)", + uid=[0], + value=1, + range=(-sys.maxsize, sys.maxsize, 1), + ), + desc.FloatParam( + name='CorThr', + label='Cor Thr', + description="Threshold of correlation to validate homologous", + uid=[0], + value=0.7, + range=(-float('inf'), float('inf'), 0.01), + ), + desc.FloatParam( + name='NbPerIm', + label='Nb Per Im', + description="Average number of point per image", + uid=[0], + value=1e4, + range=(-float('inf'), float('inf'), 0.01), + ), + desc.BoolParam( + name='L1F', + label='L1 F', + description="Do L1 Filter on couple", + uid=[0], + value=True, + ), + desc.FloatParam( + name='SatThresh', + label='Sat Thresh', + description="Threshold determining saturation value (pixel >SatThresh will be ignored)", + uid=[0], + value=0.0, + range=(-float('inf'), float('inf'), 0.01), + ), + ] + + outputs = [ + desc.File( + name='Out', + label='Out', + description="Name of output file (in the folder)", + uid=[0], + value="Tawny", + ), + ] diff --git a/meshroomMicmac/micmac/Tequila.py b/meshroomMicmac/micmac/Tequila.py new file mode 100644 index 0000000..e5d37a1 --- /dev/null +++ b/meshroomMicmac/micmac/Tequila.py @@ -0,0 +1,143 @@ +__version__ = "1.1.1" + +from meshroom.core import desc +from meshroomMicmac.custom import node + +class Tequila(node.MicmacNode): + commandLine = 'mm3d Tequila {imagePatternValue} {orientationDirValue} {plyNameValue} {allParams}' + documentation = '''Tequila''' + + inputs = [ + desc.File( + name='projectDirectory', + label='Project Directory', + description='Project Directory.', + value="", + group="micmac", + uid=[0], + ), + desc.File( + name='imagePattern', + label='Image Pattern', + description='Image Pattern.', + group='unnamedParams', + value="", + uid=[0], + ), + desc.StringParam( + name='orientationDir', + label='Orientation Directory', + description='Orientation directory name.', + group='unnamedParams', + value='', + uid=[0], + ), + desc.StringParam( + name='plyName', + label='PLY Name', + description='Ply filename.', + group='unnamedParams', + value='', + uid=[0], + ), + desc.BoolParam( + name='Bin', + label='Bin', + description='Write PLY in binary mode.', + value=True, + uid=[0], + ), + desc.BoolParam( + name='Optim', + label='Optim', + description='Graph-cut optimization.', + value=False, + uid=[0], + ), + desc.FloatParam( + name='Lambda', + label='Lambda', + description='Lambda.', + value=0.01, + range=(0.0, 10.0, 0.01), + uid=[0], + ), + desc.IntParam( + name='Iter', + label='Iter', + description='Optimization iteration number.', + value=2, + range=(0, 20, 1), + uid=[0], + ), + desc.BoolParam( + name='Filter', + label='Filter', + description='Remove border faces.', + value=False, + uid=[0], + ), + desc.IntParam( + name='Sz', + label='Sz', + description='Texture max size.', + value=8192, + range=(100, 16000, 1), + uid=[0], + ), + desc.IntParam( + name='Scale', + label='Scale', + description='Z-buffer downscale factor.', + value=2, + range=(0, 10, 1), + uid=[0], + ), + desc.BoolParam( + name='ZBufCache', + label='ZBuf Cache', + description='ZBuffer cache (if True: a little faster, more memory).', + value=False, + uid=[0], + ), + desc.IntParam( + name='QUAL', + label='Qual', + description='jpeg compression quality.', + value=70, + range=(10, 100, 1), + uid=[0], + ), + desc.FloatParam( + name='Angle', + label='Angle', + description='Threshold angle, in degree, between triangle normal and image viewing direction', + value=90.0, + range=(0.0, 360.0, 0.01), + uid=[0], + ), + desc.StringParam( + name='Mode', + label='Mode', + description='Mode.', + value='Pack', + uid=[0], + ), + desc.StringParam( + name='Crit', + label='Crit', + description='Texture choosing criterion.', + value='Angle', + uid=[0], + ), + ] + + outputs = [ + desc.File( + name='Out', + label='Point Cloud', + description='Output PLY point cloud name.', + value='Tequila.ply', + uid=[0], + ), + ] diff --git a/meshroomMicmac/micmac/TiPunch.py b/meshroomMicmac/micmac/TiPunch.py new file mode 100644 index 0000000..89b6cae --- /dev/null +++ b/meshroomMicmac/micmac/TiPunch.py @@ -0,0 +1,95 @@ +__version__ = "1.1.1" + +from meshroom.core import desc +from meshroomMicmac.custom import node + +class TiPunch(node.MicmacNode): + commandLine = 'mm3d TiPunch {plyNameValue} {allParams}' + documentation = '''TiPunch''' + + inputs = [ + desc.File( + name='projectDirectory', + label='Project Directory', + description='Project Directory.', + value="", + group="micmac", + uid=[0], + ), + desc.File( + name='Pattern', + label='Image Pattern', + description='Image Pattern.', + value="", + uid=[0], + ), + desc.File( + name='plyName', + label='Point Cloud', + description='Point cloud PLY filename.', + group='unnamedParams', + value='', + uid=[0], + ), + desc.BoolParam( + name='Bin', + label='Bin', + description='Write PLY in binary mode.', + value=True, + uid=[0], + ), + desc.IntParam( + name='Depth', + label='Depth', + description='Maximum reconstruction depth for PoissonRecon.', + value=8, + range=(0, 20, 1), + uid=[0], + ), + desc.BoolParam( + name='Rm', + label='Rm', + description='Remove intermediary Poisson mesh.', + value=False, + uid=[0], + ), + desc.BoolParam( + name='Filter', + label='Filter', + description='Filter mesh.', + value=True, + uid=[0], + ), + desc.StringParam( + name='Mode', + label='Mode', + description='C3DC mode.', + value='Statue', + uid=[0], + ), + desc.IntParam( + name='Scale', + label='Scale', + description='Z-buffer downscale factor.', + value=2, + range=(0, 10, 1), + uid=[0], + ), + desc.BoolParam( + name='FFB', + label='FFB', + description='Filter from border.', + value=True, + uid=[0], + ), + ] + + outputs = [ + desc.File( + name='Out', + label='Point Cloud', + description='Output PLY point cloud name.', + value='TiPunch.ply', + uid=[0], + ), + ] diff --git a/meshroomMicmac/micmac/__init__.py b/meshroomMicmac/micmac/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/scripts/addMicmacNode.py b/scripts/addMicmacNode.py new file mode 100644 index 0000000..2e9076b --- /dev/null +++ b/scripts/addMicmacNode.py @@ -0,0 +1,346 @@ +#!/usr/bin/env python + +# MicMac v1.1.1 command-line to Meshroom node +# Custom script written from meshroom_newNodeType + +from __future__ import print_function + +import argparse +import os +import re +import sys +import shlex +import subprocess +from pprint import pprint + +def trim(s): + """ + All repetition of any kind of space is replaced by a single space + and remove trailing space at beginning or end. + """ + # regex to replace all space groups by a single space + # use split() to remove trailing space at beginning/end + return re.sub('\s+', ' ', s).strip() + + +def quotesForStrings(valueStr): + """ + Return the input string with quotes if it cannot be cast into another builtin type. + """ + v = valueStr + try: + int(valueStr) + except ValueError: + try: + float(valueStr) + except ValueError: + if "'" in valueStr: + v = "'''{}'''".format(valueStr) + else: + v = "'{}'".format(valueStr) + return v + +def convertToLabel(name): + camelCaseToLabel = re.sub('()([A-Z][a-z]*?)', r'\1 \2', name) + if camelCaseToLabel[0] == ' ': # begin with uppercase + camelCaseToLabel = camelCaseToLabel[1:] + snakeToLabel = ' '.join(word.capitalize() for word in camelCaseToLabel.split('_')) + snakeToLabel = ' '.join(word.capitalize() for word in snakeToLabel.split(' ')) + return snakeToLabel + +parser = argparse.ArgumentParser(description='Create a new MicMac Node') +parser.add_argument('--node', metavar='NODE_NAME', type=str, + help='New node name') +parser.add_argument('--bin', metavar='CMDLINE', type=str, + default=None, + help='Input executable') +parser.add_argument('--args', metavar='CMDLINE', type=str, + default='', + help='Input executable parameters') +parser.add_argument('--output', metavar='DIR', type=str, + default=os.path.dirname(__file__), + help='Output plugin folder') +parser.add_argument("--force", help="Allows to overwrite the output plugin file.", + action="store_true") + +args = parser.parse_args() +inputCmdLineDoc = None +proc = subprocess.Popen(args=shlex.split(args.bin) + [args.args] + ['-help'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) +stdout, stderr = proc.communicate() +inputCmdLineDoc = stdout if stdout else stderr + +if not inputCmdLineDoc: + print('No input documentation.') + print('Usage: YOUR_COMMAND -help | {cmd}'.format(cmd=os.path.splitext(__file__)[0])) + sys.exit(-1) + + +args_re = re.compile( + '^\s+\*\s+' # space(s) + '*' + space(s) + '(\[Name=' # '[Name=' + '(?P\w+)' # argument name + '\]' # ']' + '\s+)?' # space(s) + '(?P\w+)' # argument type + '\s+' # space(s) + '::' # '::' + '\s+' # space(s) + '{(?P.*?)?}' # argument description in {} + , re.MULTILINE) + +cmdLineArgs = args_re.findall(inputCmdLineDoc.decode('utf-8')) + +print('='*80) + +outputNodeStr = '' +inputNodeStr = '' +nbUnnamedParams = 0 + +for cmdLineArg in cmdLineArgs: + argStr = None + # cmdLineArg[0] is optional + argName = cmdLineArg[1] + argType = cmdLineArg[2].lower() + argDesc = trim(cmdLineArg[3]) + isOutput = False + isUnnamed = False + + cmdLineArgLower = ' '.join([argName, argDesc]).lower() + + if len(argName) == 0 : + nbUnnamedParams += 1 + argName = 'unnamed_' + str(nbUnnamedParams) + isUnnamed = True + + if argType =='string' and ('path' in cmdLineArgLower or 'folder' in cmdLineArgLower or 'file' in cmdLineArgLower or 'directory' in cmdLineArgLower or 'dir' in cmdLineArgLower) : + argType='file' + + if 'output' in cmdLineArgLower : + isOutput = True + + print([argName, argType, argDesc]) + + paramStr=""" + name='{name}', + label='{label}', + description="{description}", + uid=[0],""".format(name=argName, label=convertToLabel(argName), description=argDesc) + + if isUnnamed: + paramStr += """ + group='unnamedParams',""" + + if argType == 'bool': + argStr=""" + desc.BoolParam({params} + value=False, + ),""".format(params=paramStr) + elif argType == 'file': + argStr = """ + desc.File({params} + value="", + ),""".format(params=paramStr) + elif argType == 'string': + argStr = """ + desc.StringParam({params} + value="", + ),""".format(params=paramStr) + elif argType == 'int': + argStr = """ + desc.IntParam({params} + value=0, + range=(-sys.maxsize, sys.maxsize, 1), + ),""".format(params=paramStr) + elif argType == 'real': + argStr = """ + desc.FloatParam({params} + value=0.0, + range=(-float('inf'), float('inf'), 0.01), + ),""".format(params=paramStr) + elif argType == 'vector': + argStr = """ + desc.ListAttribute({params} + elementDesc=desc.StringParam( + name="{name}Item", + label="{label} item", + description="{description}", + value='', + uid=[0], + ), + ),""".format(params=paramStr, name=argName, label=convertToLabel(argName), description=argDesc) + elif argType == 'vector': + argStr = """ + desc.ListAttribute({params} + elementDesc=desc.FloatParam( + name="{name}Item", + label="{label} item", + description="{description}", + value=0.0, + range=(-float('inf'), float('inf'), 0.01), + uid=[0], + ), + ),""".format(params=paramStr, name=argName, label=convertToLabel(argName), description=argDesc) + elif argType == 'pt2di': + argStr = """ + desc.GroupAttribute( + name='{name}', + label='{label}', + description="{description}", + brackets='[]', + joinChar=',', + groupDesc=[ + desc.IntParam( + name="x", + label="X", + description="x.", + value=0, + range=(-sys.maxsize, sys.maxsize, 1), + uid=[0], + ), + desc.IntParam( + name="y", + label="Y", + description="y.", + value=0, + range=(-sys.maxsize, sys.maxsize, 1), + uid=[0], + ), + ]),""".format(name=argName, label=convertToLabel(argName), description=argDesc) + elif argType == 'pt3di': + argStr = """ + desc.GroupAttribute( + name='{name}', + label='{label}', + description="{description}", + brackets='[]', + joinChar=',', + groupDesc=[ + desc.IntParam( + name="x", + label="X", + description="x.", + value=0, + range=(-sys.maxsize, sys.maxsize, 1), + uid=[0], + ), + desc.IntParam( + name="y", + label="Y", + description="y.", + value=0, + range=(-sys.maxsize, sys.maxsize, 1), + uid=[0], + ), + desc.IntParam( + name="z", + label="Z", + description="z.", + value=0, + range=(-sys.maxsize, sys.maxsize, 1), + uid=[0], + ), + ]),""".format(name=argName, label=convertToLabel(argName), description=argDesc) + elif argType == 'pt2dr': + argStr = """ + desc.GroupAttribute( + name='{name}', + label='{label}', + description="{description}", + brackets='[]', + joinChar=',', + groupDesc=[ + desc.FloatParam( + name="x", + label="X", + description="x.", + value=0.0, + range=(-float('inf'), float('inf'), 0.01), + uid=[0], + ), + desc.FloatParam( + name="y", + label="Y", + description="y.", + value=0.0, + range=(-float('inf'), float('inf'), 0.01), + uid=[0], + ), + ]),""".format(name=argName, label=convertToLabel(argName), description=argDesc) + elif argType == 'pt3dr': + argStr = """ + desc.GroupAttribute( + name='{name}', + label='{label}', + description="{description}", + brackets='[]', + joinChar=',', + groupDesc=[ + desc.FloatParam( + name="x", + label="X", + description="x.", + value=0.0, + range=(-float('inf'), float('inf'), 0.01), + uid=[0], + ), + desc.FloatParam( + name="y", + label="Y", + description="y.", + value=0.0, + range=(-float('inf'), float('inf'), 0.01), + uid=[0], + ), + desc.FloatParam( + name="z", + label="Z", + description="z.", + value=0.0, + range=(-float('inf'), float('inf'), 0.01), + uid=[0], + ), + ]),""".format(name=argName, label=convertToLabel(argName), description=argDesc) + else: + print('New MicMac Node Aborted: unknown type (type: ' + argType + ').') + sys.exit(-1) + + if isOutput: + outputNodeStr += argStr + else: + inputNodeStr += argStr + +fileStr = '''__version__ = "0.0" + +import sys +from meshroom.core import desc +from meshroomMicmac.custom import node + +class {nodeName}(node.MicmacNode): + commandLine = '{cmd} {allParams}' + documentation = '{nodeName}' + + inputs = [ + desc.File( + name='projectDirectory', + label='Project Directory', + description='Project Directory.', + value="", + group="micmac", + uid=[0], + ),{inputNodes} + ] + + outputs = [{outputNodes} + ] +'''.format(nodeName=args.node, cmd=args.bin + ' ' + args.args, allParams= '{allParams}', inputNodes=inputNodeStr, outputNodes=outputNodeStr) + +outputFilepath = os.path.join(args.output, args.node + '.py') + +if not args.force and os.path.exists(outputFilepath): + print('Plugin "{}" already exists "{}".'.format(args.node, outputFilepath)) + sys.exit(-1) + +with open(outputFilepath, 'w') as pluginFile: + pluginFile.write(fileStr) + +print('New node exported to: "{}"'.format(outputFilepath))