-
Notifications
You must be signed in to change notification settings - Fork 62
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
compose two fg maybe has one error ? #12
Comments
Hi, thanks for your interest. There are many feasible ways to merge two foreground images and a background together. Here, we see fg2 as a background image, and we composite fg and fg2 for a new foreground image by coefficients alpha and (1-alpha). alpha_tmp is a synthesized and acceptable alpha image. If the coefficients are alpha and (1-alpha2), it is not a convex combination and might overflow. If you want the merging to be more reasonable, you can let fg = alpha1*(1-alpha2)/(1-(1-alpha1)*(1-alpha2))fg1 + alpha2/(1-(1-alpha1)(1-alpha2))*fg2, and still alpha = 1 - (1 - alpha) * (1 - alpha2). It means you merge fg1 with bg by alpha1 first, and then merge fg2 with the composition by alpha2. |
in dataloader/data_gernerator.py _composite_fg function
alpha_tmp = 1 - (1 - alpha) * (1 - alpha2)
fg = fg.astype(np.float32) * alpha[:,:,None] + fg2.astype(np.float32) * (1 - alpha[:,:,None])
when compute new fg, the fg2 multiple (1-alpha) , but should fg2 muliple (1-alpha2) ?
https://github.com/Yaoyi-Li/GCA-Matting/blob/master/dataloader/data_generator.py#L520
The text was updated successfully, but these errors were encountered: