Learn R Programming

RImagePalette (version 0.1.1)

median_cut: The median cut algorithm

Description

Cut an rgb cube into two color cubes, each with as imilar number of elements.

Usage

median_cut(image, vbox, iter = 1)

Arguments

image
List An image in list form, with three components: red, green, blue
vbox
List The output of vbox() for the given image. A list of image parameters ("min", "max", "med", "ext" and "volume")
iter
Integer The number attached to the names of the two new images.

Value

Two new images in a list, each separated into rgb components

Details

Represents the rgb colorspace as a cube, with side lengths based on the red, green, and blue extents (difference between maximum and minimum within-color values).

The algorithm takes the side with the largest extent (extent information is passed in via the vbox() parameter), and splits the cube along the median value.

Both halves of the cube are then returned.

See Also

vbox image_palette