tech.v3.tensor.color-gradients

Implement a mapping from double->color for each entry in a tensor. Produces an image of the same dimensions in pixels as the input tensor.

Default color schemes are found here: https://reference.wolfram.com/language/guide/ColorSchemes.html

colorize

(colorize src-tens gradient-name & {:keys [data-min data-max alpha? check-invalid? invert-gradient? gradient-default-n], :or {gradient-default-n 200}})

Apply a color gradient to a tensor returning an image. Takes A 1 or 2d tensor. If data-min, data-max aren't provided they are found in the data. A buffered image is returned.

src-tens - Source tensor whose shape determines the shape of the final image.

gradient-name - may be a keyword, in which it must be a key in @gradient-map and these gradients come from: https://reference.wolfram.com/language/guide/ColorSchemes.html. gradient-name may be a tensor of dimensions n 3. gradient-name may be a function that takes a value from 0-1 and returns a tuple of length 3.

Additional arguments: :data-min :data-max - If provided then the data isn't scanned for min and max. If min is equal to 0 and max is equal to 1.0 then the data doesn't need to be normalized. data ranges are clamped to min and max. :alpha? - If true, an image with an alpha channel is returned. This is useful for when your data has NAN or INFs as in that case the returned image is transparent in those sections. :check-invalid? - If true then the data is scanned for NAN or INF's. Used in conjunction with :alpha? :invert-gradient? - When true, reverses the provided gradient. :gradient-default-n - When an IFn is provided, it is quantized over n steps.

Current built-in gradients are: #{:neon-colors :aquamarine :coffee-tones :deep-sea-colors :fuchsia-tones :green-red :red-blue-tones :brass-tones :army-colors :green-pink-tones :green-brown-terrain :thermometer-colors :cherry-tones :atlantic-colors :dark-terrain :fall-colors :rainbow :fruit-punch-colors :solar-colors :dark-bands :avocado-colors :light-temperature-map :sunset-colors :candy-colors :watermelon-colors :beach-colors :island-colors :pastel :gray-yellow-tones :temperature-map :blue-green-yellow :bright-bands :sandy-terrain :gray-tones :rust-tones :pearl-colors :dark-rainbow :valentine-tones :cmyk-colors :mint-colors :lake-colors :pigeon-tones :aurora-colors :plum-colors :alpine-colors :light-terrain :southwest-colors :sienna-tones :brown-cyan-tones :rose-colors :starry-night-colors}

colorize->clj

(colorize->clj src-tens gradient-name & options)

Same as colorize but returns a ND sequence of b g r persistent vectors. For options, see documentation in colorize.

gradient-map

gradient-name->gradient-line

(gradient-name->gradient-line gradient-name invert-gradient? gradient-default-n)

gradient-tens