Smooth color transition between two areas

you could just throw opencv’s inpaint() at it.

if not, this would need a couple of steps.

first, you need to know the mixing ratio (between outer component and inner component) for those transparent pixels. that can be accomplished with a distance transform for each component. then you know for each transparent pixel its distance to each “shore”, and the sum of that is the distance from shore to shore, through that point. ratio is trivial to calculate.

then you need to know the color value of the nearest pixel of each component. there might be an easy answer for that but I don’t know it.

1 Like