reference
labkit.image.sharpen
Apply generic unsharp-mask sharpening.
Syntax
imageOut = labkit.image.sharpen(imageIn, amountPct, radiusPx)Description
Converts imageIn to clamped RGB double and constructs an unsharp mask by subtracting a square local mean from the image. The detail mask is scaled by 2*amountPct/100 and added to the original. Each RGB channel is treated independently, and the result is clamped to [0,1].
radiusPx selects an odd mean-filter width of 2*round(radius)+1, with a minimum width of 3 pixels. This function uses a box blur rather than a Gaussian blur, so radius describes neighborhood size rather than a Gaussian standard deviation.
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 blur radius in pixels. Values below 0.5 are treated as 0.5 before rounding.
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 = zeros(9);
imageIn(3:7, 3:7) = 0.6;
imageOut = labkit.image.sharpen(imageIn, 50, 1);Related APIs
labkit.image.meanFilter2— Apply normalized 2-D mean filtering with edge correction.labkit.image.localContrast— Enhance local value-channel contrast with a mean-filter mask.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/sharpen.m.