imcrop でトリミングする画像​のピクセル座標(左上​のX座標、Y座標)を​取得したいです。

トリミング前の画像のピクセル座標から、トリミング画像の左上隅のX座標Y座標 を取得するにはどうしたらよいですか?

 Risposta accettata

Kei Otsuka
Kei Otsuka il 15 Ago 2018

1 voto

トリミングする画像のサイズや位置は、戻り値を増やすことで取得することができます。
[img, rect] = imcrop(I);
rectは位置ベクトルで、サイズと位置が[xmin ymin width height]の順で格納されています。

2 Commenti

Tsubasa Mawatari
Tsubasa Mawatari il 16 Ago 2018
回答ありがとうございます。 位置ベクトルをピクセル座標に補正するにはfigureのプロパティからPosition、実際の画像サイズなどから計算する必要がありますか?
Kei Otsuka
Kei Otsuka il 17 Ago 2018
rectは画像左上端を原点とした空間座標系となっています。
ピクセルインデックスに対応した空間座標系ですので、別途補正などの
計算は必要ないと思いますが、上記リンク先を確認してみてください。

Accedi per commentare.

Più risposte (0)

Prodotti

Release

R2018a

Community Treasure Hunt

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

Start Hunting!