Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Image rotation and NaNs...
Date: Sun, 7 Jun 2009 08:38:01 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 22
Message-ID: <h0fu99$guq$1@fred.mathworks.com>
References: <gvivk5$q0m$1@fred.mathworks.com> <h0dehc$8ui$1@fred.mathworks.com> <h0dgsc$5jr$1@fred.mathworks.com> <h0e94l$h1a$1@fred.mathworks.com> <h0edfg$ld0$1@fred.mathworks.com> <h0fsd9$ej3$1@fred.mathworks.com>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1244363881 17370 172.30.248.37 (7 Jun 2009 08:38:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 7 Jun 2009 08:38:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: news.mathworks.com comp.soft-sys.matlab:545296


"Matman86 Di" <pasqui.squall@email.it> wrote in message <h0fsd9$ej3$1@fred.mathworks.com>...

> 
> I answer first to last question:it's because if I make a grid like -M/2:M/2 I don't get the exact number of pixels.

Add 0.5 see below

> You're right for the NaNs,so I can't do anything about it I guess...
> According to you is ok if I make
> X(isnan(X))=0;

No, use extrap option (Jos gave a hint)

X=peaks(40);
[M N]=size(X);
[n m]=meshgrid(-N/2+0.5:N/2-0.5,-M/2+0.5:M/2-0.5);
np=n*cos(2*pi)-m*sin(2*pi);
mp=n*sin(2*pi)+m*cos(2*pi);
y=interp2(n,m,X,np,mp,'linear',0);
imagesc(y)

Bruno