Rotation
- tomni.json_operations.rotate_json(json_object: dict, angle: int, img_shape: Union[list, tuple]) dict [source]
Rotate a JSON object (ellipse or polygon) by 0, 90, 180, or 270 degrees.
- Parameters
json_object (dict) – JSON object following the standard AxionBio format (ellipse or polygon).
angle (int) – The angle of rotation. Choose from 0, 90, 180, or 270 degrees.
img_shape (list or tuple) – The shape of the image related to the JSON object, represented as (width, height).
- Returns
A new JSON object with the specified rotation.
- Return type
dict
- Raises
ValueError – If the angle is not one of 0, 90, 180, or 270 degrees.