Interpolation between two 2D projective geometric transformations

Hello,
I need to interpolate between two 2-D projective geometric transformations, in order to obtain the tforms between the two limiting tforms. I have a 2-levels target to calibrate a camera and I use functions fitgeotrans and imwarp to obtain the transformation between the target and the camera image. As it is two levels, I have two t-forms, one for the initial state and the other for the final state.
Ltarget = imread('target.tif') ;
I = imread('image_camera.tif') ;
% Points_target : Centroids of target circles
% Points_initial: Coordinates of the centroids on the camera image in the initial state
% Points_final: Coordinates of the centroids on the camera image in the final state
t1 = fitgeotrans(Points_target, Points_initial,'projective'); %initial transform
t2 = fitgeotrans(Points_target, Points_final,'projective'); % final transform
J1 = imwarp( Ltarget , t1 , 'OutputView', imref2d(size(im2bw(I)))); % get the centroids coordinates on the image camera in the initial state
J2 = imwarp( Ltarget , t2 , 'OutputView', imref2d(size(im2bw(I))));% same but in the final state
The figure "target" shows Ltarget and the second figure shows the superposition of the centroids using respectively transforms t1 (red x) and t2 (green +).
I’d like to get the transformations allowing to find the interpolated positions between initial and final states, using a linear interpolation. Does someone know a function or a smart way to do that ?
I was thinking of doing it by hand by interpolating the trajectory between initial and final locations for the point (x,y) of interest, but it will be very heavy. The function transformtraj() might be what I mean but it takes 4-by-4 homogeneous transformations while my tform is :
projective2d with properties:
T: [3×3 double]
Dimensionality: 2
Thanks in advance,
Elsa

 Respuesta aceptada

Matt J
Matt J el 24 de Oct. de 2022
Editada: Matt J el 24 de Oct. de 2022
You could trysomething like this,
c=0.5;
t3=projective2d(c*t1.T+(1-c)*t2.T)
though I don't have a mathematical proof, off the top of my head, confirming that a convex combination of two projective transformations is again a non-singular transformation.

1 comentario

Hi Matt and thanks a lot for your proposition.
It works quite well, there is less than 1 pixel noise, see figure.
I'll use this, thanks.

Iniciar sesión para comentar.

Más respuestas (0)

Productos

Versión

R2020a

Preguntada:

el 24 de Oct. de 2022

Comentada:

el 25 de Oct. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by