4

I'd like to find a library which can do simple but true 3D reverse projection.

Given an image of a flat surface viewed from an arbitrary viewpoint in space, return a flat 2D image with perspective removed, as if the camera had been in the ideal position directly front and centre of the image.

A contrived example:
3D source image 3d image "unprojected" to 2d image

(Ignore the overlaid rectangle on the latter, I'm just using the first images I can find so far.)

I'm not expecting miracles. Some distortion, artefacting, curves due to lens geometry is surely inevitable.

For the purposes of this question it must do true 3D manipulation, correcting foreshortening, not just warping the image based on moving the four corners of a rectangle.

Requirements:

  • Cross platform
  • Low level language such as C or C++
  • Real 3D manipulation

Preferred but not required:

  • Open source
  • Free
  • Fully automatic is great, but I'm expecting it requires some other parameters such as the coordinates of the four corners in the source image.
  • 2
    I have used a SGI IRIX command-line tool for this, I just have to try and remember the name, but that exists! It was 10 years ago though. – Nicolas Raoul Mar 27 '14 at 5:50
5

Image Magick can do this. It is free software under the Apache 2.0 license. It has a C API.

See http://www.imagemagick.org/Usage/distorts/#perspective for examples of how to do what you want with the command line tool.

Also see http://www.imagemagick.org/script/magick-wand.php for the user-level C API that gives access to same commands as convert in C.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.