I would like to blend two images, one is smaller and is completely enclosed by the larger one, Assume the both are rectangular. I would like to blend these two so that there is a smooth transition in a rectangular band around the smaller image. I am trying to do this in MATLAB. For example here two images are shown on top of each other, orange and black mages:
I would like to create a transition band around the orange image such that at the very outward boundaries of the band the alpha map for the orange image has a value of 0 and for very inward boundaries have value of 1 and there is a smooth transition from 0 to one inside the gray band that is shown below:
I am looking for a map for the gray area probably a 2-D matrix that has values between 0 and 1. Is there any equation based or ready made such matrix? I know I can create a simple linear transition for a vertical or horizontal band for example if the X shows the x-coordinate of the left most edge of the inner image and my blending width is W then I can use this:
alpha(x) = (x-X)/W for X<x<X+W
1 for x > X+W
But how to create such an alpha in 2-D?