-
Notifications
You must be signed in to change notification settings - Fork 83
Automatically deriving mask for inpainting from alpha channel #22
Comments
@vi @Jake-Shadle I have a prototype of generic pixel support (RGB/RGBA/Luma/LumaA) implemented on austinjones/texture-synthesis/multipixel, but it needs some work. It's just a quick exploration. I tried handling alpha this way: Premultiply alpha and only consider color channels. This makes sense when later compositing: bright red with very low alpha and bright green with very low alpha are actually similar colors when added to anything. I didn't add alpha to the cost computation though, because the correlation with the color channels will cause bias in the cost metric. There were some side effects:
Let me know if you are interested in the code. I can try to fix it up. |
@austinjones, I don't understand the message. The comment seems to be about improving alpha channel support in But this proposal is about using alpha channel instead of separate file with the mask, for UX convenience. Approximately what the script with As far as experimentation shows, begets , with seemingly proper alpha channel. |
For reference, this is my
|
@vi Yes, you are right! I was trying to solve a different problem (support for example transparency). I think what is supported right now is cost computation based on RGB, but pixel copies are on the full RGBA. If you add a bunch of transparent bright red, the cost is computed on bright red. Take a look at k_neighs_to_color_pattern - note the multiplier on the first line is 3, not 4. Transparent bright red is considered bright red when running the matching algorithm. |
I think alpha channel support in matching should be tracked in the separate issue. |
Yeah, sounds like your use case is different @vi. Sorry for the confusion! |
Thanks for the suggestion! It sounds like a useful feature, which can be a part of pre-processing, or be an option if no mask is provided to the inpaint. We don't have any plans to add this atm, but pull requests are of course welcomed! |
Closed by #60 |
Currently inpainting requires specifying two congruent images. It may be more convenient to just specify one image with erased regions (alpha channel).
Current UX:
Desired UX:
The text was updated successfully, but these errors were encountered: