shift#

rlemasklib.RLEMask.shift(offset, border_value=0, inplace=False)[source]#

Shift (translate) the mask by an offset vector.

Parameters:
  • offset (Sequence[int]) – the offset vector [dy, dx]

  • border_value (int) – the value to pad with (0 or 1)

  • inplace (bool) – whether to perform the operation in place or to return a new object

Returns:

The RLEMask object representing the shifted mask (self if inplace=True)

Return type:

RLEMask

Examples

Shift right and down by 2 pixels:

.shift((2, 2)) ==