<p>You can solve the colors by solving a system of linear equations if you make few assumptions:</p>

<ol>
<li>The alpha of the color wheel is constant (i.e. same for all colors in the wheel)</li>
<li>The beige background extends half way through the color wheel, and is constant for top and bottom halves of the image</li>
<li>The background in the center is constant for all colors</li>
<li>The alpha blending equation is the standard $f=c*\alpha+b*(1-\alpha)$, where $f$ = final color, $c$ = color on the wheel, $b$ = background color, $\alpha$ = alpha of the color wheel</li>
</ol>

<p>If you now pick two colors with the same beige background (e.g. green and yellow), and feed them into the above alpha blending equation you get 4 equations with 4 unknowns, which you can then solve. I.e.</p>

<p>$$f_1=c_1*\alpha+b_1*(1-\alpha)$$
$$f_2=c_1*\alpha+b_2*(1-\alpha)$$
$$f_3=c_2*\alpha+b_1*(1-\alpha)$$
$$f_4=c_2*\alpha+b_2*(1-\alpha)$$</p>

<p>where $f_1$ &amp; $f_2$ = brighter &amp; darker green colors respectively, $f_3$ &amp; $f_4$ = brighter &amp; darker yellow colors respectively, $c_1$ &amp; $c_2$ = the unknown green &amp; yellow colors respectively you try to solve, $\alpha$ = alpha you try to solve, $b_1$ = beige background color, $b_2$ = unknown background color in the center.</p>

<p>Then you can repeat this process for all the colors, or because you solved $\alpha$ you can use this information to solve the rest of the colors simply by:
$$c=\frac{f-(b_1*(1-\alpha))}{\alpha}$$</p>

CC BY-SA 3.0
2017-01-03T23:09:53.143Z
2017-01-04T23:11:45.333Z
2017-01-04T23:11:45.333Z
JarkkoL
<p>I have an <a href="https://i.sstatic.net/oJxCJ.png" rel="nofollow noreferrer">image</a> that I'm trying to recreate programatically using Pyx in Python. It seems that there's an overlaid circle covering the color wheel. I'm trying to see if there's a way to, given the starting and composited RGB values for each of the 8 colors shown in the image, as well as the assumption that the overlaid shape has uniform RGB color and opacity, to find said shape's color and opacity.</p>

<p>However, seeing that I'm not familiar with alpha blending formulae, I'm at a loss as to how to find this out. How could I go about this? I've done some research using the info <a href="https://en.wikipedia.org/wiki/Alpha_compositing" rel="nofollow noreferrer">here</a>, but I can't seem to find a converging answer using the system of equations.</p>

CC BY-SA 3.0
2017-01-03T11:26:27.667Z
Have you got any additional information about the overlay? Perhaps it's not plain alpha blending, but another operator. You could try some of the [Photoshop layer operator equations](http://photoblogstop.com/photoshop/photoshop-blend-modes-explained) instead.
IneQuation
<2d><blending><compositing>
Given a composited image, is it possible to find the color and opacity of an overlaid shape?
Mark LeMoine
# Given a composited image, is it possible to find the color and opacity of an overlaid shape?

(Asked by: username_0 on 2017-01-03)

I have an [image](https://i.sstatic.net/oJxCJ.png) that I'm trying to recreate programatically using Pyx in Python. It seems that there's an overlaid circle covering the color wheel. I'm trying to see if there's a way to, given the starting and composited RGB values for each of the 8 colors shown in the image, as well as the assumption that the overlaid shape has uniform RGB color and opacity, to find said shape's color and opacity.

However, seeing that I'm not familiar with alpha blending formulae, I'm at a loss as to how to find this out. How could I go about this? I've done some research using the info [here](https://en.wikipedia.org/wiki/Alpha_compositing), but I can't seem to find a converging answer using the system of equations.

**Tags:** 2d, blending, compositing

> **Comments:**
> **username_1**: Have you got any additional information about the overlay? Perhaps it's not plain alpha blending, but another operator. You could try some of the [Photoshop layer operator equations](http://photoblogstop.com/photoshop/photoshop-blend-modes-explained) instead.  

---

## 1 answers

### Answer by username_2 on 2017-01-03. Score: 2

You can solve the colors by solving a system of linear equations if you make few assumptions:

1. The alpha of the color wheel is constant (i.e. same for all colors in the wheel)
2. The beige background extends half way through the color wheel, and is constant for top and bottom halves of the image
3. The background in the center is constant for all colors
4. The alpha blending equation is the standard $f=c\*\alpha+b\*(1-\alpha)$, where $f$ = final color, $c$ = color on the wheel, $b$ = background color, $\alpha$ = alpha of the color wheel

If you now pick two colors with the same beige background (e.g. green and yellow), and feed them into the above alpha blending equation you get 4 equations with 4 unknowns, which you can then solve. I.e.

$$f\_1=c\_1\*\alpha+b\_1\*(1-\alpha)$$
$$f\_2=c\_1\*\alpha+b\_2\*(1-\alpha)$$
$$f\_3=c\_2\*\alpha+b\_1\*(1-\alpha)$$
$$f\_4=c\_2\*\alpha+b\_2\*(1-\alpha)$$

where $f\_1$ & $f\_2$ = brighter & darker green colors respectively, $f\_3$ & $f\_4$ = brighter & darker yellow colors respectively, $c\_1$ & $c\_2$ = the unknown green & yellow colors respectively you try to solve, $\alpha$ = alpha you try to solve, $b\_1$ = beige background color, $b\_2$ = unknown background color in the center.

Then you can repeat this process for all the colors, or because you solved $\alpha$ you can use this information to solve the rest of the colors simply by:
$$c=\frac{f-(b\_1\*(1-\alpha))}{\alpha}$$


---

