0

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:

enter image description here

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:

enter image description here

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?

TJ1
  • 7,578
  • 19
  • 76
  • 119
  • @Will do you mean I should post it somewhere else on stack exchange? – TJ1 Jul 25 '17 at 14:13
  • Maybe? But just dropping a requirement in a question isn't exactly appreciated around SE. You haven't exactly described what you have tried & why it didn't work, let alone *how* you mean to accomplish this. I don't know if you're looking for a way to do it in Photoshop, or a generic algorithm, or code to do this using cocos2d. –  Jul 25 '17 at 14:17
  • 1
    Thank you so much you are correct I will update this as I am trying to do it mathematically for example in MATLAB. – TJ1 Jul 25 '17 at 14:18

0 Answers0