sustaining_gazes/matlab_version/face_validation/DeepLearnToolbox/util/im2patches.m
2016-04-28 15:40:36 -04:00

13 lines
No EOL
313 B
Matlab

function patches = im2patches(im,m,n)
assert(rem(size(im,1),m)==0)
assert(rem(size(im,2),n)==0)
patches = [];
for i=1:m:size(im,1)
for u=1:n:size(im,2)
patch = im(i:i+n-1,u:u+m-1);
patches = [patches patch(:)];
end
end
patches = patches';
end