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

Method draw_bbox

deeplabcut/gui/widgets.py:490–508  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

488 self.bbox = [0, 0, 0, 0]
489
490 def draw_bbox(self):
491 frame = None
492 # Read the video until a frame is successfully read
493 while frame is None:
494 frame = self.clip.read_frame()
495 self.bbox[-2:] = frame.shape[1], frame.shape[0]
496 self.ax.imshow(frame[:, :, ::-1])
497
498 self.rs = RectangleSelector(
499 self.ax,
500 self.line_select_callback,
501 minspanx=5,
502 minspany=5,
503 interactive=True,
504 spancoords="pixels",
505 )
506 self.show()
507 self.fig.canvas.start_event_loop(timeout=-1)
508 return self.bbox
509
510 def line_select_callback(self, eclick, erelease):
511 self.bbox[:2] = int(eclick.xdata), int(eclick.ydata) # x1, y1

Callers 3

select_cropping_areaFunction · 0.95
_crop_videoFunction · 0.95
select_cropping_areaFunction · 0.80

Calls 2

read_frameMethod · 0.80
showMethod · 0.80

Tested by

no test coverage detected