2

I'm looking for a way to apply a "perspective correction" to an image in an iPhone app.

This question explains how to apply a perspective distortion, what I want is exactly the inverse operation...

Any idea how to do this?

Sample image

Community
  • 1
  • 1
Marcos Crispino
  • 8,018
  • 5
  • 41
  • 59

2 Answers2

0

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).

tc.
  • 33,468
  • 5
  • 78
  • 96
0

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...

Marcos Crispino
  • 8,018
  • 5
  • 41
  • 59