180 likes | 470 Views
Color Quantization. CS 443 Intro to Imaging and Multimedia. 2D Histogram. 2D Histogram. 3D Histogram. Quantization. Originally: m different colors. Reduce to n distinct colors, minimizing the change in image quality. Scalar Quantization.
E N D
Color Quantization CS 443 Intro to Imaging and Multimedia
Quantization Originally: m different colors Reduce to n distinct colors, minimizing the change in image quality.
Scalar Quantization Replace each component ci of the original color value c with: For each channel: Originally, m = 4096 (12 bit) Reduced to n =256 (8 bit) • Disadv: • Does not depend on color distribution degrades image quality • Reduction ration is not large.
Vector Quantization Replace the original color value c with representative color value ci’ in accordance with color distribution. How to choose representative color?
Vector Quantization • How to choose representative color? • Populosity algorithm: • Determine n most frequent colors c’ ; • Replace original color value with the closest c’ . • Improvement: Group similar colors in larger cells
Vector Quantization • How to choose representative color Group similar colors in larger cells • Median-Cut Algorithm • Calculate 3D color histogram ; • Split the ‘box’ into smaller subboxes s.t. each subbox contains almost equal number of pixels; • Determine representative color c’ for each subbox; • Replace each color c with the representative c’ of the closest subbox.
Vector Quantization • How to choose representative color Group similar colors in larger cells • Median-Cut Algorithm • Calculate 3D color histogram ; • Split the ‘box’ into smaller subboxes s.t. each subbox contains almost equal number of pixels; Split at the median point (w.r.t #pixels) of the longest axis
Vector Quantization • 2. Octree: • Colors arranged in a tree, branching factor =8. • At most K nodes, i.e. colors. • To traverse the tree, choose the closest node
Vector Quantization • 2. Octree: • Colors arranged in a tree, branching factor =8. • At most K nodes, i.e. colors. • To traverse the tree, choose the closest node • Build: • For each new color ci • If #nodes < K, create a new node for ci; • otherwise, merge similar nodes (colors) to keep #colors = K.