LabKit MATLAB Workbench

reference

API ReferenceImage API

labkit.image.adjustHueSaturation

Apply HSV hue and saturation adjustment.

Syntax

imageOut = labkit.image.adjustHueSaturation(imageIn, hueDeg, saturationPct)

Description

Converts imageIn to clamped RGB double and then to HSV. hueDeg rotates the hue circle and wraps at 360 degrees. Saturation is multiplied by 1 + saturationPct/100 and limited to [0,1]. The HSV value channel is not changed directly.

A saturationPct of -100 or less produces grayscale. Positive saturation increases colorfulness until individual saturation values reach 1.

Inputs

imageIn
Numeric or logical grayscale, RGB, or multichannel image.
hueDeg
Numeric scalar hue rotation in degrees. Values outside one turn are wrapped.
saturationPct
Numeric scalar percent change in HSV saturation.

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. hueDeg and saturationPct must participate in scalar numeric arithmetic; incompatible MATLAB values raise the originating conversion or array-size error.

Example

imageIn = cat(3, ones(2), 0.4*ones(2), zeros(2));
imageOut = labkit.image.adjustHueSaturation(imageIn, 30, 25);

Source

This page is generated from the MATLAB help text in +labkit/+image/adjustHueSaturation.m.