Colorspace Transforms

Consistency with the batch dimension

Since we require the last dimension to be the batch dimension, kindly unsqueeze the last dimension if you would like to pass a single image.

DiffImages.channelifyMethod
channelify(m::AbstractArray{CT,N}) where {CT <: Colorant, N}

Channelify function.

Input should be in $WHN$ order $\implies (*, batch)$. Output will be in the order $(*, channels, batch)$.

Examples

julia> input_size = (16, 16, 2)
(16, 16, 2)

julia> size(channelify(HSV.(rand(BGR,input_size...))))
(16, 16, 3, 2)
source
DiffImages.colorifyMethod
colorify(color::Type{CT}, m::AbstractArray) where CT <: Colorant

Colorify function.

Expecting an input of the type $(*, channels, batch)$. Converts the array to the color specified.

Examples

julia> input_size = (25, 25, 3, 7)
(25, 25, 3, 7)

julia> size(colorify(HSV, rand(input_size...)))
(25, 25, 7)
source