from_circle#

static rlemasklib.RLEMask.from_circle(center, radius, imshape=None, imsize=None)[source]#

Create an RLEMask object representing a filled circle.

Parameters:
  • center – the center of the circle, in the format [x, y]

  • radius – the radius of the circle

  • imshape – [height, width] of the desired mask (either this or imsize must be provided)

  • imsize – [width, height] of the desired mask (either this or imshape must be provided)

Returns:

An RLEMask object where the area of the provided circle has the value 1, and the rest is 0.

Return type:

RLEMask

Examples

Create a circle with center (4, 3) and radius 2.5 in an 8x8 image:

RLEMask.from_circle([4, 3], 2.5, imshape=(8, 8)) ==