Search code examples
matlabimage-processingdownsampling

What does this mean in MATLAB?


I have came about a MATLAB code like the following:

xyz = imfilter(A,B);
xyz_subsample = xyz(1:2:size(xyz, 1), 1:2:size(xyz, 2));

The code is related to subsampling. But, what does the second line mean?

Thanks.


Solution

  • The second line is taking every second sample in each spatial dimension. So it's downsampling by a factor of 2 in each dimension.

    Downsampling should be preceded by lowpass filter in order to avoid aliasing effects. The filter in the first line probably does that. Is B a lowpass mask?