def create_frame(self, f): df = Frame() df.video_id = self.video.pk df.name = f['name'] df.frame_index = f['frame_index'] df.h = f.get('h', 0) df.w = f.get('w', 0) df.t = f.get('t', 0) df.event_id = self.event_to_pk[f['event']] df.segment_index = f.get('segment_index', 0) df.keyframe = f.get('keyframe', False) return df
def create_frame(f,video_obj): df = Frame() df.video = video_obj df.name = f['name'] df.frame_index = f['frame_index'] df.subdir = f['subdir'] df.h = f.get('h',0) df.w = f.get('w',0) df.t = f.get('t',0) df.segment_index = f.get('segment_index',0) df.keyframe = f.get('keyframe',False) return df
def import_frame_json(f, frame_index, event_id, video_id, w, h): regions = [] df = Frame() df.video_id = video_id df.event_id = event_id df.w = w df.h = h df.frame_index = frame_index df.name = f['path'] for r in f.get('regions', []): regions.append(import_region_json(r, frame_index, video_id, event_id)) return df, regions