1
$\begingroup$

I have an image 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, but I can't seem to find a converging answer using the system of equations.

$\endgroup$
  • 1
    $\begingroup$ 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 instead. $\endgroup$ – IneQuation Jan 3 '17 at 11:26
2
$\begingroup$

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}$$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.