rgb2hsv

Convert RGB image to HSV color format.

If HSV is represented as floating point, H is represented as 0-360 (degrees), S and V are 0.0-1.0. If is integral, S, and V are 0-100.

Depending on the RGB (input) type, values are treated in the algorithm to be ranged as 0-255 for ubyte, 0-65535 for ushort, and 0-1 for floating point types.

Slice!(SliceKind.contiguous, [3], R*)
rgb2hsv
pure nothrow
(
R
V
)
(
Slice!(SliceKind.contiguous, [3], V*) input
,
Slice!(SliceKind.contiguous, [3], R*) prealloc = emptySlice!([3], R)
)
if (
isNumeric!R &&
isNumeric!V
)
in { static assert (R.max >= 360, "Invalid output type for HSV (R.max >= 360)"); assert (input.length!2 == 3, "Invalid channel count."); }

Parameters

input
Type: Slice!(SliceKind.contiguous, [3], V*)

RGB image, which gets converted to HSV.

prealloc
Type: Slice!(SliceKind.contiguous, [3], R*)

Pre-allocated range, where HSV image will be copied. Default argument is an empty slice, where new data is allocated and returned. If given slice is not of corresponding shape(range.shape[0], range.shape[1], 3), it is discarded and allocated anew.

Return Value

Type: Slice!(SliceKind.contiguous, [3], R*)

Returns HSV verion of the given RGB image.

Note: Input and pre-allocated slices' strides must be identical.

Meta