scaled_to_colours: Convert image output from image_to_scaled() to cross-stitches

View source: R/scaled_to_colours.R

scaled_to_coloursR Documentation

Convert image output from image_to_scaled() to cross-stitches

Description

Match raw colour channel values to a smaller subset of colours.

Arguments

image_list

List output from image_to_scaled(). Contains an element Img_scaled.

method

Default 'cie94'. The method to use for colour comparison. Either 'euclidean', 'cie1976', 'cie94', 'cie2000', or 'cmc'. See farver::compare_colour.

colour_table

Defaults to dmc_colours. Data frame of colours to map onto image. Must contain name and red, green, blue channels. See attached data dmc_colours as examples. Original source for dmc_colours is: https://github.com/sharlagelfand/dmc

colour_palette

Used to supply a character vector of specific DMC colours to use. Can be particularly useful in instances where you already have many colours available and maintain a list of their DMC codes. Defaults to NULL - in which case all colours are to be used. Ignored if a colour_table is supplied.

trans_bg

If img is a png has a transparent background, name of colour to replace the background.

dithering

Improves colour of large, photo-realistic mosaics.

n_colours

Optional: Integer representing the maximum number of colours to use. This option selects the n_colours that appear the most, and remaps all other colours to match these n_colours. Otherwise, defaults to NULL.

Value

A list with element Img_lego containing a data frame of the x- & y-coordinates, R, G, B channels, and mapped colour of each brick (pixel).


BenjaminVigreux/embroidr documentation built on June 1, 2022, 12:51 a.m.