Hi,

I found very few examples for transform.PolynomialTransform on the internet so I hope someone in this group can help me understand what I am doing wrong.

If it's not the right place to ask for help, please forgive me!

Here is my problem. I have a greyscale image with some curved lines.

I want to transform it so the lines become straight.

So I measure the position of the lines at regular intervals (in the attached file source_test2.csv)

And compute the desired positions after transformation (in the attached file destination_test2.csv)

So i have a nice set of input points and their correspondences as in the figure below (red = input points, and blue = desired positions after transformation):

Next I compute the transformation using skimage.transform.PolynomialTransform and a polynomial of order 2, and apply the transformation to get the warped image using skimage.transform.warp

But the warped image is completely crazy! See below:

It seems the transformation found by PolynomialTransform is completely wrong...

**Note that I managed to get a good transformation in some cases for sub-images (e.g using the first 400 columns only).**

What am I doing wrong?

Are PolynomialTransform too unstable? Do I need a regular grid?

I attach the code I use (warp.py)

Thanks for your help!

HervĂ©