I have two distance maps that describe distances from blue segment and the red segment. I need to compute a single weight map that describes transition from blue segment to the red segment. The weight map should have values in the 0-1 range where 0 is one segment and 1 is the other one.
There are the distance maps with the respective segments highlighted:

Having $d_{1}$ and $d_{2}$ the distances in the first and second image, I tried the following formula for computing the transition weight map:
$$d=\frac{d_{1}-d_{2}+d_{2max}}{d_{1max}+d_{2max}}$$
where $d_{1max}$, $d_{2max}$ are maximum distances found in the first and second image. The numerator have range $<0, d_{1max}+d_{2max}>$ so the result is in $<0,1>$ range. This resulted in the following map:

However, there are sharp transitions between each segment and the map.
I have also tried multiplicative formula:
$$d=\bar{d_{1}}\cdot (1 - \bar{d_{2}})$$
where $\bar{d_{1}}, \bar{d_{2}}$ are distances normalized to $<0,1>$ range. This resulted in little better transition, but still suffers from the same problem:

Do you have any other ideas how to combine the distance maps to obtain transition map?
