rgb2gray

Convert RGB image to grayscale.

pure nothrow
Slice!(SliceKind.contiguous, [2], V*)
rgb2gray
(
V
)
(
Slice!(SliceKind.contiguous, [3], V*) input
,
Slice!(SliceKind.contiguous, [2], V*) prealloc = emptySlice!([2], V)
,)

Parameters

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

Input image. Should have 3 channels, represented as R, G and B respectively in that order.

prealloc Slice!(SliceKind.contiguous, [2], V*)

Pre-allocated buffer, where grayscale 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]), it is discarded and allocated anew.

conv Rgb2GrayConvertion

Convertion strategy - mean, or luminance preservation.

Return Value

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

Returns grayscale version of the given RGB image, of the same size.

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

Meta