M-point averaging filter to an image
Mostrar comentarios más antiguos
I have a 512 × 512 gray scale image that I converted to a matrix whose values are between 0 and 1. The value 0 represents black and the value 1 represents white and intermediate values are gray scale values.
I need to implement a one-dimensional M-point averaging filter to this image for M = 11, M = 31, M = 61, such that each pixel value is replaced by the equal-weighted average of its (M − 1)/2 neighbors to its left, (M − 1)/2 neighbors to its right, and the pixel value itself. For instance, for M = 3, it would be like:
y[n,m]= 1/3(x[n,m−1]+x[n,m]+x[n,m+1])
The averaging is one-dimensional (1D), that is, along only one of the dimensions (horizontal dimension). Assume that values lying outside of the image are zero while averaging.
Can someone help out with this? Thanks.
Respuestas (1)
Bjorn Gustavsson
el 17 de Abr. de 2021
0 votos
Read the help and documentation for conv2.
HTH
Categorías
Más información sobre Image Filtering en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!