Find coordinates of point on original image after using interp2

3 visualizaciones (últimos 30 días)
Galo
Galo el 21 de En. de 2023
Editada: Galo el 22 de En. de 2023
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

Respuestas (1)

KSSV
KSSV el 21 de En. de 2023
Editada: KSSV el 21 de En. de 2023
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 comentario
Galo
Galo el 21 de En. de 2023
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?

Iniciar sesión para comentar.

Categorías

Más información sobre Geometric Transformation and Image Registration en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by