Moving window in time domain

5 次查看(过去 30 天)
ecartman22
ecartman22 2021-7-19
评论: ecartman22 2021-7-20
I have a 3D matrix X*Y*T and I would like to apply a bandpass filter in the 3rd dimension. Instead of doing it on the complete series at once, I would like to have a window of size n for example (X,Y,1:n) on which I filter and then move to the next window (X,Y,n+1:2n) and so on. What is the most efficient way of doing this?

回答(1 个)

Image Analyst
Image Analyst 2021-7-19
编辑:Image Analyst 2021-7-19
The convn() function.
n = 3;
kernel = repmat(1, 1, 1, n) / n;
smoothedImage = convn(image3d, kernel, 'same');
  3 个评论
Image Analyst
Image Analyst 2021-7-19
See untested code I added above. It will average over n slices in the z dimension then scan all over to hit every (x,y) location. The image can have more slices than n. For example, you can have 50 slices and n can be 3 then it will average over 3 slices at a time, then move down a slice and repeat until all slices have been scanned.
ecartman22
ecartman22 2021-7-20
Thanks a lot! This is averaging over a window. How could I change the kernel so it bandpass filters the window in the time domain?

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by