Products & Services Solutions Academia Support User Community Company

Learn more about Video and Image Processing Blockset   

Draw Markers - Draw markers by embedding predefined shapes on output image

Library

Text & Graphics

Description

The Draw Markers block can draw multiple circles, x-marks, plus signs, stars, or squares on images by overwriting pixel values. Overwriting the pixel values embeds the shapes.

This block uses Bresenham's circle drawing algorithm to draw circles and Bresenham's line drawing algorithm to draw all other markers.

PortInput/OutputSupported Data TypesComplex Values Supported

Image

M-by-N matrix of intensity values or an M-by-N-by-P color values where P is the number of color planes

  • Double-precision floating point

  • Single-precision floating point

  • Fixed point

  • Boolean

  • 8-, 16-, and 32-bit signed integer

  • 8-, 16-, and 32-bit unsigned integer

No

R, G, B

Scalar, vector, or matrix that represents one plane of the input RGB video stream. Inputs to the R, G, and B ports must have the same dimensions and data type.

Same as Image port

No

Pts

2-by-N matrix of row and column pairs,

where N is the total number of markers and each row and column pair defines the center of a marker.

  • Double-precision floating point

  • Single-precision floating point

  • 8-, 16-, and 32-bit signed integer

  • 8-, 16-, and 32-bit unsigned integer

If the input to the Image port is an integer, fixed point, or boolean data type, the input to the Pts port must also be an integer data type.

No

ROI

Four-element vector of integers that define a rectangular area in which to draw the markers. The first two elements represent the zero-based row and column coordinates of the upper-left corner of the area. The second two elements represent the height and width of the area.

  • Double-precision floating point

  • Single-precision floating point

  • 8-, 16-, and 32-bit signed integer

  • 8-, 16-, and 32-bit unsigned integer

No

Clr

P-element vector or P-by-N matrix where P is the number of color planes

Same as Image port

No

Output

Scalar, vector, or matrix of pixel values that contain the marker(s)

Same as Image port

No

The output signal is the same size and data type as the inputs to the Image, R, G, and B ports.

Use the Marker shape parameter to specify one of the following types of markers:

Use the Marker size parameter to define the size of the marker, in pixels. Enter a scalar value, M, that defines a (2M+1)-by-(2M+1) pixel square into which the marker fits. M must be greater than or equal to 1.

If, for the Marker shape parameter, you select:

and you then select the,

the block performs a smoothing algorithm. The Draw Markers block uses an algorithm similar to the poly2mask function to determine which subpixels to draw.

Use the Draw markers in parameter to define one of the following types of areas in which to draw the markers.

Use the Image signal parameter to specify one of the following ways to input and output a color video signal.

Selecting Marker Fill and Border Colors

You can set the marker fill or border color via the input port or via the input dialog. Use the color input or color parameter to determine the appearance of the rectangle(s), line(s), polygon(s), or circle(s).

Fill Color

If you select the Filled check box, the Fill color source, Fill color and Opacity factor (between 0 and 1) parameters appear in the dialog box. Use the Fill color source parameter to specify either Input port or Specify via dialog for the color source. If Specify via dialog is selected, you can specify either Black, White, or User-specified value for the Fill color parameter for the shading inside the shape. The Color value(s) parameter is applicable when the User-specified value is selected. Use the Opacity factor (between 0 and 1) parameter to specify the opacity of the shading inside the shape, where 0 is transparent and 1 is opaque.

Border Color

If the Filled check box is not selected, the Border color source, and Border color parameters are available. Use the Border color source parameter to specify either Input port or Specify via dialog for the color source. If Specify via dialog is selected, you can specify either Black, White, or User-specified value for the Border color parameter. If the color is user specified, the Color value(s) parameter is used to enter the color.

Color Values

The following table describes what to enter for the Color Value(s) parameter based on the block input and the number of markers you are drawing. This parameter is applicable when User-specified value is selected for the border color source.

Block InputColor Value(s) for Drawing One Marker or Multiple Markers with the Same ColorColor Value(s) for Drawing Multiple Markers with Unique Color
Intensity imageScalar intensity valueR-element vector where R is the number of markers
Color image P-element vector where P is the number of color planesP-by-R matrix where P is the number of color planes and R is the number of markers

For each value in the parameter, enter a number between the minimum and maximum values that can be represented by the data type of the input image. If you enter a value outside this range, the block produces an error message.

Opacity Factor

The following table describes what to enter for the Opacity factor(s) (between 0 and 1) parameter based on the block input and the number of markers you are drawing. This parameter is applicable when the Filled check box is selected.

Opacity Factor value for Drawing One Marker or Multiple Markers with the Same ColorOopacity Factor value for Drawing Multiple Marker with Unique Color
Scalar intensity valueR-element vector where R is the number of markers

Dialog Box

The Draw Markers dialog box appears as shown in the following figure.

Marker shape

Specify the type of marker(s) to draw. Your choices are Circle, X-mark, Plus, Star, or Square.

Marker size

Enter a scalar value that represents the size of the marker, in pixels.

Filled

Select this check box to fill the marker with an intensity value or a color. This parameter is visible if, for the Marker shape parameter, you choose Circle or Square.

Fill color source

Specify source for fill color value to either Specify via dialog or Input port. This parameter is visible if you select the Filled check box.

Fill color

If you select Black, the marker is black. If you select White, the marker is white. If you select User-specified value, the Color value(s) parameter appears in the dialog box. This parameter is visible if you select the Filled check box.

Border color source

Specify source for the border color value to either Specify via dialog or Input port. Border color options are visible when the fill shapes options are not selected. This parameter is visible if you select the Filled check box.

Border color

Specify the appearance of the shape's border. If you select Black, the border is black. If you select White, the border is white. If you select User-specified value, the Color value(s) parameter appears in the dialog box. This parameter is visible if you clear the Fill shapes check box.

Color value(s)

Specify an intensity or color value for the marker's border or fill. This parameter is visible if, for the Border color or Fill color parameter, you select User-specified value. Tunable.

Opacity factor (between 0 and 1)

Specify the opacity of the shading inside the marker, where 0 is transparent and 1 is opaque. This parameter is visible if you select the Filled check box. This parameter is tunable.

Draw markers in

Define the area in which to draw the markers. If you select Entire image, you can draw markers in the entire image. If you select Specify region of interest via port, the ROI port appears on the block. Enter a four-element vector, [r c height width], where r and c are the row and column coordinates of the upper-left corner of the area, and height and width represent the height (in rows) and width (in columns) of the area.

Use antialiasing

Perform a smoothing algorithm on the marker. This parameter is visible if, for the Marker shape parameter, you select Circle, X-mark, or Star.

Image signal

Specify how to input and output a color video signal. If you select One multidimensional signal, the block accepts an M-by-N-by-P color video signal, where P is the number of color planes, at one port. If you select Separate color signals, additional ports appear on the block. Each port accepts one M-by-N plane of an RGB video stream.

See Also

Draw Shapes

Video and Image Processing Blockset software

Insert Text

Video and Image Processing Blockset software

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS