Welcome to mirror list, hosted at ThFree Co, Russian Federation.

SfMTransfer.py « aliceVision « nodes « meshroom - github.com/alicevision/meshroom.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: dd0f8c4a16420e536e8d3fdd2fdb310be26879ac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
__version__ = "2.0"

from meshroom.core import desc

import os.path


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

    category = 'Utils'
    documentation = '''
This node allows to transfer poses and/or intrinsics form one SfM scene onto another one.
'''

    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"
                " * from_intrinsicid: Copy intrinsics parameters\n",
            value='from_viewid',
            values=['from_viewid', 'from_filepath', 'from_metadata', 'from_intrinsicid'],
            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 SfMData File',
            description='SfMData file.',
            value=lambda attr: desc.Node.internalFolder + (os.path.splitext(os.path.basename(attr.node.input.value))[0] or 'sfmData') + '.abc',
            uid=[],
        ),
        desc.File(
            name='outputViewsAndPoses',
            label='Output Poses',
            description='''Path to the output sfmdata file with cameras (views and poses).''',
            value=desc.Node.internalFolder + 'cameras.sfm',
            uid=[],
        ),
    ]