Thread Subject: geometry center

Subject: geometry center

From: ahmed

Date: 23 Apr, 2008 08:23:03

Message: 1 of 5

I wan't to move adrawing to the center of the image.
i know that i have to find the geometric center of the
image
and move the drawing pixels such that the geometric center
should reside at center of image.
but i don't know how to implement these stepe in matlab
can you help me.

Subject: geometry center

From: alessandro mura

Date: 23 Apr, 2008 09:48:00

Message: 2 of 5

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

Subject: geometry center

From: chandni magoo

Date: 5 Jan, 2009 16:47:01

Message: 3 of 5

hi
i wanted to know the method of finding geometric center of an image


"Ahmed " <mogwari2000@yahoo.com> wrote in message <fumrl7$4ck$1@fred.mathworks.com>...
> I wan't to move adrawing to the center of the image.
> i know that i have to find the geometric center of the
> image
> and move the drawing pixels such that the geometric center
> should reside at center of image.
> but i don't know how to implement these stepe in matlab
> can you help me.
>

Subject: geometry center

From: Adam

Date: 5 Jan, 2009 17:06:02

Message: 4 of 5

"chandni magoo" <chandnimalh@gmail.com> wrote in message <gjtdi5$avk$1@fred.mathworks.com>...
> hi
> i wanted to know the method of finding geometric center of an image


[nRow nCol] = size(theImage);
xCenter = nCol/2;
yCenter = nRow/2;

~Adam

Subject: geometry center

From: Matt

Date: 5 Jan, 2009 17:35:03

Message: 5 of 5

"Adam" <not.real@email.com> wrote in message <gjtelq$nga$1@fred.mathworks.com>...
> "chandni magoo" <chandnimalh@gmail.com> wrote in message <gjtdi5$avk$1@fred.mathworks.com>...
> > hi
> > i wanted to know the method of finding geometric center of an image
>
>
> [nRow nCol] = size(theImage);
> xCenter = nCol/2;
> yCenter = nRow/2;
>
> ~Adam

Actually, because MATLAB uses 1-based indexing, you will probably want


 [nRow nCol] = size(theImage);
 xCenter = (nCol+1)/2;
yCenter = (nRow+1)/2;

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com