Skip to content

Commit

Permalink
[nodes] LdrToHdr: Move import of pyalicevision within functions
Browse files Browse the repository at this point in the history
Since `pyalicevision`, which is provided outside of Meshroom's repository,
is now needed for all the LdrToHdr nodes, importing `pyalicevision` at
the function level rather than at the file level allows the CI to pass
even if `pyalicevision` is not available.
  • Loading branch information
cbentejac committed Oct 15, 2024
1 parent 9be7c03 commit 0654247
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
7 changes: 4 additions & 3 deletions meshroom/nodes/aliceVision/LdrToHdrCalibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
import os
from collections import Counter

from pyalicevision import sfmData as avsfmdata
from pyalicevision import hdr as avhdr

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

Expand Down Expand Up @@ -174,6 +171,8 @@ def processChunk(self, chunk):

@classmethod
def update(cls, node):
from pyalicevision import hdr as avhdr

if not isinstance(node.nodeDesc, cls):
raise ValueError("Node {} is not an instance of type {}".format(node, cls))
# TODO: use Node version for this test
Expand Down Expand Up @@ -251,6 +250,8 @@ def update(cls, node):

@staticmethod
def getExposure(exp, refIso = 100.0, refFnumber = 1.0):
from pyalicevision import sfmData as avsfmdata

fnumber, shutterSpeed, iso = exp
obj = avsfmdata.ExposureSetting(shutterSpeed, fnumber, iso)
return obj.getExposure()
7 changes: 4 additions & 3 deletions meshroom/nodes/aliceVision/LdrToHdrMerge.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
import math
from collections import Counter

from pyalicevision import sfmData as avsfmdata
from pyalicevision import hdr as avhdr

from meshroom.core import desc
from meshroom.core.utils import COLORSPACES, EXR_STORAGE_DATA_TYPE, VERBOSE_LEVEL

Expand Down Expand Up @@ -247,6 +244,8 @@ class LdrToHdrMerge(desc.AVCommandLineNode):

@classmethod
def update(cls, node):
from pyalicevision import hdr as avhdr

if not isinstance(node.nodeDesc, cls):
raise ValueError("Node {} is not an instance of type {}".format(node, cls))
# TODO: use Node version for this test
Expand Down Expand Up @@ -324,6 +323,8 @@ def update(cls, node):

@staticmethod
def getExposure(exp, refIso = 100.0, refFnumber = 1.0):
from pyalicevision import sfmData as avsfmdata

fnumber, shutterSpeed, iso = exp
obj = avsfmdata.ExposureSetting(shutterSpeed, fnumber, iso)
return obj.getExposure()
Expand Down
7 changes: 4 additions & 3 deletions meshroom/nodes/aliceVision/LdrToHdrSampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
import os
from collections import Counter

from pyalicevision import sfmData as avsfmdata
from pyalicevision import hdr as avhdr

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

Expand Down Expand Up @@ -199,6 +196,8 @@ def processChunk(self, chunk):

@classmethod
def update(cls, node):
from pyalicevision import hdr as avhdr

if not isinstance(node.nodeDesc, cls):
raise ValueError("Node {} is not an instance of type {}".format(node, cls))
# TODO: use Node version for this test
Expand Down Expand Up @@ -281,6 +280,8 @@ def update(cls, node):

@staticmethod
def getExposure(exp, refIso = 100.0, refFnumber = 1.0):
from pyalicevision import sfmData as avsfmdata

fnumber, shutterSpeed, iso = exp
obj = avsfmdata.ExposureSetting(shutterSpeed, fnumber, iso)
return obj.getExposure()

0 comments on commit 0654247

Please sign in to comment.