<reponame>Rakeshiva/YOLOX-DEEPSORT
# vim: expandtab:ts=4:sw=4
import numpy as np


class Detection(object):

    def __init__(self, tlwh, cls_, confidence, feature):
        self.tlwh = np.asarray(tlwh, dtype=np.float)
        self.cls_ = cls_
        self.confidence = float(confidence)
        self.feature = np.asarray(feature, dtype=np.float32)

    def to_tlbr(self):
        """Convert bounding box to format `(min x, min y, max x, max y)`, i.e.,
        `(top left, bottom right)`.
        """
        ret = self.tlwh.copy()
        ret[2:] += ret[:2]
        return ret

    def to_xyah(self):
        """Convert bounding box to format `(center x, center y, aspect ratio,
        height)`, where the aspect ratio is `width / height`.
        """
        ret = self.tlwh.copy()
        ret[:2] += ret[2:] / 2
        ret[2] /= ret[3]
        return ret

# vim: expandtab:ts=4:sw=4
import numpy as np


class Detection(object):

    def __init__(self, tlwh, cls_, confidence, feature):
        self.tlwh = np.asarray(tlwh, dtype=np.float)
        self.cls_ = cls_
        self.confidence = float(confidence)
        self.feature = np.asarray(feature, dtype=np.float32)

    def to_tlbr(self):
        """Convert bounding box to format `(min x, min y, max x, max y)`, i.e.,
        `(top left, bottom right)`.
        """
        ret = self.tlwh.copy()
        ret[2:] += ret[:2]
        return ret

    def to_xyah(self):
        """Convert bounding box to format `(center x, center y, aspect ratio,
        height)`, where the aspect ratio is `width / height`.
        """
        ret = self.tlwh.copy()
        ret[:2] += ret[2:] / 2
        ret[2] /= ret[3]
        return ret
# vim: expandtab:ts=4:sw=4 Convert bounding box to format `(min x, min y, max x, max y)`, i.e.,         `(top left, bottom right)`. Convert bounding box to format `(center x, center y, aspect ratio,         height)`, where the aspect ratio is `width / height`.