Main Content

Use Custom Image Filter Algorithms as Reusable Blocks in Simulink

This example shows how to incorporate image filter algorithms written in C code into a model using C Caller blocks in a reusable Simulink® library.

In this example, three image filter blocks are C Caller blocks in a library model. Their dependent C code is specified in the library model custom code settings.

The image filter C functions are implemented using row-major array layout. The library custom code settings specify the default function array layout as row-major.

These library image filter blocks can be reused by adding them to models.

mdl = 'slexCCallerExampleImageFilter';
open_system(mdl);

Image filter model that uses C caller block

As the simulation runs, the MATLAB Function block displays the filtered images.

sim(mdl);

Figure contains 4 axes objects. Axes object 1 with title Original Image contains an object of type image. Axes object 2 with title Mean Filter contains an object of type image. Axes object 3 with title Median Filter contains an object of type image. Axes object 4 with title Gaussian Filter contains an object of type image.

See Also

Related Topics