Contents

scikits.learn.feature_extraction.image.img_to_graph

scikits.learn.feature_extraction.image.img_to_graph(img, mask=None, return_as=<class 'scipy.sparse.coo.coo_matrix'>)

Create a graph of the pixel-to-pixel connections with the gradient of the image as a the edge value.

Parameters :

img: ndarray, 2D or 3D :

2D or 3D image

mask : ndarray of booleans, optional

An optional mask of the image, to consider only part of the pixels.

return_as: np.ndarray or a sparse matrix class, optional :

The class to use to build the returned adjacency matrix.