Thin Plate Spline & Lanczos Interpolation

Hello all! Apologies for past twice in the past couple of weeks.

I’ve been struggling a bit on my project regarding aligning astronomical images nonlinearly. I have a question converting from Scikit-Image to OpenCV:

  • I’ve been trying to do this using OpenCV instead, but have been struggling to getting results as the above. The images look very twisted and incorrect. Here is the code that I thought would be the equivalent in OpenCV:
# Scikit-image
tps = ThinPlateSplineTransform()

tps.estimate(dst_pts, src_pts)

warped_img = warp(src_img, tps, order=5)
# OpenCV
tps_transformer = cv2.createThinPlateSplineShapeTransformer()

matches = [cv2.DMatch(i, i, 0) for i in range(len(src_pts))]

tps_transformer.estimateTransformation(src_pts.reshape(1, -1, 2), dst_pts.reshape(1, -1, 2), matches)

warped_img_opencv = tps_transformer.warpImage(src_img, flags=cv2.INTER_LANCZOS4)