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

Versatile image exporting #2668

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
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
83 changes: 83 additions & 0 deletions meshroom/nodes/aliceVision/ExportImages.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
__version__ = "3.1"

from meshroom.core import desc
from meshroom.core.utils import VERBOSE_LEVEL


class ExportImages(desc.AVCommandLineNode):
commandLine = 'aliceVision_exportImages {allParams}'
size = desc.DynamicNodeSize('input')
parallelization = desc.Parallelization(blockSize=40)
commandLineRange = '--rangeStart {rangeStart} --rangeSize {rangeBlockSize}'

category = 'Utils'
documentation = '''
Export images referenced in the input sfmData by transforming
them to adapt to the required target intrinsics. For example, the target
intrinsics may be the same without the distortion.
'''

inputs = [
desc.File(
name="input",
label="SfMData",
description="Input SfMData file. Contains the original intrinsics of the images.",
value="",
),
desc.File(
name="target",
label="Target",
description="This sfmData file contains the required intrinsics for the output images.",
value="",
),
desc.ChoiceParam(
name="outputFileType",
label="Output File Type",
description="Output file type for the exported images.",
value="exr",
values=["jpg", "png", "tif", "exr"],
advanced=True,
),
desc.BoolParam(
name="evCorrection",
label="Correct Images Exposure",
description="Apply a correction on images' exposure value.",
value=False,
advanced=True,
),
desc.ChoiceParam(
name="namingMode",
label="Naming mode",
description="image naming mode :\n"
" - viewId: viewid.ext.\n"
" - frameId: Frameid.ext.\n"
" - keep: Keep original name.\n",
value="viewId",
values=["viewid", "frameid", "keep"],
),
desc.ChoiceParam(
name="verboseLevel",
label="Verbose Level",
description="Verbosity level (fatal, error, warning, info, debug, trace).",
values=VERBOSE_LEVEL,
value="info",
),
]

outputs = [
desc.File(
name="output",
label="Images Folder",
description="Output folder.",
value=desc.Node.internalFolder,
),
desc.File(
name="undistorted",
label="Undistorted Images",
description="List of undistorted images.",
semantic="image",
value=desc.Node.internalFolder + "<VIEW_ID>.{outputFileTypeValue}",
group="",
advanced=True,
),
]
67 changes: 67 additions & 0 deletions meshroom/nodes/aliceVision/IntrinsicsTransforming.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
__version__ = "1.0"

from meshroom.core import desc
from meshroom.core.utils import VERBOSE_LEVEL

class IntrinsicsTransforming(desc.AVCommandLineNode):
commandLine = 'aliceVision_intrinsicsTransforming {allParams}'
size = desc.DynamicNodeSize('input')

category = 'Utils'
documentation = '''
Transforms all intrinsics in the sfmData to a new type.
'''

inputs = [
desc.File(
name="input",
label="Input SfMData",
description="Input SfMData file.",
value="",
),
desc.File(
name="inputTracks",
label="Input Tracks",
description="Input Tracks file.",
value="",
),
desc.ChoiceParam(
name="type",
label="Camera Type",
description="Mathematical model used to represent a camera:\n"
" - pinhole: Simplest projective camera model without optical distortion "
"(focal and optical center).\n"
" - equirectangular: Projection model used in panoramas.\n",
value="pinhole",
values=["pinhole", "equidistant", "equirectangular"],
),
desc.FloatParam(
name="fakeFov",
label="Virtual FOV",
description="If the input intrinsic is not a pinhole but the output is, what is the virtual FOV requested.",
value=90.0,
range=(1.0, 179.0, 0.1),
),
desc.ChoiceParam(
name="verboseLevel",
label="Verbose Level",
description="Verbosity level (fatal, error, warning, info, debug, trace).",
values=VERBOSE_LEVEL,
value="info",
),
]

outputs = [
desc.File(
name="output",
label="Output SfMData",
description="Output SfMData file.",
value=desc.Node.internalFolder + "sfmData.abc",
),
desc.File(
name="outputTracks",
label="Output Tracks",
description="Output Tracks file.",
value=desc.Node.internalFolder + "tracksFile.json",
),
]