bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / data / _binary_blobs / binary_blobs
function
skimage.data._binary_blobs:binary_blobs
source: /dev/scikit-image/src/skimage/data/_binary_blobs.py :5
Signature
def binary_blobs ( length = 512 , blob_size_fraction = 0.1 , n_dim = 2 , volume_fraction = 0.5 , rng = None , * , boundary_mode = nearest ) Summary
Generate synthetic binary image with several rounded blob-like objects.
Parameters
length: int, optionalLinear size of output image.
blob_size_fraction: float, optionalTypical linear size of blob, as a fraction of
length, should be smaller than 1.n_dim: int, optionalNumber of dimensions of output image.
volume_fraction: float, default 0.5Fraction of image pixels covered by the blobs. Should be in [0, 1].
rng: {`numpy.random.Generator`, int}, optionalPseudo-random number generator. By default, a PCG64 generator is used (see numpy.random.default_rng). If
rngis an int, it is used to seed the generator.boundary_mode: {'nearest', 'wrap'}, optionalThe blobs are created by smoothing and then thresholding an array consisting of ones at seed positions. This mode determines which values are filled in when the smoothing kernel overlaps the seed array's boundary.
'nearest' (
a a a a | a b c d | d d d d)By default, when applying the Gaussian filter, the seed array is extended by replicating the last boundary value. This will increase the size of blobs whose seed or center lies exactly on the edge.
'wrap' (
a b c d | a b c d | a b c d)The seed array is extended by wrapping around to the opposite edge. The resulting blob array can be tiled and blobs will be contiguous and have smooth edges across tile boundaries.
Returns
blobs: ndarray of boolsOutput binary image.
Examples
from skimage import data blobs = data.binary_blobs(length=256, blob_size_fraction=0.1) blobs = data.binary_blobs(length=256, blob_size_fraction=0.05) blobs = data.binary_blobs(length=256, volume_fraction=0.3)✓
Aliases
-
skimage.data.binary_blobs