contours2json

tomni.transformers.contours2json(contours: Union[numpy.ndarray, List[list]]) List[dict][source]

Convert a list or array of contours into a list of JSON objects in standard AxionBio format.

Parameters

contours (numpy.ndarray or list) – Contours produced by OpenCV, represented as a NumPy array or a list.

Returns

A list of JSON objects, where each JSON object represents a contour as a polygon.

Return type

List[dict]