The median cut algorithm

Share:

Description

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

Usage

1
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.

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.

Value

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

See Also

vbox image_palette