compare_anno_marks
FunctionSource
flag: bool = compare_anno_marks(
anno_item_1: AnnoItem | AnnoMark,
anno_item_2: AnnoItem | AnnoMark,
tolearance: float = 0.1,
)
Compare whether two annotation marks are equivalent or not.
The comparison is only performed on the positions. The ID and the comment of the annotation items will not be compared.
Aliases
This function can be acquired by
import dash_picture_annotation as dpa
dpa.compare_anno_marks
dpa.utilities.compare_anno_marks
Arguments
Requires
Argument | Type | Required | |
---|---|---|---|
| AnnoItem | AnnoMark | The annotation items to be compared. | |
tolearance | float | The tolerance used for checking whether positions are the same or not. |
Returns
Argument | Type | |
---|---|---|
flag | bool | A flag. Returns Will return |
Examples
Compare positional information
- Codes
- Results
compare_anno_item_position.py
import pprint
import dash_picture_annotation as dpa
mark = lambda pos: {"x": pos, "y": 0, "width": 0, "height": pos, "type": "RECT"}
mark_eq = lambda pos: {"x": pos, "y": pos, "width": 0, "height": -pos, "type": "RECT"}
pprint.pprint(dpa.compare_anno_marks(mark(17.7), mark(17.7)))
pprint.pprint(dpa.compare_anno_marks(mark(17.7), mark(17.8)))
pprint.pprint(dpa.compare_anno_marks(mark(17.7), mark_eq(17.7)))
pprint.pprint(dpa.compare_anno_marks({"id": mark(17.7)}, mark(17.7)))
True
False
True
False