This repository was archived by the owner on Feb 22, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -319,7 +319,7 @@ def kmeans_algo(distances: List[float], **kwargs) -> List[int]:
319
319
shots .append (0 )
320
320
for i in range (0 , len (clt .labels_ )):
321
321
if big_center == clt .labels_ [i ]:
322
- shots .append ((i + 2 ))
322
+ shots .append ((i + 1 ))
323
323
if shots [- 1 ] < num_frames :
324
324
shots .append (num_frames )
325
325
else :
@@ -356,18 +356,18 @@ def motion_algo(distances: List[float], **kwargs) -> List[int]:
356
356
arg_dict .update (kwargs )
357
357
358
358
shots = []
359
- num_frames = len (distances ) + 1
359
+ num_frames = len (distances ) + 2 * 2 + 1
360
360
p = peakutils .indexes (np .array (distances ).astype ('float32' ), thres = arg_dict ['threshold' ], min_dist = arg_dict ['min_dist' ]) if len (distances ) else []
361
361
if len (p ) == 0 :
362
362
return [0 , num_frames ]
363
363
364
364
shots .append (0 )
365
- shots .append (p [0 ] + 2 )
365
+ shots .append (p [0 ] + 2 + 1 )
366
366
for i in range (1 , len (p )):
367
367
# We check that the peak is not due to a motion in the image
368
368
valid_dist = arg_dict ['motion_step' ] or not check_motion (distances [p [i ]- arg_dict ['motion_step' ]:p [i ]], distances [p [i ]])
369
369
if valid_dist :
370
- shots .append (p [i ] + 2 )
370
+ shots .append (p [i ] + 2 + 1 )
371
371
if shots [- 1 ] < num_frames - arg_dict ['min_dist' ]:
372
372
shots .append (num_frames )
373
373
elif shots [- 1 ] > num_frames :
You can’t perform that action at this time.
0 commit comments