def diff( self, another: "VideoCutRange", pre_hooks: typing.List[BaseHook], *args, **kwargs, ) -> typing.List[float]: self_picked = self.pick_and_get(*args, **kwargs) another_picked = another.pick_and_get(*args, **kwargs) return toolbox.multi_compare_ssim(self_picked, another_picked, pre_hooks)
def _prune(threshold: float, stages: typing.List[typing.Tuple[str, typing.List[toolbox.VideoFrame]]] ) -> typing.List[typing.Tuple[str, typing.List[toolbox.VideoFrame]]]: logger.debug(f'start pruning ranges, origin length is {len(stages)}, threshold is {threshold}') after = list() for i in range(len(stages)): index, frames = stages[i] for j in range(i + 1, len(stages)): next_index, next_frames = stages[j] ssim_list = toolbox.multi_compare_ssim(frames, next_frames) min_ssim = min(ssim_list) logger.debug(f'compare {index} with {next_index}: {ssim_list}') if min_ssim > threshold: logger.debug(f'stage {index} has been pruned') break else: after.append(stages[i]) return after
def diff(self, another: 'VideoCutRange', *args, **kwargs) -> typing.List[float]: self_picked = self.pick_and_get(*args, **kwargs) another_picked = another.pick_and_get(*args, **kwargs) return toolbox.multi_compare_ssim(self_picked, another_picked)