Find coordinates of point on original image after using interp2

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Geometric 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