in src/open_vp_cal/core/ocio_config.py [0:0]
def get_calibration_and_calibration_preview_cs(
self, led_wall_settings: LedWallSettings, results: dict,
preview_export_filter: bool = True) -> typing.Tuple[ColorSpace, ColorSpace]:
""" Get the calibration colour space for the given led wall, we also get the preview colour space for use in
UI applications
Args:
led_wall_settings: The LED wall settings we want the colour space for
results: The results of the calibration we want to add into the description
preview_export_filter: Whether we want to write out the preview clf or not
Returns: The calibration colour space and the calibration preview colour space
"""
calibration_cs, clf_name = self.get_calibration_cs(led_wall_settings, results)
group = ocio.GroupTransform()
group.appendTransform(self.get_reference_to_target_matrix(led_wall_settings))
calibration_preview_cs = self.get_calibration_preview_cs(led_wall_settings)
group_preview = ocio.GroupTransform()
group_preview.appendTransform(self.get_reference_to_target_matrix(led_wall_settings))
EOTF_CS_string = CalculationOrder.CO_EOTF_CS_STRING
CS_EOTF_string = CalculationOrder.CO_CS_EOTF_STRING
if results[Results.CALCULATION_ORDER] == CalculationOrder.CO_EOTF_CS:
# matrix transform to screen colour space
ocio_utils.populate_ocio_group_transform_for_CO_EOTF_CS(
clf_name, group, self._output_folder, results)
if preview_export_filter:
ocio_utils.populate_ocio_group_transform_for_CO_CS_EOTF(
"_".join([calibration_preview_cs.getName(), CS_EOTF_string]),
group_preview,
self._output_folder, results
)
elif results[Results.CALCULATION_ORDER] == CalculationOrder.CO_CS_EOTF:
ocio_utils.populate_ocio_group_transform_for_CO_CS_EOTF(
clf_name, group,
self._output_folder,
results
)
if preview_export_filter:
ocio_utils.populate_ocio_group_transform_for_CO_EOTF_CS(
"_".join([calibration_preview_cs.getName(), EOTF_CS_string]), group_preview,
self._output_folder,
results
)
else:
raise RuntimeError("Unknown calculation order: " + results[Results.CALCULATION_ORDER])
# gamut compression fixed function
if results[Results.ENABLE_GAMUT_COMPRESSION]:
gamut_comp_group = ocio_utils.create_gamut_compression(results)
group.appendTransform(gamut_comp_group)
group_preview.appendTransform(gamut_comp_group)
# Apply The Inverse Reference To Target Matrix "reverse"
inv_ref_to_target = ocio.MatrixTransform(
numpy_matrix_to_ocio_matrix(results[Results.REFERENCE_TO_TARGET_MATRIX]),
direction=ocio.TransformDirection.TRANSFORM_DIR_INVERSE
)
group.appendTransform(inv_ref_to_target)
group_preview.appendTransform(inv_ref_to_target)
calibration_cs.setTransform(group, ocio.COLORSPACE_DIR_FROM_REFERENCE)
calibration_preview_cs.setTransform(group_preview, ocio.COLORSPACE_DIR_FROM_REFERENCE)
return calibration_cs, calibration_preview_cs