Find coordinates of point on original image after using interp2

조회 수: 3 (최근 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 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