フィルターのクリア

Converting pixel coordinates back into x,y values

2 ビュー (過去 30 日間)
jgillis16
jgillis16 2016 年 1 月 11 日
コメント済み: mujtaba almahfood 2016 年 3 月 26 日
I have pixel coordinates of an image and would like to convert these coordinates back into the original (x,y) coordinates and put them in a text file. How would I go about doing this?

採用された回答

Walter Roberson
Walter Roberson 2016 年 1 月 11 日
delta_y = (max_y - min_y) / number_of_rows;
y = (row-1)*delta_y + min_y;
delta_x = (max_x - min_x) / number_of_columns;
x = (column-1)*delta_x + min_x;
Or if you prefer,
y = interp1([1,number_of_rows], [min_y, max_y], row);
x = interp1([1,number_of_columns], [min_x, max_x], column);
This uses the convention that a pixel is identified with the coordinates of its upper-left corner. If a pixel is to be identified with the coordinates of its center then an offset of 1/2 needs to be applied.
  2 件のコメント
jgillis16
jgillis16 2016 年 1 月 11 日
Thanks!
mujtaba almahfood
mujtaba almahfood 2016 年 3 月 26 日
sorry walter roberson .. But i dont understand whats is interp1 and how to know the rows and colmun in the picture if it a normal picture like a natural picture

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDenoising and Compression についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by