machinevisiontoolbox.Image.blend
- Image.blend(image2, alpha, beta=None, gamma=0)
Image blending
- Parameters:
image2 (
Image
) – second imagealpha (float) – fraction of image
beta (float, optional) – fraction of
image2
, defaults to 1-alpha
gamma (int, optional) – gamma nonlinearity, defaults to 0
- Raises:
ValueError – images are not same size
ValueError – images are of different type
- Returns:
blended image
- Return type:
Image
The resulting image is
\[\mathbf{Y} = \alpha \mathbf{X}_1 + \beta \mathbf{X}_2 + \gamma\]Example:
>>> from machinevisiontoolbox import Image >>> img1 = Image.Constant(3, value=4) >>> img2 = Image([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) >>> img1.blend(img2, 0.5, 2).A array([[ 4, 6, 8], [10, 12, 14], [16, 18, 20]], dtype=uint8)
- Note:
For integer images the result is saturated.
For a multiplane image each plane is processed independently.
- Seealso: