Mask3 = uint8(cat(3,bMask,bMask,bMask));

output = source.*Mask3 + (target-target.*Mask3);

imshow(output);