highlights the specified region of interest roi in image.


highlights several regions of interest roii.


adds a feature defined by the symbolic wrapper w.


applies the styling bgstyle to the complement of all the regions of interest.

Details and Options

  • HighlightImage is used for highlighting particular regions or features in an image. It returns the highlighted image as a Graphics object.
  • The region of interest roi can be any of the following:
  • {{x1,y1},}a list of image positions
    regiona 2D geometric region (Point, Line, Disk, etc.)
    maskimagenonzero pixels of an Image object
    graphicsa Graphics object
    fa region returned by a function f
  • By default, using DataRange->Full, positions {xi,yi} and geometric regions are assumed to be in the standard image coordinate system.
  • The following wrappers w can be used:
  • Annotation[roi,label]provide an annotation
    Button[roi,action]define an action to execute when the element is clicked
    EventHandler[roi,]define a general event handler for the element
    Hyperlink[roi,uri]make the element act as a hyperlink
    ImageMarker[roi,]an image marker, placing a marker at the medoid of roi
    PopupWindow[roi,cont]attach a popup window to the element
    StatusArea[roi,label]display in the status area when the element is moused over
    Style[roi,opts]show the element using the specified styles
    Tooltip[roi,label]attach an arbitrary tooltip to the element
  • Use HighlightImage[image,{,style,roi,}] to specify a style for the region roi.
  • Basic style specifications include:
  • Automaticautomatically select the highlighting method
    colorcolor specification (RGBColor, LABColor, etc.)
    directiveany valid graphics directive (PointSize, Thickness, etc.)
  • By default, the most suitable highlighting style is used.
  • Additional style specifications include:
  • "Blur",{"Blur",r}blur using range r neighborhoods
    "Boundary",{"Boundary",t}highlight the boundary using thickness t
  • Nested lists of regions-of-interest and styles can be given. Style specifications remain in effect only until the end of the list that contains them.
  • The background is taken to be the complement of all regions of interest. The following bgstyle specifications can be used:
  • "Blur",
    blur using range r neighborhoods
    "Darken",{"Darken",a}blend with black (default )
    "Lighten",{"Lighten",a}blend with white (default )
    "Remove"make background transparent
    {"Remove",color}replace background with color
    fperform f on the background
  • HighlightImage accepts all Graphics options with the following changes and additions:
  • DataRangeFullrange of coordinates in the original image
    PlotRangeAutomaticrange of coordinates to include
    PlotRangePaddingNonehow much to pad the range of values
  • Typical settings for DataRange include:
  • Automatic{{0,1},{0,h/w}}
    {{left,right},{bottom,top}}explicit coordinate ranges in 2D
  • Typical settings for PlotRange include:
  • Allall points are included
    Automaticsame as DataRange settings
    {{left,right},{bottom,top}}explicit coordinate ranges


open all close all

Basic Examples  (3)

Highlight the corners of an image:

Click for copyable input
Click for copyable input

Highlight a region of interest by dehighlighting the rest of the image:

Click for copyable input

Highlight a region of interest:

Click for copyable input

Scope  (14)

Options  (3)

Applications  (4)

Interactive Examples  (1)

Introduced in 2012
Updated in 2017