Mercurial > hg > ishara
annotate dsp/rot45.m @ 61:eff6bddf82e3 tip
Finally implemented perceptual brightness thing.
author | samer |
---|---|
date | Sun, 11 Oct 2015 10:20:42 +0100 |
parents | db7f4afd27c5 |
children |
rev | line source |
---|---|
samer@4 | 1 function B = rot45(A) |
samer@4 | 2 % rot45 - rotate square array by 45 degrees |
samer@4 | 3 % |
samer@4 | 4 % rot45 :: [[N,N]] -> [[N,N]]. |
samer@4 | 5 % |
samer@4 | 6 % Array is SUBSAMPLED, so, you should pre-filter to avoid aliasing. |
samer@4 | 7 % Result is padded with zeros in the corners. |
samer@4 | 8 |
samer@4 | 9 n = length(A); |
samer@4 | 10 |
samer@4 | 11 B = diag(A,0)'; |
samer@4 | 12 pad = [0]; |
samer@4 | 13 |
samer@4 | 14 for k=2:2:n-1 |
samer@4 | 15 B = [ pad diag(A,k)' pad; B; pad diag(A,-k)' pad]; |
samer@4 | 16 pad = [pad 0]; |
samer@4 | 17 end |