def commit(self):
def draw(img,bboxes):
# img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
for b in bboxes:
xmin,ymin,xmax,ymax = b[:]
cv2.rectangle(img, (xmin,ymin), (xmax,ymax),(255,255,0) ,thickness=2)
return img
def make_frame(t):
idx = t*(self.clip.fps/self.fps)
frm = self.clip.get_frame(t)
height ,width = frm.shape[:2]
for t,bboxes in self.record:
if t==idx:
frm = draw(frm,bboxes)
else:
pass
return frm
new_clip = VideoClip(make_frame, duration=self.clip.duration) # 3-second clip
new_clip.fps=self.clip.fps
new_clip.to_videofile(self.output_path)
评论列表
文章目录