Apply a mean filter on a matrix

How can i apply a mean or laplacian or average or any kind of filters 3x3
on any matrix i give it to it and get the new matrix ?
What is the code for it

1 comentario

Rik
Rik el 9 de Jul. de 2020
A simple Google search should get you most of the way there. What did you try?

Iniciar sesión para comentar.

 Respuesta aceptada

Image Analyst
Image Analyst el 9 de Jul. de 2020
How about imfilter()
filterWindow = ones(3) / 9;
filteredImage = imfilter(m, filterWindow);
Or for the Laplacian, how about conv2():
filterWindow = -1 * ones(3);
filterWindow = 8;
filteredImage = conv2(m, filterWindow, 'same');

2 comentarios

Hassan Bosha
Hassan Bosha el 9 de Jul. de 2020
is there a one for median filter ?
Image Analyst
Image Analyst el 9 de Jul. de 2020
You can use medfilt2().

Iniciar sesión para comentar.

Más respuestas (0)

Preguntada:

el 9 de Jul. de 2020

Comentada:

el 9 de Jul. de 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by