Main Content

Draw Circles on Image

This example shows you how to draw circles on an image by overwriting the pixel values of the input image.

Example Model

Open the Simulink® model.

modelname = 'ex_blkDrawShapesCircles.slx';

This model reads the input image using a Image From File block with the File name parameter set to coins.png.

The model then changes the data type of the input image to double, using an Image Data Type Conversion block with the Output data type parameter set to double.

The model draws filled, translucent circles at the locations specified by the Circular Shape Coordinates Constant (Simulink) block by using a Draw Shapes block with these parameters:

  • ShapeCircles

  • Line width3

  • Border colorWhite

The Draw Shapes block overwrites the value of each pixel along the circumferences of the specified areas of the original image.

Simulate the Model

Run the model. The model displays the output image, with white circles over two coins, by using a Video Viewer block.