Path: news.mathworks.com!newsfeed-00.mathworks.com!kanaga.switch.ch!switch.ch!news.in2p3.fr!in2p3.fr!news.ecp.fr!aioe.org!not-for-mail
From: "alessandro mura" <fake@address.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: geometry center
Date: Wed, 23 Apr 2008 11:48:00 +0200
Organization: Aioe.org NNTP Server
Lines: 25
Message-ID: <fun0kg$95l$1@aioe.org>
References: <fumrl7$4ck$1@fred.mathworks.com>
NNTP-Posting-Host: suGzoCeMjfkqbPRWbpVn0A.user.aioe.org
X-Complaints-To: abuse@aioe.org
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Original
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-Priority: 3
X-MSMail-Priority: Normal
Xref: news.mathworks.com comp.soft-sys.matlab:464713



I don't know exactly what is the center of a color image,
but for a gray scale:


[x,y]=ndgrid([1:100],[1:100]);
z=exp(-((x-50)/10).^2-((y-24)/10).^2);
subplot(1,2,1)
pcolor(x,y,z)
colormap gray

xc=mean(x(:).*z(:))/mean(z(:))
yc=mean(y(:).*z(:))/mean(z(:))
subplot(1,2,2)
pcolor(x-xc,y-yc,z)

regards

Alessandro

-- 
Alessandro Mura
Istituto Nazionale di Astrofisica - IFSI
http://pptt4.ifsi-roma.inaf.it/~mura/index.html