SetAlphaChannel

SetAlphaChannel[color]

adds full opacity to color.

SetAlphaChannel[color,a]

adds opacity a to color.

SetAlphaChannel[image,]

adds an alpha channel to image.

SetAlphaChannel[video,]

adds an alpha channel to the frames of video.

Details

  • SetAlphaChannel returns an image with an alpha channel using either fixed opacity for all pixels or an image containing the opacity for every pixel. Alpha channels are typically used for highlighting regions of interest or masking the image.
  • SetAlphaChannel[image] is equivalent to SetAlphaChannel[image,1].
  • In SetAlphaChannel[image,a], a can be a scalar value or an image with the same dimensions as image.
  • When setting opacity to a color or image, existing opacity properties are ignored.
  • SetAlphaChannel works with any valid color directive as well as 2D and 3D images of explicit color spacethat is, any setting of the ColorSpace option other than Automatic.

Examples

open allclose all

Basic Examples  (2)

Add opacity to a color:

Set the pixel opacities in an image:

Scope  (8)

Add a constant white alpha channel to an RGB image:

Use an opacity of 0.5:

Specify the alpha channel using an image mask:

Specify the alpha channel using a grayscale image:

Specify the alpha channel using a color image:

Specify the alpha channel using a graphics object:

Add an alpha channel to a 3D image:

Add an alpha channel to a video:

Applications  (4)

Segment the background to be used as an alpha channel:

Set the alpha channel to a detected background:

Use an alpha channel to mask regions of an image:

Use an alpha channel to highlight a region of interest:

Binarize the image and delete border components:

Find individual cells that have only one hole and fill the hole:

Highlight the detected foreground while keeping the background half transparent:

Set the alpha channel of an RGB image to be the negative of its blue channel:

Properties & Relations  (1)

Color images are converted to grayscale when used as an alpha channel:

Interactive Examples  (1)

Use an alpha channel to focus on a region of interest in an image:

Wolfram Research (2010), SetAlphaChannel, Wolfram Language function, https://reference.wolfram.com/language/ref/SetAlphaChannel.html (updated 2022).

Text

Wolfram Research (2010), SetAlphaChannel, Wolfram Language function, https://reference.wolfram.com/language/ref/SetAlphaChannel.html (updated 2022).

CMS

Wolfram Language. 2010. "SetAlphaChannel." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2022. https://reference.wolfram.com/language/ref/SetAlphaChannel.html.

APA

Wolfram Language. (2010). SetAlphaChannel. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SetAlphaChannel.html

BibTeX

@misc{reference.wolfram_2024_setalphachannel, author="Wolfram Research", title="{SetAlphaChannel}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/SetAlphaChannel.html}", note=[Accessed: 24-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_setalphachannel, organization={Wolfram Research}, title={SetAlphaChannel}, year={2022}, url={https://reference.wolfram.com/language/ref/SetAlphaChannel.html}, note=[Accessed: 24-November-2024 ]}