rgb2gray

Convert RGB image to grayscale.

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

Parameters

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

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

prealloc
Type: 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

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