title: Aligning points to a grid using skimage's transform.PolynomialTransform.estimate
body: <p>Let's say I have a list of points in coordinate form which are supposed to form a perfect grid in reality, but are somewhat distorted (like in the image below). You'll notice that the spacing between the points varies, but I am looking for a way to make this image completely uniform by finding polynomial coefficients to correct for this distortion.</p>
  <p><img src="https://i.ibb.co/z8vNTCm/image.png" alt="image" /></p>
  <p>In my attempts, I've tried using <a href="https://scikit-image.org/docs/dev/api/skimage.transform.html#skimage.transform.PolynomialTransform" rel="nofollow noreferrer"><code>skimage</code>'s <code>transform</code> method</a> as shown in the line of code below:</p>
  <pre><code>transform.PolynomialTransform.estimate(original_points, destination_points, 3)
  </code></pre>
  <p>There are a few problems with this, however. First and foremost, I don't know the exact format for the points parameter. I've used a list like <code>[[x1,y1],[x2,y2], ...]</code> among other formats but it always gives the following error:</p>
  <pre><code>TypeError: list indices must be integers or slices, not tuple
  </code></pre>
  <p>The second problem is that even if I manage to format the points correctly, it doesn't seem like the function returns any polynomial coefficients to actually apply this correction.</p>
  <p>What I am asking here is either:</p>
  <ul>
  <li>How do I use the <code>estimate</code> function properly to return polynomial correction coefficients (including how to actually input the parameters properly)?</li>
  <li>Alternatively, is there a different function which would be easier to use for this purpose?</li>
  </ul>
  <p>So this problem can be reproducible, try using the following points:</p>
  <pre><code>(0,0), (2,0), (1,1), (0,2), (2,2)
  </code></pre>
  <p>And fitting these points to these new points:</p>
  <pre><code>(0,0), (4,0), (2,3), (0,6), (4,6)
  </code></pre>
  <p>Note that I would prefer to be able to obtain 3rd order polynomial coefficients</p>