returns an image with an alpha channel where the background is transparent.

uses foreground or background model specification.


  • RemoveBackground works with arbitrary 2D and 3D images.
  • The model specification is used to indicate the foreground that is kept in the image or the background that is removed from the image.
  • Possible settings for the foreground or background model specification are:
  • specbackground specification spec
    {"Background",spec}background specification spec
    {"Foreground",spec}foreground specification spec
  • Different specifications spec may be useful for each image when separating foreground and background.
  • Specifications used for regions with almost uniform color are:
  • "Uniform"region of almost uniform color
    colregion of almost uniform color col
    markerspecify the region using a marker
    {,d}allow amount d of variation from the specified color
  • Brightness specifications can be given by:
  • "Bright"brighter foreground or background
    "Dark"darker foreground or background
  • In-focus and out-of-focus separation:
  • "Blurred"blurred region
    {"Blurred",r}assume blur factor of r
  • Markers can be given as an image, a graphics object, or a list of points in the standard image coordinate system, where x runs from 0 to width, y runs from 0 to height, and position corresponds to the bottom-left corner of the image.
  • If an image already has an alpha channel, the result will have an alpha channel equal to the computed foreground map multiplied with the original alpha channel.
Introduced in 2014