Re: [Gimp-developer] Proposal for erasing background from an image

On 03/02/2017 02:24 AM, John Tapsell wrote:
Hi all,

  I'm guessing this is frowned on but I've written this up on my blog here:

Absolutely not frowned upon :)


Hate to be a buzzkill, but it's already doable: clone tool + color erase mode + registered alignment.

Note that this technique might not work as well as you imagine. For each pair of background/output colors, what you essentially do is pass a ray from the background color, towards the output color, and look for the ray's intersection with the hull of the RGB cube. This point is your foreground color, and the alpha is the relative position of the output color along the background-foreground segment. This means, that all resulting foreground colors are on the hull of the color cube (i.e., fully saturated, including black, or full-value), and, conversely, all output colors that aren't on the hull result in semi-transparent foreground pixels.

Something that might be fun to try is this: suppose you have two pairs of background/background+foreground images, where the backgrounds are different, while the foreground object aligns (as much as possible) across the two images Then, at each pixel, you have two background->output rays, and, ideally, the true foreground color is their point of intersection. Most chances are that the rays won't intersect exactly, because of imperfect alignment/differences in color, but you can still look for the pair of points, one along each ray, that minimize the distance between each other; each one would be the foreground color for the corresponding image pair.

That being said, I imagine you'd need such a controlled environment to get good results with this, while there are usually simpler alternatives, that this strikes me as something that will only be useful is very specialized cases.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]