本文整理汇总了Python中tracker.Tracker.start_track方法的典型用法代码示例。如果您正苦于以下问题:Python Tracker.start_track方法的具体用法?Python Tracker.start_track怎么用?Python Tracker.start_track使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tracker.Tracker
的用法示例。
在下文中一共展示了Tracker.start_track方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: VideoWidget
# 需要导入模块: from tracker import Tracker [as 别名]
# 或者: from tracker.Tracker import start_track [as 别名]
#.........这里部分代码省略.........
def adjust_track_bboxes(self, bbox):
self.annotation.interpolate(self.tube_id, bbox, self.last_keyframe,
self.cursor())
@pyqtSlot(VideoFrame)
def update_frame(self, frame):
# get bounding boxes of current tube and other tubes
bboxes = dict()
if (self.tracker is not None and self.video.is_forward() and
self.cursor() > self.annotation.tube_end(self.tube_id)):
bboxes['current_tube'] = self.track(frame)
self.annotation.set_bbox(self.tube_id, self.cursor(),
bboxes['current_tube'])
else:
bboxes['current_tube'] = self.annotation.get_bbox(
self.tube_id, self.cursor())
bboxes['other_tubes'] = self.annotation.get_bboxes(
self.cursor(), self.tube_id)
# show the frame and corresponding bounding boxes
self.label_frame.display(frame)
self.label_frame.update_bboxes(bboxes)
# update slider position
if self.with_slider:
self.slider.setValue(
int(self.slider.maximum() * frame.id / self.frame_cnt()))
# emit the frame id to the main window to update status bar
self.frame_updated.emit(frame.id)
@pyqtSlot(BoundingBox)
def set_tracker(self, bbox):
if self.tracker is not None and self.cursor() > self.last_keyframe + 1:
self.adjust_track_bboxes(bbox)
self.tracker = Tracker()
self.tracker.start_track(self.current_frame(), bbox)
self.annotation.set_bbox(self.tube_id, self.cursor(), bbox)
@pyqtSlot()
def del_tracker(self):
self.clear_tracker()
self.annotation.del_later_bboxes(self.tube_id, self.cursor())
self.annotation.save()
tube_info = self.annotation.tube(self.tube_id).to_dict(with_bboxes=False)
self.tube_annotated.emit(tube_info)
self.reset_tube_id()
@pyqtSlot()
def on_slider_released(self):
progress = self.slider.value() / self.slider.maximum()
frame_id = max(int(round(self.frame_cnt() * progress)), 1)
self.jump_to_frame(frame_id)
@pyqtSlot(int)
def jump_to_tube(self, tube_id):
self.tube_id = tube_id
self.jump_to_frame(self.annotation.tube_start(tube_id))
@pyqtSlot(int)
def del_tube(self, tube_id):
if self.tube_id == tube_id:
self.tube_id = 0
self.annotation.del_tube(tube_id)
self.annotation.save()
@pyqtSlot(int, str)
def change_tube_label(self, tube_id, label):
self.annotation.tubes[tube_id].label = label