How to show the segmented image?
SuperBruceJia opened this issue · 0 comments
SuperBruceJia commented
Hi,
Thanks for your great work (It is really fast!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!). I really appreciate it.
I used the following codes and wanted to show the output.
import cv2
import numpy as np
from fast_slic import Slic
from PIL import Image
from skimage import io, color
with Image.open("test.jpg") as f:
image = np.array(f)
image = cv2.cvtColor(image, cv2.COLOR_RGB2LAB)
slic = Slic(num_components=35, compactness=10)
assignment = slic.iterate(image) # Cluster Map
out = color.label2rgb(assignment, image, kind='avg', bg_label=-1)
cv2.imshow("superpixels", out)
cv2.waitKey(0)
But it seems that the image cannot be shown.
Is there any solution to this?
Best,
Shuyue