Clustering, Spectral Clustering, Machine Learning, Data Science, Python.
Load an image img = Image.open('path_to_image.jpg').convert('L') # Convert to grayscale img = np.array(img) # Convert the image into a graph with the value of the gradient on the edges. graph = image.img_to_graph(img) # Take a decreasing function of the gradient: an exponential # The smaller beta