Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coordinate system alignment to specific markers or between scenes #652

Merged
merged 3 commits into from
Sep 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions meshroom/nodes/aliceVision/SfMAlignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,65 @@ class SfMAlignment(desc.CommandLineNode):
value='',
uid=[0],
),
desc.ChoiceParam(
name='method',
label='Alignment Method',
description="Alignment Method:\n"
" * from_cameras_viewid: Align cameras with same view Id\n"
" * from_cameras_poseid: Align cameras with same pose Id\n"
" * from_cameras_filepath: Align cameras with a filepath matching, using 'fileMatchingPattern'\n"
" * from_cameras_metadata: Align cameras with matching metadata, using 'metadataMatchingList'\n"
" * from_markers: Align from markers with the same Id\n",
value='from_cameras_viewid',
values=['from_cameras_viewid', 'from_cameras_poseid', 'from_cameras_filepath', 'from_cameras_metadata', 'from_markers'],
exclusive=True,
uid=[0],
),
desc.StringParam(
name='fileMatchingPattern',
label='File Matching Pattern',
description='Matching regular expression for the "from_cameras_filepath" method. '
'You should capture specific parts of the filepath with parenthesis to define matching elements.\n'
'Some examples of patterns:\n'
' - Match the filename without extension (default value): ".*\/(.*?)\.\w{3}"\n'
' - Match the filename suffix after "_": ".*\/.*(_.*?\.\w{3})"\n'
' - Match the filename prefix before "_": ".*\/(.*?)_.*\.\w{3}"\n',
value='.*\/(.*?)\.\w{3}',
uid=[0],
),
desc.ListAttribute(
elementDesc=desc.File(
name="metadataMatching",
label="Metadata",
description="",
value="",
uid=[0],
),
name="metadataMatchingList",
label="Metadata Matching List",
description='List of metadata that should match to create the correspondences. If the list is empty, the default value will be used: ["Make", "Model", "Exif:BodySerialNumber", "Exif:LensSerialNumber"].',
),
desc.BoolParam(
name='applyScale',
label='Scale',
description='Apply scale transformation.',
value=True,
uid=[0]
),
desc.BoolParam(
name='applyRotation',
label='Rotation',
description='Apply rotation transformation.',
value=True,
uid=[0]
),
desc.BoolParam(
name='applyTranslation',
label='Translation',
description='Apply translation transformation.',
value=True,
uid=[0]
),
desc.ChoiceParam(
name='verboseLevel',
label='Verbose Level',
Expand Down
94 changes: 94 additions & 0 deletions meshroom/nodes/aliceVision/SfMTransfer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
__version__ = "1.0"

from meshroom.core import desc


class SfMTransfer(desc.CommandLineNode):
commandLine = 'aliceVision_utils_sfmTransfer {allParams}'
size = desc.DynamicNodeSize('input')

inputs = [
desc.File(
name='input',
label='Input',
description='''SfMData file .''',
value='',
uid=[0],
),
desc.File(
name='reference',
label='Reference',
description='''Path to the scene used as the reference to retrieve resolved poses and intrinsics.''',
value='',
uid=[0],
),
desc.ChoiceParam(
name='method',
label='Matching Method',
description="Matching Method:\n"
" * from_viewid: Align cameras with same view Id\n"
" * from_filepath: Align cameras with a filepath matching, using 'fileMatchingPattern'\n"
" * from_metadata: Align cameras with matching metadata, using 'metadataMatchingList'\n",
value='from_viewid',
values=['from_viewid', 'from_filepath', 'from_metadata'],
exclusive=True,
uid=[0],
),
desc.StringParam(
name='fileMatchingPattern',
label='File Matching Pattern',
description='Matching regular expression for the "from_cameras_filepath" method. '
'You should capture specific parts of the filepath with parenthesis to define matching elements.\n'
'Some examples of patterns:\n'
' - Match the filename without extension (default value): ".*\/(.*?)\.\w{3}"\n'
' - Match the filename suffix after "_": ".*\/.*(_.*?\.\w{3})"\n'
' - Match the filename prefix before "_": ".*\/(.*?)_.*\.\w{3}"\n',
value='.*\/(.*?)\.\w{3}',
uid=[0],
),
desc.ListAttribute(
elementDesc=desc.File(
name="metadataMatching",
label="Metadata",
description="",
value="",
uid=[0],
),
name="metadataMatchingList",
label="Metadata Matching List",
description='List of metadata that should match to create the correspondences. If the list is empty, the default value will be used: ["Make", "Model", "Exif:BodySerialNumber", "Exif:LensSerialNumber"].',
),
desc.BoolParam(
name='transferPoses',
label='Poses',
description='Transfer poses.',
value=True,
uid=[0]
),
desc.BoolParam(
name='transferIntrinsics',
label='Intrinsics',
description='Transfer cameras intrinsics.',
value=True,
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='output',
label='Output',
description='SfMData file.',
value=desc.Node.internalFolder + 'sfmData.abc',
uid=[],
),
]
43 changes: 39 additions & 4 deletions meshroom/nodes/aliceVision/SfMTransform.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ class SfMTransform(desc.CommandLineNode):
" * transformation: Apply a given transformation\n"
" * auto_from_cameras: Use cameras\n"
" * auto_from_landmarks: Use landmarks\n"
" * from_single_camera: Use a specific camera as the origin of the coordinate system",
" * from_single_camera: Use a specific camera as the origin of the coordinate system\n"
" * from_markers: Align specific markers to custom coordinates",
value='auto_from_landmarks',
values=['transformation', 'auto_from_cameras', 'auto_from_landmarks', 'from_single_camera'],
values=['transformation', 'auto_from_cameras', 'auto_from_landmarks', 'from_single_camera', 'from_markers'],
exclusive=True,
uid=[0],
),
Expand All @@ -51,10 +52,44 @@ class SfMTransform(desc.CommandLineNode):
name='scale',
label='Additional Scale',
description='Additional scale to apply.',
value=10.0,
range=(1, 100.0, 1),
value=1.0,
range=(0.0, 100.0, 0.1),
uid=[0],
),
desc.ListAttribute(
name="markers",
elementDesc=desc.GroupAttribute(name="markerAlign", label="Marker Align", description="", joinChar=":", groupDesc=[
desc.IntParam(name="markerId", label="Marker", description="Marker Id", value=0, uid=[0], range=(0, 32, 1)),
desc.GroupAttribute(name="markerCoord", label="Coord", description="", joinChar=",", groupDesc=[
desc.FloatParam(name="x", label="x", description="", value=0.0, uid=[0], range=(-2.0, 2.0, 1.0)),
desc.FloatParam(name="y", label="y", description="", value=0.0, uid=[0], range=(-2.0, 2.0, 1.0)),
desc.FloatParam(name="z", label="z", description="", value=0.0, uid=[0], range=(-2.0, 2.0, 1.0)),
])
]),
label="Markers",
description="Markers alignment points",
),
desc.BoolParam(
name='applyScale',
label='Scale',
description='Apply scale transformation.',
value=True,
uid=[0]
),
desc.BoolParam(
name='applyRotation',
label='Rotation',
description='Apply rotation transformation.',
value=True,
uid=[0]
),
desc.BoolParam(
name='applyTranslation',
label='Translation',
description='Apply translation transformation.',
value=True,
uid=[0]
),
desc.ChoiceParam(
name='verboseLevel',
label='Verbose Level',
Expand Down