Skip to content
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
27 changes: 27 additions & 0 deletions packages/open_vp_cal/src/open_vp_cal/core/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,33 @@ def all() -> list[str]:
""" Returns the list of all Enum values"""
return [member.value for member in LedWallSettingsKeys]


# Properties that are linked between a wall and its verification wall.
# When set on the parent wall, these propagate to the verification wall.
# When accessed on a verification wall, these read from the parent wall.
LINKED_LED_WALL_PROPERTIES: frozenset[str] = frozenset({
LedWallSettingsKeys.AVOID_CLIPPING,
LedWallSettingsKeys.ENABLE_EOTF_CORRECTION,
LedWallSettingsKeys.ENABLE_GAMUT_COMPRESSION,
LedWallSettingsKeys.AUTO_WB_SOURCE,
LedWallSettingsKeys.CALCULATION_ORDER,
LedWallSettingsKeys.PRIMARIES_SATURATION,
LedWallSettingsKeys.INPUT_PLATE_GAMUT,
LedWallSettingsKeys.NATIVE_CAMERA_GAMUT,
LedWallSettingsKeys.NUM_GREY_PATCHES,
LedWallSettingsKeys.REFERENCE_TO_TARGET_CAT,
LedWallSettingsKeys.SHADOW_ROLLOFF,
LedWallSettingsKeys.TARGET_GAMUT,
LedWallSettingsKeys.TARGET_EOTF,
LedWallSettingsKeys.TARGET_MAX_LUM_NITS,
LedWallSettingsKeys.TARGET_TO_SCREEN_CAT,
LedWallSettingsKeys.MATCH_REFERENCE_WALL,
LedWallSettingsKeys.REFERENCE_WALL,
LedWallSettingsKeys.USE_WHITE_POINT_OFFSET,
LedWallSettingsKeys.WHITE_POINT_OFFSET_SOURCE,
})


class PATCHES(StrEnum):
""" Constants to define the names of the patches we use for the calibration, and a small helper function to get the
order of the patches
Expand Down
6 changes: 3 additions & 3 deletions packages/open_vp_cal/src/open_vp_cal/framework/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@

if TYPE_CHECKING:
from OpenImageIO import ImageBuf
from open_vp_cal.project_settings import ProjectSettings
from open_vp_cal.led_wall_settings import LedWallSettings


class Frame:
"""
A class to represent a single frame of an image sequence.
"""

def __init__(self, project_settings: "ProjectSettings"):
def __init__(self, led_wall_settings: "LedWallSettings"):
"""
Initializes a Frame instance with frame number, file name, and image buffer set to None.
"""
self._frame_num = None
self._file_name = None
self._image_buf = None
self._project_settings = project_settings
self._led_wall_settings = led_wall_settings

@property
def frame_num(self) -> int:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def _load_frame(self, frame_num: int) -> Frame:
if not os.path.exists(full_file_path):
raise IOError(f"File {full_file_path} does not exist.")

frame = self.frame_class(self.led_wall_settings.project_settings)
frame = self.frame_class(self.led_wall_settings)
frame.frame_num = frame_num
frame.file_name = full_file_name
frame.image_buf = imaging_utils.load_image(full_file_path)
Expand Down
12 changes: 6 additions & 6 deletions packages/open_vp_cal/src/open_vp_cal/imaging/imaging_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,18 +659,18 @@ def get_scaled_cie_spectrum_bg_image(max_scale: int) -> Oiio.ImageBuf:


def load_image_buffer_to_qimage(buffer: Oiio.ImageBuf,
project_settings: "ProjectSettings") -> QImage:
input_plate_gamut: str) -> QImage:
""" Load an image buffer into a QImage

Args:
buffer: The image buffer to load
project_settings: The project settings we want to use to access the correct ocio config
input_plate_gamut: The input plate gamut colour space name for color conversion

Returns: The QImage loaded from the buffer

"""
buf = apply_color_conversion(
buffer, project_settings.current_wall.input_plate_gamut, "sRGB - Display")
buffer, input_plate_gamut, "sRGB - Display")
with tempfile.NamedTemporaryFile(suffix='.jpg', delete=False) as temp:
res = buf.write(temp.name, Oiio.UINT8)
if not res:
Expand All @@ -684,17 +684,17 @@ def load_image_buffer_to_qimage(buffer: Oiio.ImageBuf,


def load_image_buffer_to_qpixmap(buffer: Oiio.ImageBuf,
project_settings: "ProjectSettings") -> QPixmap:
input_plate_gamut: str) -> QPixmap:
""" Load an Oiio.ImageBuf into a QPixmap so we can display it

Args:
buffer: The image buffer to load
project_settings: The project settings we want to use to access the correct ocio config
input_plate_gamut: The input plate gamut colour space name for color conversion

Returns: The QPixmap loaded from the buffer

"""
image = load_image_buffer_to_qimage(buffer, project_settings)
image = load_image_buffer_to_qimage(buffer, input_plate_gamut)
pixmap = QPixmap.fromImage(
image
)
Expand Down
Loading
Loading