Find coordinates of point on original image after using interp2

1 回表示 (過去 30 日間)
Galo
Galo 2023 年 1 月 21 日
編集済み: Galo 2023 年 1 月 22 日
Hello,
So I have a matrix A (10x10) of integers. I use interp2 in order to interpolate A into B, which is another matrix of 9x8.
The code I'm using is:
A=round(rand(10).*10);
[x_a,y_a] = meshgrid (linspace(1,10,8),linspace(1,10,9));
B = interp2 (A,x_a,y_a,'linear');
Is there any method to locate the coordinates of a point of matrix A within matrix B?
I am asking this because I have an image (A) which then I apply some geometric transformations (with some additions, substraction, multiplication, not with imwarp or any MATLAB builtin function) to obtain B. On the original image A I know the coordinates of a specific point, therefore I would like to know the best approximation of that point on image B.
Any help would be appreciated. Thank you

回答 (1 件)

KSSV
KSSV 2023 年 1 月 21 日
編集済み: KSSV 2023 年 1 月 21 日
A=round(rand(10).*10);
[nx,ny] = size(A) ;
[X,Y] = meshgrid(1:ny,1:nx) ;
[x_a,y_a] = meshgrid (linspace(1,10,8),linspace(1,10,9));
B = interp2 (X,Y,A,x_a,y_a,'linear');
  1 件のコメント
Galo
Galo 2023 年 1 月 21 日
Thank you for your response.
1) Could you explain what is this extra step in your code for?:
[nx,ny] = size(A) ;
[X,Y] = meshgrid(1:ny,1:nx) ;
2) But this doesn't answer my question. Let's say I pick the point P with coordinates (8,3) on my image A. I want to know where would that point be in output image B after interp2. Is there a method to calculate this?

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

カテゴリ

Help Center および File ExchangeGeometric Transformation and Image Registration についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by