I'm looking for a way to apply a "perspective correction" to an image in an iPhone app.
This question 开发者_C百科explains how to apply a perspective distortion, what I want is exactly the inverse operation...
Any idea how to do this?
Assuming the transform has an inverse, if you have the original transform then you can use CATransform3DInvert().
If you have a quadrilateral (but not the transform) and want to map it to a square/rectangle, there's plenty of code out there — Googling inverse perspective transform gives a few results. If you're working in homogeneous coordinates, then solve the matrix and invert it (or something).
What I finally did was make use of an ImageMagick port to the iPhone, that can be found here.
Just in case someone else needs something like this...
精彩评论