Skip to main content

ArrayProtocol Objects

Protocol for any object implementing :ref:NumPy array interface <https://numpy.org/doc/stable/reference/arrays.interface.html>

BitmaskCoordinates Objects

__init__

Creates a BitmaskCoordinates object from a NumPy array, or other objects that implement :ref:NumPy array interface <https://numpy.org/doc/stable/reference/arrays.interface.html>, such as Pillow images. EncodedBitmask.rle_string expects an Encord-compatible RLE string. Convert pycocotools/COCO RLE counts with coco_rle_to_encord_rle(). For detailed information please refer to :ref:bitmask tutorial <tutorials/bitmasks:Bitmasks>

from_dict

This method is used to construct object from Encord bitmask dictionary format. In most cases external users don’t need it. Please consider just passing bitmask numpy array compatible object to the BitmaskCoordinates constructor.

to_dict

This method is used to serialize the object to Encord bitmask dictionary format. In most cases external users don’t need it. Please consider using .to_numpy_array method, or just pass this BitmaskCoordinates objects to a constructor of any class that supports numpy array protocol, such as NumPy array, Pillow image, etc.

to_numpy_array

Converts the mask to a 2D numpy array with dtype bool. Numpy needs to be installed for this call to work.