merge#

rlemasklib.RLEMask.merge(other, func)[source]#

Merge this mask with another using a Boolean function.

Parameters:
  • other (RLEMask) – the other RLE mask

  • func (rlemasklib.boolfunc.BoolFunc) – the Boolean function to apply

Returns:

A new RLEMask object representing the result of the merge.

Return type:

RLEMask

Examples

XOR keeps pixels where exactly one mask has a foreground pixel:

.merge(, BoolFunc.XOR) ==

See also

merge_custom(), which allows merging with custom n-ary Boolean functions. merge_many(), which allows merging with different binary Boolean functions.