-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ceb83c5
commit 13cc01d
Showing
24 changed files
with
2,636 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Meshroom x Micmac | ||
|
||
Meshroom x Micmac | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Package that group up all the core utilities of MRRS: the Inputs and Ouptuts, common geometric operation and utility functions""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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], | ||
), | ||
] |
Oops, something went wrong.