I have a spatial data on a regular grid. (50x50 matrix containing values of heights in meters). How to code moving average operator to smooth the spatial data. With and without overlapping
1 view (last 30 days)
Show older comments
For example: if I have original 4X4 matrix. After applying moving window operator with size [2x2] then output matrix will be 2x2.
0 Comments
Answers (1)
Image Analyst
on 28 Oct 2015
For overlapping:
windowWidth = 4; % or 2, but usually it's an odd number
kernel = ones(windowWidth)/windowWidth^2;
output = conv2(double(grayImage), kernel, 'same');
imshow(output, []);
For non-overlapping, see my attached blockproc demos.
0 Comments
See Also
Categories
Find more on Pulsed Waveforms in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!