Halftone
Targets:
image
volume
Image Types:uint8, float32
Convert image to halftone dot pattern.
Simulates the halftone printing technique where continuous-tone images are reproduced using dots of varying size. Larger dots represent brighter areas, smaller dots represent darker areas.
Arguments
dot_size_rangetuple[int, int]
[4,10]
Range for the grid cell size in pixels. Larger values produce coarser halftone patterns. Default: (4, 10).
blend_rangetuple[float, float]
[0,0.5]
Range for blending with the original image. 0 = pure halftone, 1 = original image. Default: (0.0, 0.5).
pfloat
0.5
Probability of applying the transform. Default: 0.5.
Examples
>>> import numpy as np
>>> import albumentations as A
>>> image = np.random.randint(0, 256, (100, 100, 3), dtype=np.uint8)
>>> transform = A.Halftone(dot_size_range=(4, 8), blend_range=(0.0, 0.3), p=1.0)
>>> result = transform(image=image)["image"]Notes
The halftone effect samples mean luminance per grid cell and draws a filled circle whose radius is proportional to that luminance. Cell color is preserved from the original image.