A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://scikit-learn.org/dev/modules/generated/sklearn.feature_extraction.image.img_to_graph.html below:

img_to_graph — scikit-learn 1.8.dev0 documentation

img_to_graph#

Graph of the pixel-to-pixel gradient connections.

Edges are weighted with the gradient values.

Read more in the User Guide.

Parameters:
imgarray-like of shape (height, width) or (height, width, channel)

2D or 3D image.

maskndarray of shape (height, width) or (height, width, channel), dtype=bool, default=None

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

return_asnp.ndarray or a sparse matrix class, default=sparse.coo_matrix

The class to use to build the returned adjacency matrix.

dtypedtype, default=None

The data of the returned sparse matrix. By default it is the dtype of img.

Returns:
graphndarray or a sparse matrix class

The computed adjacency matrix.

Examples

>>> import numpy as np
>>> from sklearn.feature_extraction.image import img_to_graph
>>> img = np.array([[0, 0], [0, 1]])
>>> img_to_graph(img, return_as=np.ndarray)
array([[0, 0, 0, 0],
       [0, 0, 0, 1],
       [0, 0, 0, 1],
       [0, 1, 1, 1]])

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4