(self, x1, x2, y1, y2, relative=False)
| 152 | return x1, x2, y1, y2 |
| 153 | |
| 154 | def set_bbox(self, x1, x2, y1, y2, relative=False): |
| 155 | if x2 <= x1 or y2 <= y1: |
| 156 | raise ValueError(f"Coordinates look wrong... Ensure {x1} < {x2} and {y1} < {y2}.") |
| 157 | if not relative: |
| 158 | x1 /= self._width |
| 159 | x2 /= self._width |
| 160 | y1 /= self._height |
| 161 | y2 /= self._height |
| 162 | bbox = x1, x2, y1, y2 |
| 163 | if any(coord > 1 for coord in bbox): |
| 164 | warnings.warn("Bounding box larger than the video... Clipping to video dimensions.", stacklevel=2) |
| 165 | bbox = tuple(map(lambda x: min(x, 1), bbox)) |
| 166 | self._bbox = bbox |
| 167 | |
| 168 | @property |
| 169 | def fps(self): |
no outgoing calls