function [x,r,g,b,ni,nj] = loadImage(imageName)

x = imread(imageName);

% Round image dimensions down to
% multiples of 8
a = size(x);
ni = floor(a(1)/8);
nj = floor(a(2)/8);
x = x(1:ni*8, 1:nj*8, 1:3);

x = double(x);
r = x(:,:,1);
g = x(:,:,2);
b = x(:,:,3);