Main Content

Draw Markers on Image

This example shows you how to draw markers of different colors on an image.

Example Model

Open the Simulink® model.

modelname = 'ex_blkDrawMarkers.slx';
open_system(modelname)

The model reads an input image using the Image From File block. The Constant (Simulink) block, which has a Constant value parameter of [35 210;270 70], specifies the pixel coordinates at which to draw two markers. The Draw Markers block then draws the markers on the input image. These markers are filled circles colored green and yellow, respectively. The Draw Markers block uses these nondefault parameters:

  • Marker size5

  • Filledon

  • Fill color sourceSpecify via dialog

  • Fill colorUser-specified value

  • Color value(s)[0 255 0;255 255 0]

Simulate and Display Results

Run the model and visualize the two markers in the output image. The model uses Video Viewer blocks to display the input and output images.

sim(modelname);