0

I have a colored image with size 512x512x3. I have used OpenCV's SLIC superpixel segmentation technique to create superpixels from my image as follows:

img = cv2.imread("C://Users//Dell//Desktop//myimage.jpg")
slic = cv2.ximgproc.createSuperpixelSLIC(img, region_size=20, ruler=20.0)
slic.iterate(10)
mask_slic = slic.getLabelContourMask()
cv2.imshow("img_slic", mask_slic)
cv2.waitKey(0)
label_slic = slic.getLabels()
print(label_slic)
number_slic = slic.getNumberOfSuperpixels()
mask_inv_slic = cv2.bitwise_not(mask_slic)
cv2.imshow("img_slic", mask_inv_slic)
cv2.waitKey(0)
img_slic = cv2.bitwise_and(img, img, mask=mask_inv_slic)
cv2.imshow("img_slic", img_slic)
cv2.waitKey(0)
cv2.destroyAllWindows()

Now I want to cluster these superpixels using fuzzy C-means clustering. I found an implementation of fuzzy C-means clustering in the following link: https://pythonhosted.org/scikit-fuzzy/auto_examples/plot_cmeans.html ,
but not able to understand how to change it to make it work for superpixels of an image.

Kindly guide. Thanks.

big tree
  • 47
  • 5

0 Answers0