(self, scale, width, height)
| 113 | return list(map(int, self.box)) |
| 114 | |
| 115 | def scale(self, scale, width, height): |
| 116 | new_box = self.to_xywh() |
| 117 | cx, cy, w, h = new_box.get_box() |
| 118 | w = w * scale |
| 119 | h = h * scale |
| 120 | |
| 121 | l = cx - w // 2 |
| 122 | t = cy - h // 2 |
| 123 | r = cx + w - (w // 2) |
| 124 | b = cy + h - (h // 2) |
| 125 | |
| 126 | l = int(max(l, 0)) |
| 127 | t = int(max(t, 0)) |
| 128 | r = int(min(r, width)) |
| 129 | b = int(min(b, height)) |
| 130 | |
| 131 | return Bbox([l, t, r, b], mode="whwh") |
| 132 | |
| 133 | def __repr__(self): |
| 134 | box = self.to_whwh() |
no test coverage detected