reference
labkit.image.localContrast
Enhance local value-channel contrast with a mean-filter mask.
Syntax
imageOut = labkit.image.localContrast(imageIn, amountPct, radiusPx)Description
Converts imageIn to clamped RGB double and operates on the HSV value channel. A square local mean with width 2*radius+1 forms the low-frequency reference. The difference between the value channel and that mean is multiplied by 1.5*amountPct/100 and added back before clipping.
Hue and saturation are preserved by the adjustment. At image boundaries, the local mean uses only available pixels. This is a lightweight local contrast operation, not adaptive histogram equalization.
Inputs
imageIn- Numeric or logical grayscale, RGB, or multichannel image.
amountPct- Numeric scalar effect strength in percent. Negative values are treated as 0.
radiusPx- Numeric scalar neighborhood radius in pixels. The value is rounded and limited to at least 1.
Outputs
imageOut- M-by-N-by-3 double image with values in [0,1].
Failure Behavior
Unsupported image classes or channel shapes propagate errors from im2double or ensureRgb. amountPct and radiusPx must be numeric scalars; incompatible values raise the originating conversion or indexing error.
Example
imageIn = repmat(linspace(0.2, 0.8, 20), 10, 1);
imageOut = labkit.image.localContrast(imageIn, 40, 3);Related APIs
labkit.image.meanFilter2— Apply normalized 2-D mean filtering with edge correction.labkit.image.sharpen— Apply generic unsharp-mask sharpening.labkit.image.adjustBrightnessContrast— Apply simple brightness and contrast adjustment.labkit.image.adjustHueSaturation— Apply HSV hue and saturation adjustment.labkit.image.assertSupportedPaths— Throw when any path has an unsupported image extension.labkit.image.displayName— Return a short image-file display name.labkit.image.ensureRgb— Return image data with exactly three color channels.labkit.image.fileDialogFilter— Return a file-chooser-compatible image filter.
Source
This page is generated from the MATLAB help text in +labkit/+image/localContrast.m.