DSPRelated.com
Code

2D Matrix Downsample

Ron April 1, 2011 Coded in Matlab

Downsamples a 2D matrix according to custom horizontal and vertical paramters (x and y). Replace M with the input matrix (can be a greyscale picture).

function [ Y ] = downsample2d(M)
x = 2;
y = 2;

N = downsample(M,x);
N = N';
P = downsample(N,y);
P = P'
end