34
Color Quantization

Color Quantization

  • Upload
    kirima

  • View
    76

  • Download
    5

Embed Size (px)

DESCRIPTION

Color Quantization. Color Quantization. Common color resolution for high quality images is 256 levels for each Red , Greed , Blue channels, or 256 = 16777216 colors. How can an image be displayed with fewer colors than it contains? - PowerPoint PPT Presentation

Citation preview

Page 1: Color Quantization

Color Quantization

Page 2: Color Quantization

Color Quantization

Common color resolution for high quality images is 256 levels for each Red, Greed, Blue channels, or 256 = 16777216 colors.

How can an image be displayed with fewer colors than it contains?

Select a subset of colors (the colormap or pallet) and map the rest of the colors to them.

3

Page 3: Color Quantization

Color QuantizationWith 8 bits per pixel and color look up table we can display at most 256 distinct colors at a time.

To do that we need to choose an appropriate set ofrepresentative colors and map the imageinto these colors

Page 4: Color Quantization

Color Quantization

2 colors

256 colors

16 colors

4 colors

Page 5: Color Quantization

Quantization phases• Sample the original image for color statistics

• Select color map based on those statistics

• Map the colors to their representative in the color map

• Redraw the image, quantizing each pixelAlgorithm

Mapping…

Page 6: Color Quantization

Naïve Color Quantization

24 bit to 8 bit:

Retaining 3-3-2 most significant bits of the R,G and B components.

Page 7: Color Quantization

3-3-2

Page 8: Color Quantization

3-3-2

Page 9: Color Quantization

Popularity16 colors…

Page 10: Color Quantization

Popularity16 colors…

The reds are not that popular…

Page 11: Color Quantization

Median CutR

G

B

Page 12: Color Quantization

Median Cut

Page 13: Color Quantization

Median Cut

Page 14: Color Quantization

Median Cut

Page 15: Color Quantization

Median Cut

Page 16: Color Quantization

Median Cut

Page 17: Color Quantization

Color_quantization(Image, n){

For each pixel in Image with color C, map C in RGB space;

B = {RGB space};While (n-- > 0) {

L = Heaviest (B);Split L into L1 and L2;Remove L from B, and add L1 and L2 instead;}

For all boxes in B doassign a representative (color centroid);

For each pixel in Image domap to one of the representatives;

}

The median cut algorithm

Page 18: Color Quantization

The median cut algorithm

Is this algorithm image dependent?

What is the Heaviest(B) box?Several factors have to be weighed:

• The total number of image colors in the box.• The total number of DIFFERENT image colors in the box.• The physical size of the box.

Which representative should be chosen for a given color?

• The representative of the box containing the color.• The closest representative under some metric.

Page 19: Color Quantization

A better solution

Page 20: Color Quantization

Median Cut

Page 21: Color Quantization

Generalized Llyod Algorithm - GLA

ei 0icv

1icv

Page 22: Color Quantization

Generalized Llyod Algorithm - GLA

1icv

ei 0icv

Page 23: Color Quantization

Generalized Llyod Algorithm - GLA

2icv

ei

1icv

Page 24: Color Quantization

Original image8 indexed colored

Page 25: Color Quantization

8 indexed colored 32 indexed colored

Page 26: Color Quantization

128 indexed coloredOriginal image

Page 27: Color Quantization

8 levels per channel

that is, 9 bits per pixel

Page 28: Color Quantization

8 bit4 bit24 bit

Page 29: Color Quantization

Original Image

Page 30: Color Quantization

Threshholding

Page 31: Color Quantization

Bayer’s Ordered Dithering

Page 32: Color Quantization

Error Diffusion

Page 33: Color Quantization

Median Cut (4 levels)

Page 34: Color Quantization

Median Cut (8 levels)