Advertisement

Separation of alpha blended overlays

Started by February 22, 2009 11:35 PM
1 comment, last by Emergent 15 years, 9 months ago
Suppose I have an image z with alpha mask α, and that the pixels of α have only 2 possible values: 0 and α0. Suppose I then take a sequence of n images y(1..n) and blend them all with z to form n new images x(1..n). i.e. x(i) = (1-α)*y(i) + α*z (also, the ys are not necessarily related like frames of a movie would be.) Now, given only x(1..n) and α0, can we approximate z? I understand that the blending is not a reversible transformation in general, but if we make some assumptions about z for example, smoothness, independence from the y images, etc, is there a method for this? (Links to papers are OK.) Thanks, Melekor PS: Wasn't sure if I should post this in math, graphics or AI, but in the end it seems most like an AI problem :)
The first thing I would try is min(x(i))/a , taking the minimum pixel by pixel and color component by color component. What you get here is an upper bound of what each number forming z can be. If this doesn't give you satisfactory results, it's possible that you can do better, but it probably won't be easy. Perhaps you can do something like using some transform (something like FFT or wavelet), taking averages, setting small values to 0 and transforming back. Just the first two things that came to mind.

[EDIT: I actually misread the problem. I'll think about it some more. In the meantime, disregard what I said above.]

[Edited by - alvaro on February 23, 2009 5:35:47 PM]
Advertisement
You could treat it as a minimization problem, e.g.,

\min_{y_i, \alpha_i | i \in 1,\ldots,N; z} \sum_i \sum_{u,v}\left[ \left( (1 - \alpha_i[u,v]) y_i[u,v] + \alpha_i[u,v] z[u,v] - x_i[u,v] \right)^2 + c_1 \frac{\alpha_i^2[u,v](\alpha_i[u,v]-\alpha_0)^2}{(\alpha_i[u,v] - \frac{1}{2}\alpha_0)^2 + c_2} \right]

(where c_1, c_2 are just constants that you choose. Roughly, c_1 is the importance of alpha not being outsize the range [0, alpha_0], and c_2 is inversely proportional to the importance of alpha not being between 0 and alpha_0. So that whole term there tends to make all alphas either 0 or alpha_0.)

If you wanted, you could also add a "smoothness term," e.g.,

\sum_i \sum_{u,v}\left[ (y_i[u,v]-y_i[u-1,v])^2 + (y_i[u,v]-y_i[u+1,v])^2 + (y_i[u,v]-y_i[u,v-1])^2 + (y_i[u,v]-y_i[u,v+1])^2 \right]

How would you actually go about solving this? For a first attempt, you could just try gradient descent.

This topic is closed to new replies.

Advertisement