System object: vision.ShapeInserter
Draw specified shape on image
J = step(shapeInserter,I,PTS)
J = step(shapeInserter,I,PTS,ROI)
J = step(shapeInserter,I,PTS,...,CLR)
J = step(shapeInserter,I,PTS) draws the shape specified by the Shape property on input image I. The input PTS specify the coordinates for the location of the shape. The shapes are embedded on the output image J.
J = step(shapeInserter,I,PTS,ROI) draws a shape inside an area defined by the ROI input. This applies only 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(shapeInserter,I,PTS,...,CLR) draws the shape with the border or fill color specified by the input CLR. This applies when you set the BorderColorSource property or the FillColorSource property to 'Input port'.
Note: The object performs an initialization the first time the step method is executed. This initialization locks nontunable properties and input specifications, such as dimensions, complexity, and data type of the input data. If you change a nontunable property or an input specification, the System object™ issues an error. To change nontunable properties or inputs, you must first call the release method to unlock the object.
Shape inserter object with shape and properties specified.
Input M-by-N matrix of M intensity values or an M-by-N-by-P matrix of M color values where P is the number of color planes.
Input matrix coordinates describing location and dimension of shape. This property must be an integer value. If you enter non-integer value, the object rounds it to the nearest integer.
You can specify the type of shape as Rectangles, Lines, Polygons, or Circles. When you specify the type of shape to draw, you must also specify the location. The PTS input specifies the location of the points. The table shows the format for the points input for the different shapes. For a more detailed explanation on how to specify shapes and lines, see Draw Shapes and Lines.
Depending on the shape you choose by setting the Shape property, the input matrix PTS must be in one of the following formats:
The table below shows the data types required for the inputs, I and PTS.
Scalar, vector, or matrix describing one plane of the RGB input video stream.
Input 4-element vector of integers [x y width height], that define a rectangular area in which to draw the shapes. The first two elements represent the one-based coordinates of the upper-left corner of the area. The second two elements represent the width and height of the area.
This port can be used to dynamically specify shape color.
P-element vector or an M-by-P matrix, where M is the number of shapes, and P, the number of color planes. You can specify a color (RGB), for each shape, or specify one color for all shapes. The data type for the CLR input must be the same as the input image.