# Redistributing Color in a RGB Image According to a Gaussian Distribution

I haven't done this stuff in a while.

If I have an image $I$ I can equalize the histogram of the image using some opencv procedure, it's already defined. Equalizing an histogram means essentially to construct a function such that applied to each pixel $p \in I$ the new value it's like it had been sampled from a uniform distribution, assuming gray scale image for such explanation.

I don't remember if what I want to do has a specific name, but I kind of remember it was possible, but suppose I have a gaussian distribution (instead of a uniform one), say $\mathcal{N}(0,\Sigma)$, and I want to re-distribute the colors according to such distribution.

Is there a way to do this in opencv?

• Where each pixel is 3 Dimensional Random Variable? – Royi May 3 at 7:37
• Yes, you can consider it like that. – user8469759 May 3 at 7:39
• Have you seen the answer I wrote? – Royi May 12 at 8:27
• Yes, but I haven't implemented it yet – user8469759 May 12 at 8:40

After you equalize the histogram you can think of your data as a stream of variables ${X}_{i}$ where $X \sim U \left[ 0, 1 \right]$.
After you apply this, you can just multiply each RGB pixel in the Cholesky Factorization of $\Sigma$ to get exactly what you need.