freealise commited on
Commit
b96fe54
1 Parent(s): 63d7636

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -440,14 +440,15 @@ def optimize(v, d):
440
  # define criteria, number of clusters(K) and apply kmeans()
441
  criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 4, 1.0)
442
  ret,label,center=cv2.kmeans(f,l,None,criteria,4,cv2.KMEANS_RANDOM_CENTERS)
 
443
  # Now convert back into uint8, and make original image
444
  center = np.uint8(center)
445
  res = center[label.flatten()]
446
  frame = res.reshape((frame.shape))
447
 
448
  depth = cv2.imread(depths[k]).astype(np.uint8)
449
- sky = depth[(depth==0).all()]
450
- dcolor.append(bincount(frame[sky>0]))
451
  print(dcolor[k])
452
 
453
  #mask = cv2.convertScaleAbs(cv2.Laplacian(cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY), ddepth, ksize=kernel_size))
 
440
  # define criteria, number of clusters(K) and apply kmeans()
441
  criteria = (cv2.TERM_CRITERIA_EPS + cv2.TERM_CRITERIA_MAX_ITER, 4, 1.0)
442
  ret,label,center=cv2.kmeans(f,l,None,criteria,4,cv2.KMEANS_RANDOM_CENTERS)
443
+ print(label)
444
  # Now convert back into uint8, and make original image
445
  center = np.uint8(center)
446
  res = center[label.flatten()]
447
  frame = res.reshape((frame.shape))
448
 
449
  depth = cv2.imread(depths[k]).astype(np.uint8)
450
+ mask = cv2.cvtColor(depth, cv2.COLOR_RGB2GRAY)
451
+ dcolor.append(bincount(frame[mask==0]))
452
  print(dcolor[k])
453
 
454
  #mask = cv2.convertScaleAbs(cv2.Laplacian(cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY), ddepth, ksize=kernel_size))