Comment 2 for bug 685919

imreg (imreg) wrote :

Logged In: YES
user_id=1199796

A possible solution might be some kind of extrapolation if
the blending mask covers non-overlapping regions. I think it
could be worth to try some modified blur algorithm to do
this: by calculating the weighted averages for 'missing'
pixels, only the present pixels should be taken in account.
In a formal way,
the value of a grey-scale pixel at position (X,Y) could be
SUM_x( SUM_y( p(x,y)*f( sqrt( (X-x)^2 + (Y-y)^2 ) )*m(x,y) )
) ) / SUM_x( SUM_y( f( sqrt( (X-x)^2 + (Y-y)^2 ) )*m(x,y) )
) ), where
 p(x,y) is the value of the pixel at position (X,y)
 f( d ) is the weight function for the blur
 m(x,y) is 1 if pixel (x,y) present in the image, otherwise 0.
The blur radius (a parameter in function f() ) could be
proportional to the distance of the closest existing pixel
in the source image.