2D Matrix Downsample
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