xu3kev commited on
Commit
d99193a
1 Parent(s): c82c53d

Update myturtle_cv.py

Browse files
Files changed (1) hide show
  1. myturtle_cv.py +6 -1
myturtle_cv.py CHANGED
@@ -204,7 +204,12 @@ class Turtle:
204
  import imageio.v3 as iio
205
  frames_rgb = [cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) for frame in self.frames]
206
  print(f'number of frames: {len(frames_rgb)}')
207
- frames_rgb.extend(FPS*2 * [frames_rgb[-1]])
 
 
 
 
 
208
 
209
  frames_rgb = crop_and_scaled_imgs(frames_rgb)
210
  # iio.imwrite(path, np.stack(frames_rgb), fps=30, plugin='pillow')
 
204
  import imageio.v3 as iio
205
  frames_rgb = [cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) for frame in self.frames]
206
  print(f'number of frames: {len(frames_rgb)}')
207
+ last = frames_rgb[-1]
208
+ if len(frames_rgb)>=1000:
209
+ skip_ratio = len(frames_rgb)//1000
210
+ frames_rgb = frames_rgb[0::skip_ratio]
211
+ frames_rgb.extend(FPS*2 * [last])
212
+ print(f'number of frames: {len(frames_rgb)}')
213
 
214
  frames_rgb = crop_and_scaled_imgs(frames_rgb)
215
  # iio.imwrite(path, np.stack(frames_rgb), fps=30, plugin='pillow')