Hei!
I have an image and on that image I'd like to select a point and tell it to which coordinate it should transform. I'd like to do this for some number points. And when I finish the whole image would transform, so that locality would be considered.
The most import thing is that I can choose as many points as I want and that the chosen points transform to the exact chosen location not approximate. So for choosing only one point the transformation would be simple translation, for choosing two points it would be linear transformation plus translation and so on...
What would be 开发者_如何学Pythondifferent algorithms that do this for any number of points, and what are their advantages and disadvantages?
It seems that you want the image to pass a (possibly) non linear transformation uniformly on all points. That seems to be exactly equivalent to polynomial regression on the point coordinates.
One way would be to regard your coordinates (x,y) say as defining a complex number x+i*y. You then have source points p[0]..p[n] and destination points q[0]..q[n], and could then find a degree n complex polynomial P that maps each p[j] to q[j], and use this polynomial to map the rest of the points. The usual way to find the polynomial is to use Lagrange Polynomials, eg here. (This discusses real lagrange polynomials, but the formulae for complex ones are exactly the same).
精彩评论