data.GrayscaleImage
self, array, *, adjacency=four_points_adjacency()) data.GrayscaleImage(
A GrayscaleImage
object represents an (n, m)
-shaped scalar array. This object inherits from AbstractGraph
and is regarded as a lattice graph.
Nodes, edges and link_table are compatible with those of Geometry
graphs. Nodes are pixels locating at the 2D integer lattice. Compared to typical lattice graphs, the adjacency of GrayscaleImage
is generalized in the sense that any lattice point is connected to points in its reference ball neighborhood. The ball neighborhood is specified by adjacency
parameter and no entities of the links are maintained. This nontypical adjacency structure is intended to deal with topological noises in grayscale images, and to avoid overuse of memory in the case where the datasize and the ball neighborhood are large.
Parameters
Name | Type | Description | Default |
---|---|---|---|
array | numpy.ndarray |
A two-dimensional numeric array representing a gray-scale image. | required |
adjacency | numpy.ndarray |
A two-dimensional numeric array representing the lattice adjacency. | four_points_adjacency() |
Notes
The adjacency
parameter is intended to use one of the following functions generating such an array.
box_adjacency(r)
: Connects all lattice points within a box of radiusr
.ball_adjacency(p, r)
: Connects all lattice points within an L^p ball of radiusr
.four_points_adjacency()
: Equivalent toball_adjacency(1, 1)
(default).eight_points_adjacency()
: Equivalent tobox_adjacency(1)
Classes
Name | Description |
---|---|
MockLinkTable | A mock link table of GrayscaleImage without maintaining its Edge entities. |
MockLinkTable
data.GrayscaleImage.MockLinkTable(image)
A mock link table of GrayscaleImage without maintaining its Edge entities.
Methods
Name | Description |
---|---|
create_graph | Factory method of GrayscaleImage. |
to_geometry | Convert a given 2D array pict to a grid geometry. |
create_graph
data.GrayscaleImage.create_graph()
Factory method of GrayscaleImage.
to_geometry
data.GrayscaleImage.to_geometry()
Convert a given 2D array pict
to a grid geometry. An edge in a grid geometry links four-point neighbors, whereas a node in a grid geometry consists of properties {'x': i, 'y': j, 'level': pict[i, j], 'geotype': 0}
.
Returns
Name | Type | Description |
---|---|---|
geometry | psiclone.data.Geometry |
A grid geometry. |