The problem here is to overlay a binary annotation image over a grey-level image. In most of the cases, the Maximum or Minimum operators works well, see further examples at the end of this page. But there are cases where a simple Maximum or Minimum is not appropriate:
Using the maximum of both will not display the number 16 since both use pixel level 255.
Using the bitwise Exclusive-Or operation will not display the number 8 since both use pixel level 128 (7FH XOR FF = 80H).
We need to create a Gating operator, i.e.
The Gating operator combines A and B using C as a selector: