impixel info - just coordinates

Is it possible to obtain just the pixel x y vlaues from the impxelinfo command?
Im using this and want to get the X & Y seperately.
hp = impixelinfo;
set(hp,'Position',[5 1 300 20]);
Thanks Jason

2 件のコメント

Geoff Hayes
Geoff Hayes 2014 年 9 月 18 日
At what point do you want to obtain/use the x and y values? Do you have some code that runs elsewhere (callback, periodically, or ..?) that needs to get this information? My understanding of this tool is that as you move the mouse cursor over the image, you will see the x,y coordinates and other values (depending upon image type) in the pixel info control. Do you then press the mouse button and expect that a callback will fire and use the current x,y coordinates of the image to do something?
From impixelinfo question, which is a similar question to yours, Ashish Uthama suggests either to use ginput or to grab the coordinate data as
childHandles = get(hp,'Children');
get(childHandles(1),'Tag')
ans =
pixelinfo text
get(childHandles(1),'String')
ans =
(153, 152) <112> [0.50 0.00 0.00]
where hp is the handle to your impixelinfo object. From the '(153, 152) .<112> [0.50 0.00 0.00]' string, you can figure out the x,y coordinates as 153,152.
Jason
Jason 2014 年 9 月 19 日
Thankyou Geoff, thats perfect. Jason

サインインしてコメントする。

 採用された回答

Geoff Hayes
Geoff Hayes 2014 年 9 月 19 日

0 投票

Moved comment to here:
From impixelinfo question, which is a similar question to yours, Ashish Uthama suggests either to use ginput or to grab the coordinate data as
childHandles = get(hp,'Children');
get(childHandles(1),'Tag')
ans =
pixelinfo text
get(childHandles(1),'String')
ans =
(153, 152) <112> [0.50 0.00 0.00]
where hp is the handle to your impixelinfo object. From the '(153, 152) .<112> [0.50 0.00 0.00]' string, you can figure out the x,y coordinates as 153,152.

2 件のコメント

nehad mohamed
nehad mohamed 2021 年 1 月 7 日
I want a tool like a ruler to measure distances in dicom images. In cm. using matlab

サインインしてコメントする。

その他の回答 (1 件)

Jason
Jason 2014 年 9 月 18 日

0 投票

Anyone??

カテゴリ

ヘルプ センター および File ExchangeGeographic Plots についてさらに検索

質問済み:

2014 年 9 月 16 日

コメント済み:

2021 年 1 月 12 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by