2.7 KiB
2.7 KiB
AutoWBColorMatch
Overview
AutoWBColorMatch aligns an image’s white balance and global colour characteristics to match a reference. Multiple strategies are available: gray-world and highlight-based white balance, full or luminance-only Reinhard colour transfer in Lab space, or a hybrid pipeline that combines highlight balancing with Reinhard matching.
Inputs
image(IMAGE): Source image tensor[B, H, W, C]. Alpha channels are discarded.reference(IMAGE): Target look that the source should emulate.method(STRING, default"wb_highlight+reinhard"):wb_grayworld– scales channels so the global mean becomes neutral grey.wb_highlight– computes gains from the brightest pixels.reinhard_lab– matches full Lab mean/std to the reference.lab_l_only– matches only the L component in Lab space.wb_highlight+reinhard– performs highlight white balance first, then full Reinhard matching.
percentile(FLOAT, default95.0): Percentile used by the highlight detector whenwb_highlightis involved (range80.0–99.9).strength(FLOAT, default1.0): Blends between the original (0.0) and fully matched result (1.0).clip_gamut(BOOLEAN, defaultTrue): Clamps the final output to[0, 1]after blending.force_size(BOOLEAN, defaultFalse): WhenTrue, resizes both images to the suppliedtarget_width/target_heightbefore computing statistics, then resizes the matched output back to the original resolution.target_width,target_height(INT, defaults1440×1080): Working resolution used whenforce_sizeis enabled.
Outputs
IMAGE: RGB tensor after white balance and colour matching, blended according tostrength.
Processing Notes
- Colour conversions follow the sRGB ↔ linear ↔ XYZ ↔ Lab pipeline with D65 white point constants.
- Highlight-based white balance uses a quantile mask to estimate channel gains, clamping them between 0.5 and 2.0 to avoid extreme corrections.
- Reinhard matching calculates per-image mean and standard deviation in Lab space;
lab_l_onlypreserves chroma while adjusting luminance. - When
force_sizeis active, corrections occur at the specified working resolution for improved speed and comparability; the result is then resampled back to match the original dimensions.
Tips
- Use
wb_highlight+reinhardto neutralise both colour casts and overall contrast in a single step. - Dial down
strengthto keep some of the original styling when the reference is only a loose guide. - Disable
clip_gamutif you plan to perform additional tone mapping afterward and want to preserve unclamped intermediate values.*** End Patch