function rot = rot45(im, n) NA = ones(n, n); for I = 1:n, for J = 1:n, TRANS = [.7 .7 0; -.7 .7 0; 0 0 1] * [I J 1]'; if TRANS(1) >= 1 if TRANS(2) >= 1 NA(floor(TRANS(1)), floor(TRANS(2))) = im(I, J); end end end end rot = NA;