Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random foreground composition vs solving #44

Open
shkarupa-alex opened this issue Apr 6, 2021 · 1 comment
Open

Random foreground composition vs solving #44

shkarupa-alex opened this issue Apr 6, 2021 · 1 comment

Comments

@shkarupa-alex
Copy link

In paper you wrote:

To further increase the dataset diversity, we randomly composite a new foreground object with 50% probability, as in [34].

Could you please provide more details on how exactly you did it. Did you compose foregrounds before or after solving colors in areas where alpha is 0.
And did you do something (maybe mean?) to save correct foreground colors during composition where both fg's alpha is 0?

I noticed that if i compose solved foregrounds it results to dominating "background" fg colors where alpha is 0.

Here is an example of compositioning 2 foregrounds in different order. Look at "orange"/green background.
Снимок экрана 2021-04-06 в 09 25 33

And here is what i've got if solve combined fg one more time (but as i think, double solving could lead to incorrect colors in semitransparent regions)
Снимок экрана 2021-04-06 в 09 28 51

@MarcoForte
Copy link
Owner

Good question.
When compositing a foreground above one another we essentially solve for the foregrounds three times.

  1. Solve for each foreground independently.
  2. Resize/crop the second foreground to be placed on top.
  3. Perform the alpha compositing, using the over operator. https://en.wikipedia.org/wiki/Alpha_compositing
  4. Re-estimate the extended foreground.

To re-estimate the foreground you could use the pymatting library which is quite fast. Faster then the implementation I have on my github.
https://pymatting.github.io/pymatting.foreground.html#module-pymatting.foreground.estimate_foreground_ml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants