Image warping using transform.PolynomialTransform: crazy results

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.
https://lh3.googleusercontent.com/-l7PV-L6ZCek/VGsf6aKWYpI/AAAAAAAABSk/Pae2VGzGThY/s1600/test2.png
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é

Hi Hervé
On 2014-11-18 13:21:34, Herve Bouy hervebouy@gmail.com wrote:
Here is my problem. I have a greyscale image with some curved lines. I want to transform it so the lines become straight.
https://lh3.googleusercontent.com/-l7PV-L6ZCek/VGsf6aKWYpI/AAAAAAAABSk/Pae2VGzGThY/s1600/test2.png
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)
I had a look at your input CSV files, but I cannot quite match the coordinates given there to what is happening in the image. Can you provide some insight?
Regards Stéfan
participants (2)
-
Herve Bouy
-
Stefan van der Walt