pycharmers.opencv.tracking module

class pycharmers.opencv.tracking.BBoxLogger(coord_type='xywh', input_path=None, dirname=None, **metadata)[source]

Bases: object

Store Bounding Boxes logs.

Parameters
  • input_path (str) – Path to input image directory or video.

  • coord_type (str) – Coordinate types.

Examples

>>> from pycharmers.utils import pycat
>>> from pycharmers.opencv import BBoxLogger
>>> bbox_logger = BBoxLogger()
>>> bbox_logger.add_bboxes(no=1, bboxes=[(120,120,40,40)])
>>> out_path = bbox_logger.save()
tracking info was saved at /Users/iwasakishuto/.pycharmers/opencv/json/2020-09-25@01.05.18.json
>>> pycat(out_path)
{
"coord_type": "xywh",
"BBoxes": {
    "1": [
    [
        120,
        120,
        40,
        40
    ]
    ]
}
}
init(input_path=None, coord_type='xywh', **metadata)[source]

Initialization of the logs.

add_bboxes(no, bboxes)[source]

Add Bounding Boxes

Parameters
  • no (int) – Frame number.

  • bboxes (list) – List of bounding boxes.

save(out_path=None)[source]

Save the results