Image warping using transform.PolynomialTransform: crazy results
Herve Bouy
hervebouy at gmail.com
Tue Nov 18 06:21:34 EST 2014
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):
<https://lh4.googleusercontent.com/-2SjXbAQwJHU/VGsi-bqv8OI/AAAAAAAABSw/JsniNBo-Sok/s1600/corresponance.png>
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:
<https://lh3.googleusercontent.com/-VZmvMqQjNTo/VGsjdSpuklI/AAAAAAAABS4/OsAHobcF8dE/s1600/Crazy_Warped.png>
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é
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20141118/d7224a35/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: destination_test2.csv
Type: text/csv
Size: 74260 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20141118/d7224a35/attachment.csv>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: source_test2.csv
Type: text/csv
Size: 117277 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20141118/d7224a35/attachment-0001.csv>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: warp.py
Type: text/x-python
Size: 1326 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20141118/d7224a35/attachment.py>
More information about the scikit-image
mailing list