Using ginput with imshow: how to save pixel instead of axis coordinates
3 ビュー (過去 30 日間)
古いコメントを表示
Corymbiamaculata
2019 年 3 月 11 日
コメント済み: Corymbiamaculata
2019 年 3 月 12 日
I'm trying to save coordinates of several points in an image (displayed with imshow) as a new variable, and then run some calculations on the selected pixels based on their coordinates. For some reason my coordinates are not saved as integers but doubles. I tried setting axis limits to [0 x 0 y] where x,y is my pixel resolution, but it doesn't work. Is there any way to save pixel XY instead of current axis coordinates? Thanks in advance for help!
0 件のコメント
採用された回答
Bjorn Gustavsson
2019 年 3 月 11 日
Not directly from ginput. You can easily do whatever rounding of the coordinates you've chosen directly after:
[x,y] = ginput(23);
idx2 = round(x);
idx1 = round(y);
You should also make sure that idx2 and idx1 are between 1 and the size of your image etc.
HTH
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Exploration についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!