Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
450 |
-
dcolor.append(bincount(frame[
|
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))
|