encukou/test-0 — Issue #69: Hue
Author: encukou
Created: 2011-11-03 19:25:44+00:00
State: open
Labels: feature, involved, low-priority, pok-mon pages

**Reported by [Eevee](http://bugs.veekun.com/users/1) on 2010/04/18 01:01:50 +0000 · Migrated from [Redmine issue 198](http://bugs.veekun.com/issues/198)**

---

Extract average hue from sprites. Show it on Pokémon pages, allow searching (!) and sorting by it.

Redmine metadata:
Updated on: 2010/10/08 08:01:02 +0000
Start date: 2010/04/18

---

**Comment by [Zhorken](http://bugs.veekun.com/users/8) from 2010/04/18 13:51:09 +0000**

hahahah seriously? \~ Awesome \~. Also remember:
except do magic to make less saturated pixels count less so that Latias doesn’t end up purple and Abomasnow doesn’t end up bluish
then the only problem will be Manectric and who cares

---

**Comment by [En-Cu-Kou](http://github.com/encukou) from 2010/04/20 17:16:45 +0000**

The average hue approach has several problems:

* Sorting by it can only produce a rainbow-looking list, which might be cool, but it’s pretty useless.

* It can’t distinguish a Dewgong from an Umbreon.

* There are many multi-color pokémon. Extracting the average hue doesn’t make any sense for these.

I’ve played around a bit and came up with a different way: select a set of base colors[1], and then calculate the mean perceptual difference[2] between each pixel and base color. It solves the problems above, but of course has its own.

* You can sort by a single color: “redness”, “greenness”, etc.

* Sorting by red+white gives: Electrode, Luvdisc, Voltorb, Goldeen.

- You can’t search for an exact hue. I’m not sure if that would have been helpful, though.
- Actually, you can’t really search, just sort. (Or you can fake it with a threshold.) But it’s the same with hue, except hue has the problem with wrapping at 0°.
- Pokémon that are exactly my selected base color get better matches than those with different tones. Could probably be solved by some kind of thresholding.
- It’s heavier on the database, especially if you’re a fan of normalized schemata.

See [http://cs.joensuu.fi/\~pviktor/other/colors](http://cs.joensuu.fi/~pviktor/other/colors)/

[1] I went with red, pink, blue, *aqua*, green, yellow, *orange*, brown, purple, white, gray, black. Any can be dropped if not relevant enough.
[2] [http://en.wikipedia.org/wiki/Color\_difference](http://en.wikipedia.org/wiki/Color_difference) - CIEDE2000 is probably overkill, but it was the default…

---

**Comment by [Eevee](http://bugs.veekun.com/users/1) from 2010/10/08 08:01:02 +0000**

Assignee ⇨ —