| 11 | |
| 12 | # TODO maybe rename this is interfering with scipy namespace |
| 13 | class Interpolate(): |
| 14 | |
| 15 | def __init__(self, session, project, video_file, log): |
| 16 | |
| 17 | self.session = session |
| 18 | self.project = project |
| 19 | self.video_file = video_file |
| 20 | self.log = log |
| 21 | |
| 22 | self.member = get_member(session = session) |
| 23 | |
| 24 | def interpolate_all_sequences_in_video(self): |
| 25 | """ |
| 26 | (All frames) Runs pipeline for frames to be interpolated |
| 27 | |
| 28 | Identify not yet modified key frames? |
| 29 | |
| 30 | - Start at 0 |
| 31 | - Find next keyframe |
| 32 | - Interpolate between those keyframes |
| 33 | - When at last keyframe, end |
| 34 | |
| 35 | """ |
| 36 | |
| 37 | assert self.video_file is not None |
| 38 | |
| 39 | # Careful, the images should be sorted by frame number |
| 40 | # And the instance list too... |
| 41 | # Image list is needed for interpolated images (boxes can access image with box) |
| 42 | |
| 43 | """ |
| 44 | Caution, note that in the new syntax we call |
| 45 | it video_parent_file_id and in the sequence |
| 46 | it's valled video_file_id, but this should be |
| 47 | referring to same thing. |
| 48 | |
| 49 | """ |
| 50 | |
| 51 | sequence_list = self.session.query(Sequence).filter( |
| 52 | Sequence.video_file_id == self.video_file.id, |
| 53 | Sequence.single_frame == False, |
| 54 | Sequence.archived == False |
| 55 | ).all() |
| 56 | |
| 57 | self.log['sequence'] = {} |
| 58 | |
| 59 | if len(sequence_list) == 0: |
| 60 | self.log['sequence']['error'] = {} |
| 61 | self.log['sequence']['error']['error'] = 'No sequences. Click a label to open sequence navigator.' |
| 62 | # Front end (as of 3/16/19 expects a sequence id as second key so double error key) |
| 63 | return |
| 64 | |
| 65 | # QUESTION should we just use a standard serialization method for sequence? |
| 66 | |
| 67 | for sequence in sequence_list: |
| 68 | self.interpolate_sequence(sequence) |
| 69 | |
| 70 | self.log['success'] = True |
no outgoing calls
no test coverage detected