MarcoForte / closed-form-matting

Python implementation of A. Levin D. Lischinski and Y. Weiss. A Closed Form Solution to Natural Image Matting. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), June 2006, New York
MIT License
435 stars 107 forks source link

how to get these parameters:prior,prior_confidence and optional_const_mask? #9

Closed Wennycham closed 6 years ago

Wennycham commented 6 years ago

There is a problem when I use your codes,I don't know how to get these parameters:prior,prior_confidence and optional_const_mask?It would be very kind of you to tell me the method.

merofeev commented 6 years ago

Hi Wennycham! The way to get these parameters depends on your use case. If you have trimap or sribbles-image as additional input your best option is to use helper functions closed_form_matting_with_trimap or closed_form_matting_with_scribbles, so you don't have to worry about computing prior and prior_confidence manually. closed_form_matting_with_prior is the most general interface to Closed Form Matting and should be used only if closed_form_matting_with_trimap and closed_form_matting_with_scribbles don't suit your use case. In that case prior is used to set your prior knowledge about alpha matte, prior_confidence sets per-pixel confidence of that knowledge. Finally, const_mask is used to exclude from optimization problem those pixels that aren't expected to change, and thus reduce memory usage and computation time.