Source

Source gradient x

Source gradient y

Target

Target gradient x

Target gradient y

Mask

Combined gradient x

Combined gradient y

Right hand side

Result