image = imread('image.png');
imageWidth = size(image, 2);
imageHeight = size(image, 1);
windowWidth = 32;
windowHeight = 32;
for j = 1:imageHeight - windowHeight + 1
for i = 1:imageWidth - windowWidth + 1
window = image(j:j + windowHeight - 1, i:i + windowWidth - 1, :);
% do stuff with subimage
end
end