area_opening(image, area_threshold=64, connectivity=1, parent=None, tree_traverser=None)
Area opening removes all bright structures of an image with a surface smaller than area_threshold. The output image is thus the largest image smaller than the input for which all local maxima have at least a surface of area_threshold pixels.
Area openings are similar to morphological openings, but they do not use a fixed structuring element, but rather a deformable one, with surface = area_threshold. Consequently, the area_opening with area_threshold=1 is the identity.
In the binary case, area openings are equivalent to remove_small_objects; this operator is thus extended to gray-level images.
Technically, this operator is based on the max-tree representation of the image.
The input image for which the area_opening is to be calculated. This image can be of any type.
The size parameter (number of pixels). The default value is arbitrarily chosen to be 64.
The neighborhood connectivity. The integer represents the maximum number of orthogonal steps to reach a neighbor. In 2D, it is 1 for a 4-neighborhood and 2 for a 8-neighborhood. Default value is 1.
Parent image representing the max tree of the image. The value of each pixel is the index of its parent in the ravelled array.
The ordered pixel indices (referring to the ravelled array). The pixels are ordered such that every pixel is preceded by its parent (except for the root which has no parent).
Output image of the same shape and type as the input image.
Perform an area opening of the image.
We create an image (quadratic function with a maximum in the center and 4 additional local maxima.
This example is valid syntax, but we were not able to check execution>>> w = 12
... x, y = np.mgrid[0:w,0:w]
... f = 20 - 0.2*((x - w/2)**2 + (y-w/2)**2)
... f[2:3,1:5] = 40; f[2:4,9:11] = 60; f[9:11,2:4] = 80
... f[9:10,9:11] = 100; f[10,10] = 100
... f = f.astype(np.int)
We can calculate the area opening:
This example is valid syntax, but we were not able to check execution>>> open = area_opening(f, 8, connectivity=1)
The peaks with a surface smaller than 8 are removed.
See :The following pages refer to to this document either explicitly or contain code examples using this.
skimage.morphology.max_tree.diameter_opening
skimage.morphology.max_tree.area_closing
skimage.morphology.max_tree.area_opening
skimage.morphology.max_tree.diameter_closing
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them