(self)
| 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 |
no test coverage detected