MCPcopy Create free account
hub / github.com/DeepLabCut/DeepLabCut / set_bbox

Method set_bbox

deeplabcut/utils/auxfun_videos.py:154–166  ·  view source on GitHub ↗
(self, x1, x2, y1, y2, relative=False)

Source from the content-addressed store, hash-verified

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):

Callers 12

CropVideoFunction · 0.80
__init__Method · 0.80
set_cropMethod · 0.80
extract_framesFunction · 0.80
_crop_videoFunction · 0.80
GetPoseandCostsFFunction · 0.80
GetPoseandCostsSFunction · 0.80
test_reader_read_frameFunction · 0.80
test_writer_bboxFunction · 0.80
test_writer_cropFunction · 0.80

Calls

no outgoing calls

Tested by 3

test_reader_read_frameFunction · 0.64
test_writer_bboxFunction · 0.64
test_writer_cropFunction · 0.64