bgr2gray

Convert BGR image to grayscale.

Same as rgb2gray, but follows swapped channels if luminance preservation is chosen as convertion strategy.

Slice!(SliceKind.contiguous, [2], V*)
bgr2gray
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 B, G and R respectively in that order.

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

Pre-allocated range, 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 BGR image, of the same size.

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

Meta