Hi,
Is there any method to create a smooth color transition between two areas in an image? For example, how to fill the “empty” area (alpha channel=0) in the image below so that there is a smooth color transition between the white and colored areas? Do you have any hint? Thanks!
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