shell_detail_enhance
Enhance image detail at two scales while protecting bright highlights from over-boosting. Optionally apply through a mask or adaptive zone mask, with texture metrics reported.
Instructions
Protected high-pass detail enhancement at two scales, in place. For each scale, detail = image - Gaussian blur of sigma _sigma (locally zero-mean), and result = image + _amount x detail x protection, where protection = exp(-protect_softness x max(0, L - protect_knee) / max(1 - protect_knee, 0.01)) and L is Rec.709 luminance, so the boost attenuates above protect_knee. A scale with amount 0 is skipped. Output is truncated to [0, 1]. It does not hold the peak fixed: the added detail can raise the image maximum (the result reports the image maximum before and after, from full image statistics). With mask_id the enhancement runs through that mask; with auto_zone and no mask_id it builds the adaptive shell zone mask (as create_adaptive_zone_masks with its default core_bias), uses it and closes it, and fails without changing the view if that mask cannot be built; with neither it runs unmasked. Reports before/after texture metrics over pixels between median + 5 x 1.4826 x MAD and 0.98, sampled every 8 pixels: mean squared Sobel gradient, median local standard deviation of 16-pixel blocks that are at least 30% such pixels, and the share of them where protection is below 0.5.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mask_id | No | Mask view to enhance through (optional) | |
| view_id | Yes | View to enhance (modified in place) | |
| auto_zone | No | With no mask_id: build the adaptive shell zone mask and enhance through it. If it cannot be built the call fails and the view is not modified | |
| large_sigma | Yes | Gaussian sigma of the large-scale blur, in pixels | |
| large_amount | Yes | Large-scale detail multiplier (0 skips the scale) | |
| medium_sigma | Yes | Gaussian sigma of the medium-scale blur, in pixels | |
| protect_knee | Yes | Luminance above which the boost attenuates | |
| medium_amount | Yes | Medium-scale detail multiplier (0 skips the scale) | |
| protect_softness | Yes | Attenuation rate above protect_knee (>= 0; higher = steeper) |