Code does not work!

2 ビュー (過去 30 日間)
Ali Ibrahim
Ali Ibrahim 2017 年 6 月 23 日
編集済み: Stephen23 2017 年 6 月 23 日
This code used to work, I tried it now.. it does not work.. i do not know what happened! Can anyone try to help me with that? Manual selection to the photo does not work also !
  3 件のコメント
Ali Ibrahim
Ali Ibrahim 2017 年 6 月 23 日
Attached the error shown
Stephen23
Stephen23 2017 年 6 月 23 日
編集済み: Stephen23 2017 年 6 月 23 日
A hard-coded graphics handle is a bad start:
getpts(1)
Why are you not passing the handle of the figure/axes?

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

採用された回答

Walter Roberson
Walter Roberson 2017 年 6 月 23 日
To expand on Stephen's response: change your code to
function [loc] = get_image_point (I)
fig = figure('name','Doubleclick to set location');
imshow(I);
title('Double click on the center of the ring')
[c r] = getpts(fig);
loc = int32([c r]);
if size(loc)>1
loc = [loc(1,1) loc(1,2)];
end
close(fig);
end
  2 件のコメント
Ali Ibrahim
Ali Ibrahim 2017 年 6 月 23 日
Perfect.. it worked!
Ali Ibrahim
Ali Ibrahim 2017 年 6 月 23 日
Thanks

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Performance についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by