# linear-expansion filter for image (2D array)

I am working in python analyzing 2D arrays and I am looking for a filter or some other routine that would provide a linear expansion of an region boundaries in a 2D array with binary regions (i.e. a black/white image). For example given this star image:

I would like to apply a filter that expands a region's borders with a radial, linear decrease from a maximal value (i.e. black) to the surrounding value. Graphically represented as:

So that the resulting image/array is something like:

• I did not got your problem, by expansion do you mean you'd like to to enlarge the image (i.e. scale up)? – MimSaad Jan 28 at 15:24
• Hi MimSaad, I do not want to change the values in the original region, but I want a bordering region that changes linearly towards the values in the surrounding region. This is shown schematically in the middle figure of my post. – Robert Clement Jan 28 at 15:32
• The linear constraint is the hard one. Mainly since it is 2D world so it should be linear in which direction? If you mean smooth, than any blur should do it. – Royi Feb 28 at 8:36

im2 = imresize(image, 10, 'nearest')