Draw markers by embedding predefined shapes on output image
Text & Graphics
visiontextngfix
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.
Port | Input/Output | Supported Data Types | Complex 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 |
| 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 | M-by-2 matrix of [x y] coordinates, where M is the total number of markers and each [x y] pair defines the center of a marker. |
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 [x y width height] that define a rectangular area in which to draw the markers. The first two elements represent the one-based [x y] coordinates of the upper-left corner of the area. The second two elements represent the width and height of the area. |
| No |
Clr | P-element vector or M-by-P 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.
Specify the type of marker(s) to draw. Your choices are
Circle
, X-mark
,
Plus
, Star
, or
Square
.
When you select Circle
,
X-mark
, or Star
,
and you select the Use antialiasing check box, the
block performs a smoothing algorithm. The algorithm is similar to the
poly2mask
function to
determine which subpixels to draw.
Enter a scalar value that represents 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
.
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
.
When 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.
Specify source for fill color value. You can select Specify
via dialog
or Input port
. This
parameter appears when you select the Filled check box.
When you select Input port
, the color input port
clr appears on the block.
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.
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. When you select
Input port
, the color input port
clr appears on the block.
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.
Specify an intensity or color value for the marker's border or fill. This
parameter appears when you set the Border color or
Fill color parameters to
User-specified value
. Tunable.
The following table describes what to enter for the color value based on the block input and the number of shapes you are drawing.
Block Input | Color Value(s) for Drawing One Marker or Multiple Markers with the Same Color | Color Value(s) for Drawing Multiple Markers with Unique Color |
---|---|---|
Intensity image | Scalar intensity value | R-element vector where R is the number of markers |
Color image | P-element vector where P is the number of color planes | P-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.
Specify the opacity of the shading inside the marker, where
0
indicates transparent and
1
indicates opaque. This parameter appears when
you select the Filled check box. This parameter is
tunable.
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.
Opacity Factor value for Drawing One Marker or Multiple Markers with the Same Color | Opacity Factor value for Drawing Multiple Marker with Unique Color |
---|---|
Scalar intensity value | R-element vector where R is the number of markers |
Specify the area in which to draw the markers. When you select
Entire image
, you can draw markers in the
entire image. When you select Specify region of interest via
port
, the ROI port appears on the block. Enter a
four-element vector, [x y width height]
, where
[x y]
are the coordinates of the upper-left corner of
the area.
Perform a smoothing algorithm on the marker. This parameter
is visible if, for the Marker shape parameter,
you select Circle
, X-mark
,
or Star
.
Specify how to input and output a color video signal. When 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. When you select Separate color
signals
, additional ports appear on the block. Each port
accepts one M-by-N plane of an RGB
video stream.
Computer Vision Toolbox™ software | |
Computer Vision Toolbox software |