repeat#

rlemasklib.RLEMask.repeat(num_h, num_w, inplace=False)[source]#

Repeat the mask pixels multiple times along the axes.

This method is analogous to np.repeat (not np.tile).

This repeats each pixel in the mask num_h times along the vertical axis and num_w times along the horizontal axis.

Parameters:
  • num_h (int) – the number of times to repeat the mask along the vertical axis

  • num_w (int) – the number of times to repeat the mask along the horizontal axis

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

Returns:

An RLEMask object representing the repeated mask (self if inplace=True)

Return type:

RLEMask

Examples

Repeat each pixel 2x vertically and 3x horizontally (upscales the mask):

.repeat(2, 3) ==

See also

Not to be confused with tile()