Logo elodees  elodees

A caring AI for a better world













Only alphabetic characters accented or not as well as the space are accepted

Logo IA




Superpixel segmentation





No account yet ?

Sign up to access all content




Tested in Anaconda and Python 3.7

from matplotlib import pyplot as plt
 
face_image = plt.imread('pexels-elias-de-carvalho-1375849.jpg')
 
# Import the slic function from segmentation module
from skimage.segmentation import slic
 
# Import the label2rgb function from color module
from skimage.color import label2rgb
 
def show_image(image, title='Image', cmap_type='gray'):
    plt.imshow(image, cmap=cmap_type)
    plt.title(title)
    plt.axis('off')
    plt.show()
 
nb_pixels = 50
 
for i in range(10):
 
    nb_pixels *= 2
 
    # Obtain the segmentation with 400 regions
    segments = slic(face_image, n_segments = nb_pixels)
 
    # Put segments on top of original image to compare
    segmented_image = label2rgb(segments, face_image, kind='avg')
 
    # Show the segmented image
    show_image(segmented_image, "Segmented image, %s superpixels" % (nb_pixels))
 
    plt.imsave('Segmented-image-%s-superpixels.jpg' % (nb_pixels), segmented_image)
 


plotly

License: MITLicenseMIT  Copyright (c) 2019 Leonardo Ferreira


GitHub



100 pixels

Free image provided by pexel.com

200 pixels

Free image provided by pexel.com

400 pixels

Free image provided by pexel.com

800 pixels

Free image provided by pexel.com

1600 pixels

Free image provided by pexel.com

3200 pixels

Free image provided by pexel.com

6400 pixels

Free image provided by pexel.com

12800 pixels

Free image provided by pexel.com

25600 pixels

Free image provided by pexel.com

51200 pixels

Free image provided by pexel.com













Welcome, my name is Eric Soupet and I am the administrator of the site elodees.com. elodees.com is a state of the art of Artificial Intelligence and aims to be collaborative, you can now offer content such as articles, events, tutorials, ... so don't hesitate !

Platform images credit : Pixabay - Pixabay License | Pexels - Pexels License