freealise commited on
Commit
ec8f810
1 Parent(s): 3be64d4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -418,15 +418,17 @@ def optimize(v, d):
418
 
419
  dcolor.append(bincount(frame))
420
  print(dcolor[k])
421
- depth = cv2.imread(depths[k]).astype(np.uint8)
422
- mask = cv2.inRange(frame, np.array([dcolor[k][0]-8, dcolor[k][1]-8, dcolor[k][2]-8]), np.array([dcolor[k][0]+8, dcolor[k][1]+8, dcolor[k][2]+8]))
423
- depth[mask>0] = (255,255,255)
424
- cv2.imwrite(depths[k], depth)
425
 
426
  mask = cv2.convertScaleAbs(cv2.Laplacian(cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY), ddepth, ksize=kernel_size))
427
  mask[mask>0] = 255
428
  frame[mask==0] = (0, 0, 0)
429
  cv2.imwrite(frames[k], frame)
 
 
 
 
 
 
430
 
431
  if d == False:
432
  return frames, "[" + str(dcolor[frame_selected])[1:-1] + ", 255]"
 
418
 
419
  dcolor.append(bincount(frame))
420
  print(dcolor[k])
 
 
 
 
421
 
422
  mask = cv2.convertScaleAbs(cv2.Laplacian(cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY), ddepth, ksize=kernel_size))
423
  mask[mask>0] = 255
424
  frame[mask==0] = (0, 0, 0)
425
  cv2.imwrite(frames[k], frame)
426
+
427
+ depth = cv2.imread(depths[k]).astype(np.uint8)
428
+ depth[mask==0] = (255,255,255)
429
+ mask = cv2.inRange(frame, np.array([dcolor[k][0]-8, dcolor[k][1]-8, dcolor[k][2]-8]), np.array([dcolor[k][0]+8, dcolor[k][1]+8, dcolor[k][2]+8]))
430
+ depth[mask>0] = (255,255,255)
431
+ cv2.imwrite(depths[k], depth)
432
 
433
  if d == False:
434
  return frames, "[" + str(dcolor[frame_selected])[1:-1] + ", 255]"