M-point averaging filter to an image
Afficher commentaires plus anciens
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.
Réponses (1)
Bjorn Gustavsson
le 17 Avr 2021
0 votes
Read the help and documentation for conv2.
HTH
Catégories
En savoir plus sur Image Filtering dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!