diff --git a/gnes/preprocessor/helper.py b/gnes/preprocessor/helper.py index 09e93580..d723a1b9 100644 --- a/gnes/preprocessor/helper.py +++ b/gnes/preprocessor/helper.py @@ -358,6 +358,9 @@ def motion_algo(distances: List[float], **kwargs) -> List[int]: shots = [] num_frames = len(distances) + 1 p = peakutils.indexes(np.array(distances).astype('float32'), thres=arg_dict['threshold'], min_dist=arg_dict['min_dist']) + if len(p) == 0: + return [0, num_frames] + shots.append(0) shots.append(p[0] + 2) for i in range(1, len(p)):