Thread Subject: getPosition error? I don't know...;;;

Subject: getPosition error? I don't know...;;;

From: Il Yoon

Date: 23 Jan, 2008 04:51:02

Message: 1 of 8

Hello all,

Could see the following?


figure, imshow('pout.tif');
h = imrect(gca, []);
API = iptgetapi(h);
position= API.getPosition();


If I get the position, it should have 4 values, like,
[10,20,70,80].
10, and 20 are starting poing, and 70, 80 are the ending
point. But, if I run the it, it only has starting poing.
The ending point are always 0, 0. What's wrong with this?

Please help me, ASAP.

Thank you in advance.

Il Yoon

Subject: getPosition error? I don't know...;;;

From: Nevine Jacob

Date: 23 Jan, 2008 05:12:03

Message: 2 of 8

Works fine for me all the time. Which version of MATLAB are
you using? What's your OS and platform?

Subject: getPosition error? I don't know...;;;

From: Nevine Jacob

Date: 23 Jan, 2008 05:23:02

Message: 3 of 8

By the way, the last two points represent the height and
width of the rectangle and not the end points. And the
first two points represent the x-y coordinates of the
leftmost-bottommost point in the rectangle.

Looks like you are just clicking on the figure rather
selecting a rectangular region. And hence you see (0,0),
that is, no height and no width.

Subject: getPosition error? I don't know...;;;

From: Il Yoon

Date: 23 Jan, 2008 05:35:03

Message: 4 of 8

Thank you for your reply.

Well, I click the starting point and drag to the ending
point.

My Matlab version is,
MatLab R2007a Version 7.4.0.287(R2007a).

And, I am using,
Windows xp, version 5.1 (Build 2006. xpsp_sp2_gdr.070227-
2254: Service Pack 2)




"Il Yoon" <matlab_newsgroup@mathworks.com> wrote in message
<fn6h3m$7l3$1@fred.mathworks.com>...
> Hello all,
>
> Could see the following?
>
>
> figure, imshow('pout.tif');
> h = imrect(gca, []);
> API = iptgetapi(h);
> position= API.getPosition();
>
>
> If I get the position, it should have 4 values, like,
> [10,20,70,80].
> 10, and 20 are starting poing, and 70, 80 are the ending
> point. But, if I run the it, it only has starting poing.
> The ending point are always 0, 0. What's wrong with this?
>
> Please help me, ASAP.
>
> Thank you in advance.
>
> Il Yoon

Subject: getPosition error? I don't know...;;;

From: Il Yoon

Date: 23 Jan, 2008 05:42:03

Message: 5 of 8

Thank you for your reply.

Well, I clicked the starting point, and draged to the
ending point. In the picture, I can see the rectangle in
the image. It was not a just spot.

Version informations are,

MatLab R2007a Version 7.4.0.287(R2007a)

Windows xp, version 5.1 (Build 2006. xpsp_sp2_gdr.070227-
2254: Service Pack 2)



"Il Yoon" <matlab_newsgroup@mathworks.com> wrote in message
<fn6h3m$7l3$1@fred.mathworks.com>...
> Hello all,
>
> Could see the following?
>
>
> figure, imshow('pout.tif');
> h = imrect(gca, []);
> API = iptgetapi(h);
> position= API.getPosition();
>
>
> If I get the position, it should have 4 values, like,
> [10,20,70,80].
> 10, and 20 are starting poing, and 70, 80 are the ending
> point. But, if I run the it, it only has starting poing.
> The ending point are always 0, 0. What's wrong with this?
>
> Please help me, ASAP.
>
> Thank you in advance.
>
> Il Yoon

Subject: getPosition error? I don't know...;;;

From: Volkan

Date: 23 Jan, 2008 11:46:02

Message: 6 of 8

"Il Yoon" <matlab_newsgroup@mathworks.com> wrote in message
<fn6k3b$f7u$1@fred.mathworks.com>...
> Thank you for your reply.
>
> Well, I clicked the starting point, and draged to the
> ending point. In the picture, I can see the rectangle in
> the image. It was not a just spot.
>
> Version informations are,
>
> MatLab R2007a Version 7.4.0.287(R2007a)
>
> Windows xp, version 5.1 (Build 2006. xpsp_sp2_gdr.070227-
> 2254: Service Pack 2)
>
>

Hello Il,

Here is what you do wrong:

When you execute the entire 4 lines of code:

>>figure, imshow('pout.tif');
>>h = imrect(gca, []);
>>API = iptgetapi(h);
>>position= API.getPosition();

API and position are not created until imrect returns a
handle (paused at line 2). imrect.m exits as soon as you
click on the image, and naturally API.getPosition is a
single point.

If you type
>>position= API.getPosition();
once more after selecting a rectangle, you will see that
position will contain the correct numbers.

And maybe someone else can help you with how to set it up so
that position is updated as you change the rectangle.

Cheers,
Volkan

Subject: getPosition error? I don't know...;;;

From: Il Yoon

Date: 23 Jan, 2008 18:09:04

Message: 7 of 8

Thank you all.
Your replys are helpful to me.

Il Yoon

Subject: imrect problem

From: Rajesh fdgsdf

Date: 16 Apr, 2008 10:33:02

Message: 8 of 8

Dear Volkan and ll,
I am facing a similar problem. Matlab 2007a.

Volkan can you elaborate this please

> If you type
> >>position= API.getPosition();
> once more after selecting a rectangle, you will see that
> position will contain the correct numbers.
>
> And maybe someone else can help you with how to set it
up so
> that position is updated as you change the rectangle.


do you mean
type "position=api.getposition();" in imrect.m???

pl elaborate.

I too am getting wdth and ht as 0,0

secondly, i want to have the end coordinates...instead of
ht and width. how do i get it???
thanks

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

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com