Last modified: November 20, 2009
Contents
despeckle (int(1, 100) cc_size)
Operates on: | Image [OneBit] |
---|---|
Category: | Morphology |
Defined in: | morphology.py |
Author: | Michael Droettboom and Karl MacMillan |
Removes connected components that are smaller than the given size.
This approach to finding connected components uses a pseudo-recursive descent, which gets around the hard limit of ~64k connected components per page in cc_analysis. Unfortunately, this approach is much slower as the connected components get large, so size should be kept relatively small.
size == 1 is a special case and runs much faster, since it does not require recursion.
Example 1: despeckle(5)
Example 2: despeckle(15)
Image [OneBit|GreyScale|Float] dilate ()
Operates on: | Image [OneBit|GreyScale|Float] |
---|---|
Returns: | Image [OneBit|GreyScale|Float] |
Category: | Morphology |
Defined in: | morphology.py |
Author: | Michael Droettboom and Karl MacMillan |
Dilates the image by the image morphology method.
Example 1: dilate()
Example 2: dilate()
Image [OneBit] dilate_with_structure (Image [OneBit] structuring_element, Point origin, bool only_border = False)
Operates on: | Image [OneBit] |
---|---|
Returns: | Image [OneBit] |
Category: | Morphology |
Defined in: | morphology.py |
Author: | Christoph Dalitz |
Performs a binary morphological dilation with the given structuring element.
Note that it is necessary to specify which point in the structuring element shall be treated as origin. This allows for arbitrary structuring elements. Examples:
# same as image.dilate()
structure = Image(Point(0,0), Point(2,2), ONEBIT)
structure.fill(1)
image = image.dilate_with_structure(structure, Point(1,1))
# same as image.erode_dilate(3,0,0)
structure = Image(Point(0,0), Point(6,6), ONEBIT)
structure.fill(1)
image = image.dilate_with_structure(structure, Point(3,3))
The implementation is straightforward and can be slow for large structuring elements. If you know that your structuring element is connected and its origin is black, you can set only_border to True, because in this case only the border pixels in the image need to be considered which can speed up the dilation for some images (though not for all).
References:
A proof that only the contour pixels need to be dilated for connected structuring elements containing their origin is given by Luc Vincent in Morphological Transformations of Binary Images with Arbitrary Structuring Elements, Signal Processing, Vol. 22, No. 1, pp. 3-23, January 1991 (see theorem 2.13)
Image [Float] distance_transform (Choice [chessboard|manhattan|euclidean] norm)
Operates on: | Image [OneBit] |
---|---|
Returns: | Image [Float] |
Category: | Morphology |
Defined in: | morphology.py |
Author: | Ullrich Köthe (wrapped from VIGRA by Michael Droettboom |
For all background pixels, calculate the distance to the nearest object or contour. In the destination image, all pixels corresponding to background will be assigned the their distance value, all pixels corresponding to objects will be assigned 0. The result is returned as a Float image.
norm:
0: use chessboard distance (L-infinity norm)
1: use Manhattan distance (L1 norm)
2: use Euclidean distance (L2 norm)
Example 1: distance_transform(5)
Image [OneBit|GreyScale|Float] erode ()
Operates on: | Image [OneBit|GreyScale|Float] |
---|---|
Returns: | Image [OneBit|GreyScale|Float] |
Category: | Morphology |
Defined in: | morphology.py |
Author: | Michael Droettboom and Karl MacMillan |
Erodes the image by the image morphology method.
Example 1: erode()
Example 2: erode()
Image [OneBit|GreyScale|Float] erode_dilate (int(0, 10) ntimes = 1, Choice [dilate|erode] direction, Choice [rectangular|octagonal] shape)
Operates on: | Image [OneBit|GreyScale|Float] |
---|---|
Returns: | Image [OneBit|GreyScale|Float] |
Category: | Morphology |
Defined in: | morphology.py |
Author: | Michael Droettboom and Karl MacMillan |
Erodes or dilates the image by the image morphology method. In case of calling with onebit images and shape is set to rectangular erode_with_structure/dilate_with_structure is used.
Example 1: erode_dilate(10, 0, 1)
Image [OneBit] erode_with_structure (Image [OneBit] structuring_element, Point origin)
Operates on: | Image [OneBit] |
---|---|
Returns: | Image [OneBit] |
Category: | Morphology |
Defined in: | morphology.py |
Author: | Christoph Dalitz |
Performs a binary morphological erosion with the given structuring element.
Note that it is necessary to specify which point in the structuring element shall be treated as origin. This allows for arbitrary structuring elements.
Border pixels at which the structuring element extends beyond the image dimensions are whitened. In other words the image is padded with white pixels before erosion.
Example:
# same as image.erode()
structure = Image(Point(0,0), Point(2,2), ONEBIT)
structure.fill(1)
image = image.erode_with_structure(structure, Point(1,1))
Image [OneBit|GreyScale|Float] mean ()
Operates on: | Image [GreyScale|Float] |
---|---|
Returns: | Image [OneBit|GreyScale|Float] |
Category: | Morphology |
Defined in: | morphology.py |
Author: | Michael Droettboom and Karl MacMillan |
Within each 3x3 window, set the center pixel to the mean value of all 9 pixels.
Example 1: mean()
Image [OneBit|GreyScale|Float] rank (int(1, 9) rank)
Operates on: | Image [OneBit|GreyScale|Float] |
---|---|
Returns: | Image [OneBit|GreyScale|Float] |
Category: | Morphology |
Defined in: | morphology.py |
Author: | Michael Droettboom and Karl MacMillan |
Within each 3x3 window, set the center pixel to the n-th ranked value.
Example 1: rank(2)
Example 2: rank(5)
Example 3: rank(8)