Skip to content

Commit

Permalink
Merge pull request #40 from Netflix/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
davisadam10 authored May 17, 2024
2 parents ff9b503 + 5e3a627 commit 2e7ec8a
Show file tree
Hide file tree
Showing 15 changed files with 100 additions and 100 deletions.
9 changes: 5 additions & 4 deletions compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,13 @@ def check_python_is_64_bit() -> bool:


def check_python_version() -> bool:
""" Checks the version of python we have installed is 3.11.6
""" Checks the version of python we have installed is 3.11
Returns: True if python is 3.11.6, False if not
Returns: True if python is 3.11, False if not
"""
return '3.11.6' == platform.python_version()
major_minor_version = '.'.join(platform.python_version().split('.')[:2])
return '3.11' == major_minor_version


def is_git_installed() -> bool:
Expand Down Expand Up @@ -555,7 +556,7 @@ def check_dependencies() -> None:
if not check_python_is_64_bit():
raise RuntimeError("Python must be 64 bit")
if not check_python_version():
raise RuntimeError("Python must be 3.11.6")
raise RuntimeError("Python must be 3.11")
if not is_git_installed():
raise RuntimeError("Git must be installed")
if not is_pkgconfig_installed():
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ numpy==1.26.2
opencolorio==2.3.1
opencv-python==4.8.1.78
packaging==23.2
Pillow==10.3.0
pillow==10.3.0
platformdirs==4.1.0
pluggy==1.3.0
pycodestyle==2.11.1
Expand Down
2 changes: 1 addition & 1 deletion src/open_vp_cal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
Init Module defines a few module level variables
"""
__version__ = "1.0.0-rc.12"
__version__ = "1.0.0"
__authors__ = [
"Adam Davis", "Adrian Pueyo", "Carol Payne", "Francesco Luigi Giardiello", "Daniel Heckenberg"
]
Expand Down
6 changes: 3 additions & 3 deletions src/open_vp_cal/application_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ def run_pre_checks(self, led_walls: List[LedWallSettings]) -> bool:
self.error_message(message)
return False

if led_wall.use_external_white_point:
if not led_wall.external_white_point_file:
if led_wall.use_white_point_offset:
if not led_wall.white_point_offset_source:
self.error_message(f"External White Point Enabled But File Not Set {led_wall.name}")
return False

if not os.path.exists(led_wall.external_white_point_file):
if not os.path.exists(led_wall.white_point_offset_source):
self.error_message(f"External White Point File Set Does Not Exist {led_wall.name}")
return False

Expand Down
8 changes: 4 additions & 4 deletions src/open_vp_cal/core/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,15 @@ class LedWallSettingsKeys:
TARGET_TO_SCREEN_CAT = "target_to_screen_cat"
MATCH_REFERENCE_WALL = "match_reference_wall"
REFERENCE_WALL = "reference_wall"
EXTERNAL_WHITE_POINT_FILE = "external_white_point_file"
USE_EXTERNAL_WHITE_POINT = "use_external_white_point"
WHITE_POINT_OFFSET_SOURCE = "white_point_offset_source"
USE_WHITE_POINT_OFFSET = "use_white_point_offset"
IS_VERIFICATION_WALL = "is_verification_wall"
VERIFICATION_WALL = "verification_wall"
ALL = [NAME, ENABLE_EOTF_CORRECTION, ENABLE_GAMUT_COMPRESSION, AUTO_WB_SOURCE, INPUT_SEQUENCE_FOLDER,
NUM_GREY_PATCHES, PRIMARIES_SATURATION, CALCULATION_ORDER, INPUT_PLATE_GAMUT, NATIVE_CAMERA_GAMUT,
REFERENCE_TO_TARGET_CAT, ROI, SHADOW_ROLLOFF, TARGET_MAX_LUM_NITS, TARGET_GAMUT, TARGET_EOTF,
TARGET_TO_SCREEN_CAT, MATCH_REFERENCE_WALL, REFERENCE_WALL, USE_EXTERNAL_WHITE_POINT,
EXTERNAL_WHITE_POINT_FILE, VERIFICATION_WALL, IS_VERIFICATION_WALL, AVOID_CLIPPING]
TARGET_TO_SCREEN_CAT, MATCH_REFERENCE_WALL, REFERENCE_WALL, USE_WHITE_POINT_OFFSET,
WHITE_POINT_OFFSET_SOURCE, VERIFICATION_WALL, IS_VERIFICATION_WALL, AVOID_CLIPPING]


class PATCHES:
Expand Down
16 changes: 8 additions & 8 deletions src/open_vp_cal/framework/processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ def analyse(self):
target_cs, target_to_screen_cat, native_camera_cs = self._analysis_prep()

reference_wall_external_white_balance_matrix = None
if self.led_wall.match_reference_wall and self.led_wall.use_external_white_point:
raise ValueError("Cannot use external white point and a reference wall")
if self.led_wall.match_reference_wall and self.led_wall.use_white_point_offset:
raise ValueError("Cannot use white point offset and a reference wall")

if self.led_wall.match_reference_wall:
if self.led_wall.reference_wall_as_wall:
Expand All @@ -174,9 +174,9 @@ def analyse(self):
Results.WHITE_BALANCE_MATRIX]

decoupled_lens_white_samples = None
if self.led_wall.use_external_white_point:
if self.led_wall.use_white_point_offset:
decoupled_lens_white_samples = imaging_utils.get_decoupled_white_samples_from_file(
self.led_wall.external_white_point_file)
self.led_wall.white_point_offset_source)

default_wall = LedWallSettings("default")

Expand Down Expand Up @@ -227,8 +227,8 @@ def calibrate(self) -> ProcessingResults:
target_cs, target_to_screen_cat, native_camera_cs = self._analysis_prep()

reference_wall_external_white_balance_matrix = None
if self.led_wall.match_reference_wall and self.led_wall.use_external_white_point:
raise ValueError("Cannot use external white point and a reference wall")
if self.led_wall.match_reference_wall and self.led_wall.use_white_point_offset:
raise ValueError("Cannot use white point offset and a reference wall")

if self.led_wall.match_reference_wall:
if self.led_wall.reference_wall_as_wall:
Expand All @@ -239,9 +239,9 @@ def calibrate(self) -> ProcessingResults:
Results.WHITE_BALANCE_MATRIX]

decoupled_lens_white_samples = None
if self.led_wall.use_external_white_point:
if self.led_wall.use_white_point_offset:
decoupled_lens_white_samples = imaging_utils.get_decoupled_white_samples_from_file(
self.led_wall.external_white_point_file)
self.led_wall.white_point_offset_source)

calibration_results = calibrate.run(
measured_samples=self.led_wall.processing_results.samples,
Expand Down
41 changes: 20 additions & 21 deletions src/open_vp_cal/led_wall_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ def __init__(self, project_settings: "ProjectSettings", name="Wall1"):
constants.LedWallSettingsKeys.TARGET_TO_SCREEN_CAT: constants.CAT.CAT_NONE,
constants.LedWallSettingsKeys.MATCH_REFERENCE_WALL: False,
constants.LedWallSettingsKeys.REFERENCE_WALL: "",
constants.LedWallSettingsKeys.USE_EXTERNAL_WHITE_POINT: False,
constants.LedWallSettingsKeys.EXTERNAL_WHITE_POINT_FILE: "",
constants.LedWallSettingsKeys.USE_WHITE_POINT_OFFSET: False,
constants.LedWallSettingsKeys.WHITE_POINT_OFFSET_SOURCE: "",
constants.LedWallSettingsKeys.IS_VERIFICATION_WALL: False,
constants.LedWallSettingsKeys.VERIFICATION_WALL: "",
constants.LedWallSettingsKeys.AVOID_CLIPPING: True
Expand Down Expand Up @@ -583,41 +583,40 @@ def reference_wall(self, value: Union["LedWallSettings", str]):
self._set_property(constants.LedWallSettingsKeys.REFERENCE_WALL, led_wall.name)

@property
def use_external_white_point(self) -> bool:
""" Whether we are using an external white point for the LED wall or not
def use_white_point_offset(self) -> bool:
""" Whether we are using a white point offset for the LED wall or not
Returns:
bool: Gets whether we want to use an external white point or not
bool: Gets whether we want to use a white point offset or not
"""
return self._led_settings[constants.LedWallSettingsKeys.USE_EXTERNAL_WHITE_POINT]
return self._led_settings[constants.LedWallSettingsKeys.USE_WHITE_POINT_OFFSET]

@use_external_white_point.setter
def use_external_white_point(self, value: bool):
""" Set whether we are using an external white point or not
@use_white_point_offset.setter
def use_white_point_offset(self, value: bool):
""" Set whether we are using a white point offset or not
Args:
value (bool): Whether to use the external white point or not
"""
self._set_property(constants.LedWallSettingsKeys.USE_EXTERNAL_WHITE_POINT, value)
self._set_property(constants.LedWallSettingsKeys.USE_WHITE_POINT_OFFSET, value)

@property
def external_white_point_file(self) -> str:
""" The file which contains an image sample from which we want to calculate the external white point from
def white_point_offset_source(self) -> str:
""" The source which contains an image sample from which we want to calculate the white point offset from
Returns:
str: The filepath which contains the image we want to sample to calculate the external white point from
str: The filepath which contains the image we want to sample to calculate the white point offset from
"""
return self._led_settings[constants.LedWallSettingsKeys.EXTERNAL_WHITE_POINT_FILE]
return self._led_settings[constants.LedWallSettingsKeys.WHITE_POINT_OFFSET_SOURCE]

@external_white_point_file.setter
def external_white_point_file(self, value: str):
""" Set the file which contains an image sample from which we want to calculate the external white point from
@white_point_offset_source.setter
def white_point_offset_source(self, value: str):
""" Set the source which contains an image sample from which we want to calculate the white point offset from
Args:
value (str): The filepath which contains the image we want to sample to calculate the external
white point from
value (str): The filepath which contains the image we want to sample to calculate the white point offset from
"""
self._set_property(constants.LedWallSettingsKeys.EXTERNAL_WHITE_POINT_FILE, value)
self._set_property(constants.LedWallSettingsKeys.WHITE_POINT_OFFSET_SOURCE, value)

@property
def verification_wall(self) -> str:
Expand Down Expand Up @@ -694,7 +693,7 @@ def has_valid_white_balance_options(self) -> bool:
Returns: True or False depending on whether the white balance options are valid or not
"""
values = [self.auto_wb_source, self.match_reference_wall, self.use_external_white_point].count(True)
values = [self.auto_wb_source, self.match_reference_wall, self.use_white_point_offset].count(True)
if values > 1:
return False
return True
64 changes: 32 additions & 32 deletions src/open_vp_cal/widgets/project_settings_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def refresh_default_data(self):
"""
Refreshes the default data dictionary with the current default values from the LedWallSettings class
"""
target_gamut_options = constants.ColourSpace.CS_ALL
target_gamut_options = constants.ColourSpace.CS_ALL.copy()
target_gamut_options.pop(target_gamut_options.index(constants.ColourSpace.CS_ACES))
target_gamut_options.extend(self.project_custom_primaries.keys())
default_led_wall = LedWallSettings(self, constants.DEFAULT)
Expand Down Expand Up @@ -692,9 +692,9 @@ def __init__(self, parent=None):
self.match_reference_wall = QCheckBox()
self.reference_wall = QComboBox()
self.auto_wb_source = QCheckBox()
self.external_white_point_file_button = None
self.use_external_white_point = QCheckBox()
self.external_white_point_file = QLineEdit()
self.white_point_offset_source_button = None
self.use_white_point_offset = QCheckBox()
self.white_point_offset_source = QLineEdit()
self.init_ui()

def init_ui(self):
Expand Down Expand Up @@ -722,17 +722,17 @@ def init_ui(self):
reference_settings_group.setLayout(reference_settings_layout)
main_layout.addWidget(reference_settings_group)

self.external_white_point_file_button = QPushButton("Browse")
external_white_point_file_layout = QHBoxLayout()
external_white_point_file_layout.addWidget(self.external_white_point_file)
external_white_point_file_layout.addWidget(self.external_white_point_file_button)
self.white_point_offset_source_button = QPushButton("Browse")
white_point_offset_source_layout = QHBoxLayout()
white_point_offset_source_layout.addWidget(self.white_point_offset_source)
white_point_offset_source_layout.addWidget(self.white_point_offset_source_button)

external_white_point_group = QGroupBox("External White Point")
external_white_point_layout = QFormLayout()
external_white_point_layout.addRow(QLabel("Use External White Point:"), self.use_external_white_point)
external_white_point_layout.addRow("External White Point File:", external_white_point_file_layout)
external_white_point_group.setLayout(external_white_point_layout)
main_layout.addWidget(external_white_point_group)
white_point_offset_group = QGroupBox("White Point Offset")
white_point_layout = QFormLayout()
white_point_layout.addRow(QLabel("Use White Point Offset:"), self.use_white_point_offset)
white_point_layout.addRow("White Point Offset Source:", white_point_offset_source_layout)
white_point_offset_group.setLayout(white_point_layout)
main_layout.addWidget(white_point_offset_group)

# Add the main widget to the scroll area
scroll.setWidget(main_widget)
Expand Down Expand Up @@ -940,9 +940,9 @@ def __init__(self,
self.model = model
self.reference_wall_widget = self.plate_settings_view.reference_wall
self.match_reference_wall_widget = self.plate_settings_view.match_reference_wall
self.use_external_white_point_widget = self.plate_settings_view.use_external_white_point
self.external_white_point_file_widget = self.plate_settings_view.external_white_point_file
self.external_white_point_file_button_widget = self.plate_settings_view.external_white_point_file_button
self.use_white_point_offset_widget = self.plate_settings_view.use_white_point_offset
self.white_point_offset_source_widget = self.plate_settings_view.white_point_offset_source
self.white_point_offset_source_button_widget = self.plate_settings_view.white_point_offset_source_button

self.reference_wall_widget.setEnabled(
self.match_reference_wall_widget.checkState() == Qt.Checked
Expand Down Expand Up @@ -1012,14 +1012,14 @@ def __init__(self,
self.plate_settings_view.reference_wall.currentIndexChanged.connect(
lambda: self.model.set_data(
constants.LedWallSettingsKeys.REFERENCE_WALL, self.plate_settings_view.reference_wall.currentText()))
self.plate_settings_view.use_external_white_point.stateChanged.connect(
self.plate_settings_view.use_white_point_offset.stateChanged.connect(
lambda: self.model.set_data(
constants.LedWallSettingsKeys.USE_EXTERNAL_WHITE_POINT,
self.plate_settings_view.use_external_white_point.isChecked()))
self.plate_settings_view.external_white_point_file.textChanged.connect(
constants.LedWallSettingsKeys.USE_WHITE_POINT_OFFSET,
self.plate_settings_view.use_white_point_offset.isChecked()))
self.plate_settings_view.white_point_offset_source.textChanged.connect(
lambda: self.model.set_data(
constants.LedWallSettingsKeys.EXTERNAL_WHITE_POINT_FILE,
self.plate_settings_view.external_white_point_file.text()))
constants.LedWallSettingsKeys.WHITE_POINT_OFFSET_SOURCE,
self.plate_settings_view.white_point_offset_source.text()))
self.led_analysis_settings_view.target_to_screen_cat.currentIndexChanged.connect(
lambda: self.model.set_data(constants.LedWallSettingsKeys.TARGET_TO_SCREEN_CAT,
self.led_analysis_settings_view.target_to_screen_cat.currentText()))
Expand Down Expand Up @@ -1048,8 +1048,8 @@ def __init__(self,
self.led_settings_view.gamut_dialog_button.clicked.connect(self.open_custom_gamut_dialog)
self.project_settings_view.output_folder_button.clicked.connect(self.open_folder_select_dialog)
self.project_settings_view.custom_logo_button.clicked.connect(self.open_logo_select_dialog)
self.plate_settings_view.external_white_point_file_button.clicked.connect(
self.open_external_white_point_file_dialog)
self.plate_settings_view.white_point_offset_source_button.clicked.connect(
self.open_white_point_source_dialog)

self.match_reference_wall_widget.stateChanged.connect(self.on_match_reference_wall_changed)
self.model.led_wall_removed.connect(self.on_led_wall_removed)
Expand Down Expand Up @@ -1130,10 +1130,10 @@ def highlight_invalid_settings(self, led_wall_name: str) -> None:

self.plate_settings_view.auto_wb_source.setStyleSheet(style_sheet if led_wall.auto_wb_source else "")
self.match_reference_wall_widget.setStyleSheet(style_sheet if led_wall.match_reference_wall else "")
self.use_external_white_point_widget.setStyleSheet(style_sheet if led_wall.use_external_white_point else "")
self.external_white_point_file_widget.setStyleSheet(style_sheet if led_wall.use_external_white_point else "")
self.external_white_point_file_button_widget.setStyleSheet(
style_sheet if led_wall.use_external_white_point else "")
self.use_white_point_offset_widget.setStyleSheet(style_sheet if led_wall.use_white_point_offset else "")
self.white_point_offset_source_widget.setStyleSheet(style_sheet if led_wall.use_white_point_offset else "")
self.white_point_offset_source_button_widget.setStyleSheet(
style_sheet if led_wall.use_white_point_offset else "")

if led_wall.match_reference_wall and not led_wall.reference_wall:
self.reference_wall_widget.setStyleSheet(error_style_sheet)
Expand All @@ -1151,7 +1151,7 @@ def open_logo_select_dialog(self) -> None:
return
self.model.set_data(constants.ProjectSettingsKeys.CUSTOM_LOGO_PATH, filename)

def open_external_white_point_file_dialog(self)-> None:
def open_white_point_source_dialog(self)-> None:
""" Opens a file dialogue to select an image to use as a reference to an external white point analysis,
and sets the path in the model
"""
Expand All @@ -1161,8 +1161,8 @@ def open_external_white_point_file_dialog(self)-> None:
)
if not filename:
return
self.model.set_data(constants.LedWallSettingsKeys.USE_EXTERNAL_WHITE_POINT, True)
self.model.set_data(constants.LedWallSettingsKeys.EXTERNAL_WHITE_POINT_FILE, filename)
self.model.set_data(constants.LedWallSettingsKeys.USE_WHITE_POINT_OFFSET, True)
self.model.set_data(constants.LedWallSettingsKeys.WHITE_POINT_OFFSET_SOURCE, filename)

def open_folder_select_dialog(self) -> None:
"""
Expand Down
2 changes: 1 addition & 1 deletion src/open_vp_cal/widgets/swatch_analysis_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def update_exposure(self) -> None:
preview_calibration = self.preview_calibration_checkbox.isChecked()
for led_wall in self.led_walls:
if (not led_wall.auto_wb_source and not led_wall.match_reference_wall
and not led_wall.use_external_white_point):
and not led_wall.use_white_point_offset):
apply_white_balance_checked = False
else:
apply_white_balance_checked = self.apply_white_balance_checkbox.isChecked()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"target_to_screen_cat": "None",
"match_reference_wall": false,
"reference_wall": "",
"use_external_white_point": true,
"external_white_point_file": "/Users/adamdavis/dev/workspace/git/netflix-skunkworks/OpenVPCal/tests/resources/Plates/A104_C003_11080B_001.R3D/A104_C003_11080B_001.01397369.exr",
"use_white_point_offset": true,
"white_point_offset_source": "/Users/adamdavis/dev/workspace/git/netflix-skunkworks/OpenVPCal/tests/resources/Plates/A104_C003_11080B_001.R3D/A104_C003_11080B_001.01397369.exr",
"is_verification_wall": false,
"verification_wall": "",
"avoid_clipping": false
Expand Down
Loading

0 comments on commit 2e7ec8a

Please sign in to comment.