@@ -428,6 +428,7 @@ def clf_processing_elements(
428428 use_range : bool = True ,
429429 include_white_balance_in_clf : bool = False ,
430430 flatten_clf : bool = True ,
431+ include_exposure_factor_in_clf : bool = False ,
431432) -> Et .Element :
432433 """
433434 Add the *Common LUT Format* (CLF) elements for given *IDT* matrix,
@@ -449,6 +450,8 @@ def clf_processing_elements(
449450 Whether to include the white balance multipliers in the *CLF*.
450451 flatten_clf
451452 Whether to flatten the *CLF*. into a single 1D Lut & 1 3x3 Matrix
453+ include_exposure_factor_in_clf
454+ Whether to include the exposure factor :math:`k` in the *CLF*.
452455
453456 Returns
454457 -------
@@ -493,14 +496,15 @@ def format_array(a: NDArrayFloat) -> str:
493496 et_max_out_value = Et .SubElement (et_range , "maxOutValue" )
494497 et_max_out_value .text = "1"
495498
496- et_k = Et .SubElement (root , "Matrix" , inBitDepth = "32f" , outBitDepth = "32f" )
497- et_description = Et .SubElement (et_k , "Description" )
498- et_description .text = (
499- 'Exposure factor *k* that results in a nominally "18% gray" object in '
500- "the scene producing ACES values [0.18, 0.18, 0.18]."
501- )
502- et_array = Et .SubElement (et_k , "Array" , dim = "3 3" )
503- et_array .text = f"\n \t \t { format_array (np .ravel (np .diag ([k_factor ] * 3 )))} "
499+ if include_exposure_factor_in_clf :
500+ et_k = Et .SubElement (root , "Matrix" , inBitDepth = "32f" , outBitDepth = "32f" )
501+ et_description = Et .SubElement (et_k , "Description" )
502+ et_description .text = (
503+ 'Exposure factor *k* that results in a nominally "18% gray" object in '
504+ "the scene producing ACES values [0.18, 0.18, 0.18]."
505+ )
506+ et_array = Et .SubElement (et_k , "Array" , dim = "3 3" )
507+ et_array .text = f"\n \t \t { format_array (np .ravel (np .diag ([k_factor ] * 3 )))} "
504508
505509 et_M = Et .SubElement (root , "Matrix" , inBitDepth = "32f" , outBitDepth = "32f" )
506510 et_description = Et .SubElement (et_M , "Description" )
@@ -510,6 +514,11 @@ def format_array(a: NDArrayFloat) -> str:
510514
511515 else :
512516 # If we are flattening the clf we output just a single matrix into the clf
517+
518+ # If we do not include the k factor, we set it to 1.0 so it becomes and identity
519+ # matrix and has no affect
520+ if not include_exposure_factor_in_clf :
521+ k_factor = 1.0
513522 output_matrix = np .diag ([k_factor ] * 3 ) @ matrix
514523 if include_white_balance_in_clf :
515524 output_matrix = np .diag (multipliers ) @ np .diag ([k_factor ] * 3 ) @ matrix
0 commit comments