How to turn off drawrectangle?

6 ビュー (過去 30 日間)
KAE
KAE 2018 年 11 月 13 日
編集済み: KAE 2018 年 11 月 14 日
I used drawrectangle to draw a rectangle on an image and adjust its size and position, but then I can't figure out how to turn off its adjustability and get its final position.
I tried left and right clicking 1X or 2X in the image, next to the image, etc., but the drag points still remain and it is possible to adjust it. Any ideas? Or is there a better function to draw a rectangle, adjust it, finalize it, then get its final position?
figure;
% Draw an example image
peaks;
view(2);
% Draw a rectangle
h = drawrectangle; % But after adjusting, how can I turn off the adjustability?

採用された回答

Jan
Jan 2018 年 11 月 14 日
An interesting question! The documentation https://www.mathworks.com/help/images/ref/drawrectangle.html does not reveal this important detail, as far as I can see. This seems to imply, that there is no finalization at all. You simply get the handle of the rectangle and implement the waiting by anything else, e.g. uiwait or a button.
  1 件のコメント
KAE
KAE 2018 年 11 月 14 日
編集済み: KAE 2018 年 11 月 14 日
Matlab recommends drawrectangle as a replacement for imrect, but in imrect after you adjust the rectangle you can freeze it by double clicking ('Double-click on the rectangle to resume execution of the MATLAB command line.') So imrect is still better for my application. I am mentioning it in case someone else has this requirement too.

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

その他の回答 (0 件)

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by