<p>I don't know if this counts as an <em>objective</em> question, but...</p>

<p>Say I have an image in RGB space $C=[0,1]^3$ and I wanted to resample it to a restricted palette of $P_1,\ldots,P_n\in C$: Would it be appropriate to check which Voronoi cell, generated by the $P$s and bounded by the edges of $C$, a particular colour fell in and then match that to its respective $P_i$?</p>

<p>Clearly generating the Voronoi diagram for the $P$s would be a bit excessive; but if $n$ is relatively small, we could just check which $P_i$ is closest to an arbitrary colour in $C$. That would be pretty efficient.</p>

<hr>

<p><strong>EDIT</strong> It occurred to me that this method could be extended to also dither the image: Check the distances from your colour $x\in C$ to each $P_i$. If $x=P_i$, for some $i$, then we're good; otherwise, calculate the metric $d(x,P_i),\forall i$ and, <em>rather</em> than choose the closest, weight them inverse-proportionally and then "probabilistically" pick one.</p>

<p>For example, restricting to $C=[0,1]$, we have $x=0.1$ and $P_1=0.01$, $P_2=0.3$. Then $\mathbb{P}(x\mapsto P_i) = d(x,P_i)^{-1}\div\sum_{j=1}^nd(x,P_j)^{-1}$; so $\mathbb{P}(x\mapsto P_1)\approx69\%$ and $\mathbb{P}(x\mapsto P_2)\approx31\%$.</p>

CC BY-SA 3.0
2013-10-26T10:00:49.897Z
"would it be appropriate" sounds like a modeling question. Isn't the only real answer "it depends on what you want" ?
Suresh Venkat
CC BY-SA 3.0
2013-10-26T11:01:43.283Z
Point taken, hence my proviso at the top of the question. I guess what I'm asking, therefore, is: "Is this a known/accepted/standard quantisation method and are there any caveats one should be aware of?"
Xophmeister
<image-processing>
Colourspace Quantisation using Voronoi Diagrams
Xophmeister
# Colourspace Quantisation using Voronoi Diagrams

(Asked by: username_0 on 2013-10-24)

I don't know if this counts as an *objective* question, but...

Say I have an image in RGB space $C=[0,1]^3$ and I wanted to resample it to a restricted palette of $P\_1,\ldots,P\_n\in C$: Would it be appropriate to check which Voronoi cell, generated by the $P$s and bounded by the edges of $C$, a particular colour fell in and then match that to its respective $P\_i$?

Clearly generating the Voronoi diagram for the $P$s would be a bit excessive; but if $n$ is relatively small, we could just check which $P\_i$ is closest to an arbitrary colour in $C$. That would be pretty efficient.

---

**EDIT** It occurred to me that this method could be extended to also dither the image: Check the distances from your colour $x\in C$ to each $P\_i$. If $x=P\_i$, for some $i$, then we're good; otherwise, calculate the metric $d(x,P\_i),\forall i$ and, *rather* than choose the closest, weight them inverse-proportionally and then "probabilistically" pick one.

For example, restricting to $C=[0,1]$, we have $x=0.1$ and $P\_1=0.01$, $P\_2=0.3$. Then $\mathbb{P}(x\mapsto P\_i) = d(x,P\_i)^{-1}\div\sum\_{j=1}^nd(x,P\_j)^{-1}$; so $\mathbb{P}(x\mapsto P\_1)\approx69\%$ and $\mathbb{P}(x\mapsto P\_2)\approx31\%$.

**Tags:** image-processing
> **Comments:**
> **username_1**: "would it be appropriate" sounds like a modeling question. Isn't the only real answer "it depends on what you want" ?  
> **username_0**: Point taken, hence my proviso at the top of the question. I guess what I'm asking, therefore, is: "Is this a known/accepted/standard quantisation method and are there any caveats one should be aware of?"  

---

## 0 answers

