HighlightImage

HighlightImage[image,roi]

highlights the specified region of interest roi in image.

HighlightImage[image,{roi1,roi2,}]

highlights several regions of interest roii.

HighlightImage[image,{,w[roii],}]

highlights using a feature defined by the symbolic wrapper w.

HighlightImage[image,fg,bgstyle]

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
    <|label1->roi1, |>an association of labeled regions
  • Labels in labeled associations <|label1->roi1, |> are used for labeling and legending.
  • 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,]place a marker at the medoid of roi
    Labeled[roii,]place a marker at the medoid of roi
    Legended[roi,lbl]include the label lbl in the legend
    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",r}
    blur using range r neighborhoods
    "Darken",{"Darken",a}blend with black (default )
    "Lighten",{"Lighten",a}blend with white (default )
    "Desaturate",{"Desaturate",s}desaturate
    "Remove"make background transparent
    {"Remove",color}replace background with color
    fperform f on the background
  • With an explicit bgstyle, the foreground opacity is set to 0. Use Opacity[α] to specify a different foreground opacity.
  • HighlightImage accepts all Graphics options with the following changes and additions:
  • DataRangeFullrange of coordinates in the original image
    ImageLabelsAutomatichow to label regions of interest
    ImageLegendsNonehow to add a legend
    PlotRangeAutomaticrange of coordinates to include
    PlotRangePaddingNonehow much to pad the range of values
  • Possible settings for ImageLabels and ImageLegends include:
  • {lbl1,lbl2,}use an explicit lbli for roii
    Automaticautomatic labeling and legending
    Noneno label or legend
    "Expressions"use the arbitrary functions f
  • Typical settings for DataRange include:
  • Automatic{{0,1},{0,h/w}}
    Full{{0,w},{0,h}}
    {{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

Examples

open allclose all

Basic Examples  (3)

Highlight the corners of an image:

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

Highlight a region of interest:

Scope  (21)

Regions  (6)

Point Regions  (1)

Highlight a list of points:

Use a list of positions:

Use an explicit Point wrapper:

Use an ImageMarker wrapper:

Specify a marker:

Curve Regions  (1)

Highlight a one-dimensional region:

Area Regions  (3)

Use an Image object as the region:

Use a Graphics primitive to describe what to highlight:

Use a Graphics object as the region:

Use a geometric region to describe what to highlight:

The region of interest can be a Graphics object generated by any function:

Whenever the region is given as an image, it is assumed to be a 2D region:

Highlight only the detected pixels by removing the boundary:

Compare the result with the exact pixel-wise color replacement:

Other Graphics Elements  (1)

Use an Inset:

Use a Text element:

Styling  (15)

Region Styling  (3)

Specify a highlighting color:

Highlight the region using a solid color:

Highlight the boundary of a region:

Use Graphics directives to customize the region:

Background Styling  (6)

Highlight the image by decreasing the background brightness:

Highlight the image by increasing the background brightness:

Highlight the region of interest by converting the background to gray scale:

Use a specific saturation value:

Blur the background to highlight the foreground:

Use a custom function to highlight the background:

Remove the background:

Replace the removed background with a specific color:

Labeling & Legending  (5)

Label image faces:

Detect faces and label them with estimated age:

Specify labels for each dataset of points:

Create a legend using the provided labels:

Highlight and label two image segments:

Wrappers  (1)

Add tooltips on points of interest:

Compute position and strength of keypoints:

Options  (7)

DataRange  (1)

The default data range is determined by the dimensions of the image:

This is equivalent to DataRange->Full:

Use DataRange->Automatic for a normalized range on the axis:

Use a custom range:

GridLines  (1)

By default, no grid lines are shown:

Show grid lines:

Specify grid lines to show:

ImageLabels  (2)

By default, no label is used for the highlighted regions:

Use ImageLabels{"lbl1","lbl2",} to define labels for each region:

Association keys are automatically used as labels:

Use ImageLabelsNone to disable automatic labeling:

ImageLegends  (2)

Use ImageLegends{"lbl1","lbl2",} to define labels for each region:

Legends are matched by scanning the list of regions depth first:

Association keys automatically used as labels:

Use ImageLegendsAutomatic to enable automatic legending:

Use ImageLabelsNone to also disable labeling:

PlotRange  (1)

The default plot range is determined by the dimensions of the image:

Use PlotRange->All to see all regions:

Use a custom range:

Applications  (4)

Blur faces in an image:

Highlight strong and weak corners in different styles:

Segment an image and highlight the centers of the disk shapes with a marker:

Highlight multiple regions of interest:

Interactive Examples  (1)

Apply an interactive spotlight to a scene:

Introduced in 2012
 (9.0)
 |
Updated in 2014
 (10.0)
2016
 (10.4)
2017
 (11.2)
2020
 (12.1)