how to create a sliding window?

Hi guys, I would like to know ho to create a sliding window in a matrix. Thank you very much.

Answers (1)

You can use conv2() or imfilter(). For example:
windowWidth = 11;
kernel = ones(windowWidth, windowWidth) / windowWidth ^ 2;
smoothedImage = conv2(double(grayImage), kernel, 'same');

2 Comments

Undefined function or variable 'grayImage'.
Replace grayImage with the variable that stores your gray-scale image (not RGB)

Sign in to comment.

Categories

Find more on Signal Processing Toolbox in Help Center and File Exchange

Asked:

on 19 Oct 2015

Commented:

on 25 Dec 2018

Community Treasure Hunt

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

Start Hunting!