got c o l o r s ?

22
1 got colors? Color Quantization Techniques Joo Hyun Song

Upload: mira-dillon

Post on 30-Dec-2015

21 views

Category:

Documents


1 download

DESCRIPTION

got c o l o r s ?. Color Quantization Techniques Joo Hyun Song. Outline. Overview Implementation Results and Discussion Concluding Remarks. Overview. What is color quantization? “Color quantization is applied when the color information of an image is to be reduced.“ 1 - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: got  c o l o r s ?

1

got colors?

Color Quantization Techniques

Joo Hyun Song

Page 2: got  c o l o r s ?

2

Outline

• Overview

• Implementation

• Results and Discussion

• Concluding Remarks

Page 3: got  c o l o r s ?

3

Overview

• What is color quantization?– “Color quantization is applied when the color

information of an image is to be reduced.“ 1

– “The most common case is when a 24-bit color image is transformed into an 8-bit color image.” 1

– Used when high-depth color is not supported or necessary.

1 http://www.dai.ed.ac.uk/HIPR2/quantize.htm

Page 4: got  c o l o r s ?

4

Overview (cont’d)

• Main issues concerning color quantization– What are the criteria for colors that are

retained in the resulting image?(How are the ‘important’ colors selected?)

– How ‘accurate’ is the resulting image?(How well are the important features of the image preserved in the resulting image?)

– How fast is the quantization process?

Page 5: got  c o l o r s ?

5

Implementation

• Diversity Algorithm 2

– Color quantization algorithm devised by John Bradley, the creator of the popular UNIX-based imaging software xv.

– The algorithm starts by picking the most populous color (the overall color) of the original image.

– Then the most ‘distant’ colors from the colors in the new color table are picked until the new color table is filled.

– Results in the most ‘diverse’ selection of colors surrounding the overall color.

2 http://www.trilon.com/xv/manual/xv-3.10a/diversity-algorithm.html

Page 6: got  c o l o r s ?

6

Implementation (cont’d)

• Modified Diversity Algorithm 2

– Improvement over the original Diversity Algorithm suggested by Tom Lane of the Independent JPEG Group.

– The modification aims to better balance the allocation between diverse colors and populous colors.

– The alternation strategy is subjective – some strategy works better in certain images while not as good in other.

– Examples in this presentation use the 10-div-pop/div rule.

Page 7: got  c o l o r s ?

7

Implementation (cont’d)

• ImageMagickTM 3 libraries and tools– Provides readily available libraries and tools for

reading, manipulating and writing most of the popular image formats.

• Programming Language of choice: C++– C++ has std::vector and std::map datatypes that

made the histogram and colorMap implementation simpler.

– C++ has a built-in optimized sort() function that can be used for sorting elements in std::vector datatypes.

– Not Java. ;-)

3 http://www.imagemagick.org/

Page 8: got  c o l o r s ?

8

Test Images

Page 9: got  c o l o r s ?

9

Results

• Tested Algorithms– Diversity Algorithm– Modified Diversity Algorithm

• Tested Color Spaces– RGB– YUV– YIQ– XYZ– U*V*W* (not really)

Page 10: got  c o l o r s ?

10

Original Diversity vs. Modified Diversity

Original Diversity Algorithm (RGB) Modified Diversity Algorithm (RGB)

Page 11: got  c o l o r s ?

11

Original Diversity vs. Modified Diversity (cont’d)

Original Diversity Algorithm (RGB) Modified Diversity Algorithm (RGB)

Page 12: got  c o l o r s ?

12

Original Diversity vs. Modified Diversity (cont’d)

Original Diversity Algorithm (RGB) Modified Diversity Algorithm (RGB)

Page 13: got  c o l o r s ?

13

Color Space ComparisonsOriginal RGB

YUV XYZ

Page 14: got  c o l o r s ?

14

Color Space ComparisonsOriginal RGB

YUV XYZ

Page 15: got  c o l o r s ?

15

Color Space ComparisonsOriginal RGB

YUV XYZ

Page 16: got  c o l o r s ?

16

Weird…U*V*W* (supposedly)

Page 17: got  c o l o r s ?

17

My U*V*W* Implementationdouble DecodeUVW(const unsigned int color, const char opt){ double X = DecodeXYZ(color, 'x'); double Y = DecodeXYZ(color, 'y'); double Z = DecodeXYZ(color, 'z');

double x = X/(X+Y+Z); double y = Y/(X+Y+Z);

double u = 4*x/(-2*x+12*y+3); double v = 6*y/(-2*x+12*y+3); double W = 25*pow(100*Y, 1/3)-17;

// Get reference white X = DecodeXYZ(0xFFFFFF, 'x'); Y = DecodeXYZ(0xFFFFFF, 'y'); Z = DecodeXYZ(0xFFFFFF, 'z');

x = X/(X+Y+Z); y = Y/(X+Y+Z);

double u0 = 4*x/(-2*x+12*y+3); double v0 = 6*y/(-2*x+12*y+3);

if(opt == 'u') { return 13*W*(u-u0); } if(opt == 'v') { return 13*W*(v-v0); } if(opt == 'w') { return W; }}

Page 18: got  c o l o r s ?

18

Future Interest

• Investigate more advanced color spaces (such as L*u*v* or IHS).

• Investigate other color metrics (e.g. Riemannian color space).

• Investigate more advanced color quantization algorithms (such as the Neural Networks color quantization algorithm).

Page 19: got  c o l o r s ?

19

Performance of other programs• ImageMagick’s built-in quantizeColors() algorithm

Page 20: got  c o l o r s ?

20

Performance of other programs (cont’d)

• Gimp

Page 21: got  c o l o r s ?

21

What I Have Learned

1. Start EARLY

2. Subjectivity of image quality.

3. Different Color Spaces.

4. Don’t use ImageMagick

Page 22: got  c o l o r s ?

22

Any Questions?