Main Content
Smooth Image Using Gaussian Kernel
This example shows you how to smooth an image using the Gaussian kernel.
Example Model
Open the Simulink® model.
modelname = "ex_blk2DCorrelation.slx";
open_system(modelname)
This model reads a PNG image using the Image From File block, which outputs it as a matrix of data type double
.
The model then smoothes the image by using a 2-D Correlation block to correlate the input image with a 5-by-5 representation of the Gaussian kernel.
Simulate the Model
Run the model. The model displays the input image and the smoothed output image using Video Viewer blocks.
output = sim(modelname)
output = Simulink.SimulationOutput: tout: [51x1 double] SimulationMetadata: [1x1 Simulink.SimulationMetadata] ErrorMessage: [0x0 char]