Module ecaptcha_color

Helpers to lookup / manipulate RGB colors.

Description

Helpers to lookup / manipulate RGB colors

Data Types

channel()

channel() = byte()

color_name()

color_name() = black | white | red | orange | blue | pink | purple

histogram()

histogram(Color) = #{Color => pos_integer()}

palette()

abstract datatype: palette()

rgb()

rgb() = {channel(), channel(), channel()}

Function Index

bin_3b/1
by_name/1
histogram_from_8b_pixels/1Builds a greyscale histogram from 8bit pixels binary.
histogram_map_channel_to_rgb/2Maps 8bit greyscale color histogram to the RGB color.
new/3
new_palette/2Create a palette by mapping Greyscale raster to RGB color.
palette_colors_by_frequency/1Returns a list with colors sorted by their frequency in desc order (most frequent first).
palette_get_index/2Get color index from palette.
palette_size/1Number of colors in palette.

Function Details

bin_3b/1

bin_3b(X1::rgb()) -> binary()

by_name/1

by_name(X1::color_name()) -> rgb()

histogram_from_8b_pixels/1

histogram_from_8b_pixels(Pixels::binary()) -> histogram(channel())

Builds a greyscale histogram from 8bit pixels binary

histogram_map_channel_to_rgb/2

histogram_map_channel_to_rgb(Histogram8b::histogram(channel()), RGB::rgb()) -> [{rgb(), channel(), Freq::pos_integer()}]

Maps 8bit greyscale color histogram to the RGB color.

This is to, kind of, use colors from greyscale as a "saturation" value for RGB color. Or, to convert a greyscale image to a single-color-tone image.

new/3

new(R::channel(), G::channel(), B::channel()) -> rgb()

new_palette/2

new_palette(Pixels::binary(), Color::rgb()) -> palette()

Create a palette by mapping Greyscale raster to RGB color

palette_colors_by_frequency/1

palette_colors_by_frequency(Palette::palette()) -> [rgb()]

Returns a list with colors sorted by their frequency in desc order (most frequent first)

Colors with the same frequency are sorted by value

palette_get_index/2

palette_get_index(Color::channel(), Palette::palette()) -> non_neg_integer()

Get color index from palette

palette_size/1

palette_size(Palette::palette()) -> non_neg_integer()

Number of colors in palette


Generated by EDoc