Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -410,12 +410,13 @@ def optimize(v, d):
|
|
410 |
quantiz = np.int0(np.linspace(0,255,l)) # we get quantization colors
|
411 |
color_levels = np.clip(np.int0(indices/divider),0,l-1) # color levels 0,1,2..
|
412 |
palette = quantiz[color_levels]
|
413 |
-
|
|
|
414 |
for k, f in enumerate(frames):
|
415 |
frame = cv2.imread(frames[k]).astype(np.uint8)
|
416 |
frame = cv2.convertScaleAbs(palette[frame]).astype(np.uint8) # Converting image back to uint
|
417 |
cv2.imwrite(frames[k], frame)
|
418 |
-
dcolor
|
419 |
print(dcolor[k])
|
420 |
depth = cv2.imread(depths[k]).astype(np.uint8)
|
421 |
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]))
|
|
|
410 |
quantiz = np.int0(np.linspace(0,255,l)) # we get quantization colors
|
411 |
color_levels = np.clip(np.int0(indices/divider),0,l-1) # color levels 0,1,2..
|
412 |
palette = quantiz[color_levels]
|
413 |
+
|
414 |
+
dcolor = []
|
415 |
for k, f in enumerate(frames):
|
416 |
frame = cv2.imread(frames[k]).astype(np.uint8)
|
417 |
frame = cv2.convertScaleAbs(palette[frame]).astype(np.uint8) # Converting image back to uint
|
418 |
cv2.imwrite(frames[k], frame)
|
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]))
|