Path: news.mathworks.com!not-for-mail
From: "David Doria" <daviddoria@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Origin in the center of an image, +y at the top!
Date: Wed, 3 Oct 2007 12:58:42 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 59
Message-ID: <fe03m2$b2r$1@fred.mathworks.com>
References: <fducih$nku$1@fred.mathworks.com> <fduvg8$mmt$1@fred.mathworks.com>
Reply-To: "David Doria" <daviddoria@gmail.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1191416322 11355 172.30.248.38 (3 Oct 2007 12:58:42 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 3 Oct 2007 12:58:42 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1105197
Xref: news.mathworks.com comp.soft-sys.matlab:431157



Hmm kind of...

If I do this:

image(InputImage, 'XData', [-size(InputImage,2)/2
size(InputImage,2)/2], 'YData', [size(InputImage,1)/2
-size(InputImage,1)/2])

set(gca, 'Ydir', 'normal');

It appears correctly (with axes labeled how i want them),
but I cant click on the image to get the coordinates, it
snaps the cursor to the top/bottom edge of the image.

If i do this (note the sign change):

image(InputImage, 'XData', [-size(InputImage,2)/2
size(InputImage,2)/2],'YData', [-size(InputImage,1)/2
size(InputImage,1)/2])

set(gca, 'Ydir', 'reverse');

the picture is the right orientation, but the y labels are
upside down from what i want, but i CAN click on the image.

Surely I am being silly... but i think i've tried all
combinations of these signs and directions and it wont seem
to workout.

Thanks

David

"Steven Lord" <slord@mathworks.com> wrote in message
<fduvg8$mmt$1@fred.mathworks.com>...
> 
> "David Doria" <daviddoria@gmail.com> wrote in message 
> news:fducih$nku$1@fred.mathworks.com...
> >I figured out how to move the origin, using this command:
> >
> > imshow(InputImage, 'XData', [-size(InputImage,2)/2
> > size(InputImage,2)/2], 'YData', [size(InputImage,1)/2
> > -size(InputImage,1)/2])
> >
> > however, that FLIPS my image!!  Is there a convenient way to
> > have (0,0) at the center of my image and have +y going up
> > and +x going to the right?
> 
> Set the YDir property of your axes.
> 
>
http://www.mathworks.com/support/solutions/data/1-16MFFQ.html?solution=1-16MFFQ
> 
> -- 
> Steve Lord
> slord@mathworks.com 
> 
>