GIMP-ML/gimp-plugins/pytorch-SRResNet/data/modcrop.m

13 lines
267 B
Mathematica
Raw Normal View History

2020-04-27 04:32:33 +00:00
function imgs = modcrop(imgs, modulo)
if size(imgs,3)==1
sz = size(imgs);
sz = sz - mod(sz, modulo);
imgs = imgs(1:sz(1), 1:sz(2));
else
tmpsz = size(imgs);
sz = tmpsz(1:2);
sz = sz - mod(sz, modulo);
imgs = imgs(1:sz(1), 1:sz(2),:);
end