freealise commited on
Commit
dceaf40
1 Parent(s): 4a116ab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -129,11 +129,17 @@ def make_video(video_path, outdir='./vis_video_depth', encoder='vits'):
129
  count=0
130
  depth_frames = []
131
  orig_frames = []
 
132
  while raw_video.isOpened():
133
  ret, raw_frame = raw_video.read()
134
  if not ret:
135
  break
136
 
 
 
 
 
 
137
  frame = cv2.cvtColor(raw_frame, cv2.COLOR_BGR2RGB) / 255.0
138
  frame_pil = Image.fromarray((frame * 255).astype(np.uint8))
139
  frame = transform({'image': frame})['image']
 
129
  count=0
130
  depth_frames = []
131
  orig_frames = []
132
+ thumbnail_old = None
133
  while raw_video.isOpened():
134
  ret, raw_frame = raw_video.read()
135
  if not ret:
136
  break
137
 
138
+ thumbnail = cv2.cvtColor(cv2.resize(raw_frame, (128,256)), cv2.COLOR_BGR2GRAY)
139
+ if thumbnail_old != None and (thumbnail == thumbnail_old).all() == True:
140
+ continue
141
+ thumbnail_old = thumbnail
142
+
143
  frame = cv2.cvtColor(raw_frame, cv2.COLOR_BGR2RGB) / 255.0
144
  frame_pil = Image.fromarray((frame * 255).astype(np.uint8))
145
  frame = transform({'image': frame})['image']