I am translating a MATLAB program to Python program. In the MATLAB program I have the following line.
[x,y]=meshgrid(1:width,1:height);
tImg(:,:,1) = interp2(x,y,Img(:,:,1),single(Tx),single(Ty),'cubic');
So I translated it to the following Python code:
tImg[:, :, 0] = cv2.remap(img[:, :, 0], Tx.astype(np.float32), Ty.astype(np.float32), cv2.INTER_CUBIC)
The variable img is a 298 x 142 x 3 matrix. Tx and Ty are both 298 x 142 matrix. I have compared them in MATLAB and in Python and all variables are equal in both places. However, I did not get the same tImg after I execute the line above.
I am wondering if I am doing something wrong here. Thanks for help in advance.