Home > Archive > Matlab > January 2008 > getPosition error? I don't know...;;;
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
getPosition error? I don't know...;;;
|
|
| Il Yoon 2008-01-22, 11:02 pm |
| 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
| |
| Nevine Jacob 2008-01-23, 8:57 am |
| Works fine for me all the time. Which version of MATLAB are
you using? What's your OS and platform?
| |
| Nevine Jacob 2008-01-23, 8:57 am |
| 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.
| |
| Il Yoon 2008-01-23, 8:57 am |
| 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
| |
| Il Yoon 2008-01-23, 8:57 am |
| 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
| |
| Volkan 2008-01-23, 8:57 am |
| "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:
[color=darkred]
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[color=darkred]
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
| |
| Il Yoon 2008-01-23, 7:54 pm |
| Thank you all.
Your replys are helpful to me.
Il Yoon
|
|
|
|
|