Using imshow(), set(gca, 'YDir', 'normal'), and ginput()

25 ビュー (過去 30 日間)
Arian Kolahi Sohrabi
Arian Kolahi Sohrabi 2019 年 3 月 10 日
回答済み: Walter Roberson 2019 年 3 月 10 日
Hello,
I'm having a hard time dealing with the following issue. My intention is to set the Y direciton to normal in ginput without flipping the image I'm investigating. Here's my current code:
imshow('frame1.jpg');
hold on
set(gca, 'YDir', 'normal');
[x,y]=ginput(2);%click on body first, then head
hold off
However, this code also flips image 'frame1'. I'd appreciate it if anyone can help me find a way to prevent my image from getting flipped.

回答 (1 件)

Walter Roberson
Walter Roberson 2019 年 3 月 10 日
You will need to adjust the view() . Alternately, parent the image to a hgtransform and set the transform matrix so that the display comes out the way you want. Or third option: if you set the xdata and ydata properties of the image it is possible to get it to display upside down.
Have you considered just using flipud() ?
I think you will find that your requirements are inconsistent with using the results of ginput() to index into the image.

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by