Documentation Center

  • Trial Software
  • Product Updates

vision.MarkerInserter System object

Package: vision

Draw markers on output image

Description

The MarkerInserter object can draw circle, x-mark, plus sign, star, or rectangle markers in a 2-D grayscale or truecolor RGB image. The output image can then be displayed or saved to a file.

Construction

markerInserter = vision.MarkerInserter returns a marker inserter System object, markerInserter, that draws a circle in an image.

markerInserter = vision.MarkerInserter(Name,Value) returns a marker inserter object, H, with each specified property set to the specified value. You can specify additional name-value pair arguments in any order as (Name1, Value1,...,NameN,ValueN).

Code Generation Support
Supports MATLAB® Function block: Yes
System Objects in MATLAB Code Generation
Code Generation Support, Usage Notes, and Limitations.

To insert a marker:

  1. Define and set up your marker inserter using the constructor.

  2. Call the step method with the input image, I, the marker inserter object, markerInserter, points PTS, and any optional properties. See the syntax below for using the step method.

J = step(markerInserter,I,PTS) draws the marker specified by the Shape property on input image I. The input PTS specify the coordinates for the location of the marker. You can specify the PTS input as an M-by-2 [x y] matrix of M number of markers. Each [x y] pair defines the center location of the marker. The markers are embedded on the output image J.

J = step(markerInserter,I,PTS,ROI) draws the specified marker in a rectangular area defined by the ROI input. This applies when you set the ROIInputPort property to true. The ROI input defines a rectangular area as [x y width height], where [x y] determine the upper-left corner location of the rectangle, and width and height specify the size.

J = step(markerInserter,I,PTS,...,CLR) draws the marker with the border or fill color specified by the CLR input. This applies when you set the BorderColorSource property or the FillColorSource property to 'Input port'.

Properties

Shape

Shape of marker

Specify the type of marker to draw as Circle | X-mark | Plus, Star | Square.

Default: Circle

Size

Size of marker

Specify the size of the marker, in pixels, as a scalar value greater than or equal to 1. This property is tunable.

Default: 3

Fill

Enable marker fill

Set this property to true to fill the marker with an intensity value or a color. This property applies when you set the Shape property to Circle or Square.

Default: false

BorderColorSource

Border color source

Specify how the marker's border color is provided as Input port, Property. This property applies either when you set the Shape property to X-mark, Plus, or Star, or when you set the Shape property to Circle or Square, and the Fill property to false. When you set BorderColorSource to Input port, a border color vector must be provided as an input to the System object's step method.

Default: Property

BorderColor

Border color of marker

Specify the border color of the marker as Black | White | Custom. If this property is set to Custom, the CustomBorderColor property is used to specify the value. This property applies when the BorderColorSource property is enabled and set to Property.

Default:Black

CustomBorderColor

Intensity or color value for marker's border

Specify an intensity or color value for the marker's border. If the input is an intensity image, this property can be set to a scalar intensity value for one marker or R-element vector where R is the number of markers. If the input is a color image, this property can be set to a P-element vector where P is the number of color planes or a P-by-R matrix where P is the number of color planes and R is the number of markers. This property applies when you set the BorderColor property to Custom. This property is tunable when the Antialiasing property is false.

Default: [200 120 50]

FillColorSource

Source of fill color

Specify how the marker's fill color is provided as Input port | Property. This property applies when you set the Shape property to Circle or Square, and the Fill property to true. When this property is set to Input port, a fill color vector must be provided as an input to the System object's step method.

Default: Property

FillColor

Fill color of marker

Specify the color to fill the marker as Black | White | Custom. If this property is set to Custom, the CustomFillColor property is used to specify the value. This property applies when the FillColorSource property is enabled and set to Property.

Default: Black

CustomFillColor

Intensity or color value for marker's interior

Specify an intensity or color value to fill the marker. If the input is an intensity image, this property can be set to a scalar intensity value for one marker or R-element vector where R is the number of markers. If the input is a color image, this property can be set to a P-element vector where P is the number of color planes or a P-by-R matrix where P is the number of color planes and R is the number of markers. This property applies when you set the FillColor property to Custom. This property is tunable when the Antialiasing property is false.

Default: [200 120 50]

Opacity

Opacity of shading inside marker

Specify the opacity of the shading inside the marker by a scalar value between 0 and 1, where 0 is transparent and 1 is opaque. This property applies when you set the Fill property to true. This property is tunable.

Default: 0.6

ROIInputPort

Enable defining a region of interest to draw marker

Set this property to true to specify a region of interest (ROI) on the input image through an input to the step method. If the property is set to false, the object uses the entire image.

Default: false

Antialiasing

Enable performing smoothing algorithm on marker

Set this property to true to perform a smoothing algorithm on the marker. This property applies when you do not set the Shape property to Square or Plus.

Default: false

 Fixed-Point Properties

Methods

cloneCreate marker inserter object with same property values
getNumInputsNumber of expected inputs to step method
getNumOutputsNumber of outputs from step method
isLockedLocked status for input attributes and nontunable properties
release Allow property value and input characteristics changes
stepDraw specified marker on input image

Examples

expand all

Draw White Plus Signs in a Grayscale Image

markerInserter = vision.MarkerInserter('Shape','Plus','BorderColor','white');
I = imread('cameraman.tif');
Pts = int32([10 10; 20 20; 30 30]);
J = step(markerInserter, I, Pts);
imshow(J);

Draw Red Circles in a Grayscale Image

red = uint8([255 0 0]);  % [R G B]; class of red must match class of I
markerInserter = vision.MarkerInserter('Shape','Circle','BorderColor','Custom','CustomBorderColor',red);
I = imread('cameraman.tif');
RGB = repmat(I,[1 1 3]); % convert the image to RGB
Pts = int32([60 60; 80 80; 100 100]);
J = step(markerInserter, RGB, Pts);
imshow(J);

Draw Blue X-marks in a Color Image

markerInserter = vision.MarkerInserter('Shape','X-mark','BorderColor','Custom','CustomBorderColor',uint8([0 0 255]));
RGB = imread('autumn.tif');
Pts = int32([20 20; 40 40; 60 60]);
J = step(markerInserter, RGB, Pts);
imshow(J);

See Also

|

Was this topic helpful?