November 2004, updated July 2016
The source code implementing the projections below is only availableon request for a small fee. It includes a demo application and an invitation toconvert an image of your choice to verify the code does what you seek. For more information please contact the author.
- Converting a pair of fisheye images to a 360 equirectangular panorama.
The following documents various transformations from fisheye into other projectiontypes, specifically standard perspective as per a pinhole camera, panorama andspherical projections.Fisheye images capture a wide field of view, traditionally one thinks of 180degrees but the mathematical definition extends past that and indeed there aremany physical fisheye lenses that extend past 180 degrees. The two main applicationsfor the following are: the inspection of images/video from security cameras wherepanorama or perspective views may be more natural to view, creating panorama orspherical images that are blended together to form even wider field of view images.
The general options for the software include the dimensions of the output image as wellas the field of view of the output panoramic or perspective frustum. Some otherrequirements arise from imperfect fisheye capture such as the fisheye notbeing centered on the input image, the fisheye not be aligned with theintended axis, and the fisheye being of any angle.Another characteristic of real fisheye images is their lack of linearitywith radius on the image, while this is not addressed here as it requiresa lens calibration, it is a straightforward correction to make.
- Hugin is more than just a panorama stitcher Hugin-2010.2.0 released 2010-10-10 Hugin is a panorama stitcher and more. Panini is a panorama viewer and perspective tool libpano13 2.9.14 released 2009-05-24 libpano13 is the panorama library behind Hugin FreePV 0.3.0 released 2009-05-05.
- 1 Introduction Algorithms for aligning images and stitching them into seamless photo-mosaics are among the oldest and most widely used in computer vision. Frame-rate image alignment is used in every camcorder that has an “image stabilization” feature. Image stitching algorithms create the high.
The usual approach for such image transformations is to perform the inverse mapping. Thatis, one needs to consider each pixel in the output image and map backwards tofind the closest pixel in the input image (fisheye). In this way every pixelin the output image is found (compared to a forward mapping), it also meansthat the performance is governed by the resolution of the output image(and supersampling) irrespective of the size of the input image.A key aspect of these mappings is also to perform some sort of antialiasing, thesolutions here use a simple supersampling approach.
The code here are all plain vanilla C tested on Unix style gcc systems (specifically Mac and Linux),but the algorithms/code can readily be modified for otheroperating systems and programming languages.This is not meant to be a final application but rather something you integrate into your code base. Having said that it is wrapped up in a simple TGA image reader/writer for the purposes of algorithm testing, the intent is that one would be implementing the function into ones own code base. They all operate on a RGB buffer (fisheye image) in memory.For each test utility the usage message is provided. The source images for the examplesprovided are provided along with the command line that generated them.
Fisheye to perspective transformation
Software: fish2perspIt should be noted at the outset that a fisheye projection is not a 'distorted' image, and the process isn't a 'dewarping'. A fisheye like other projections is one of many ways of mapping a 3D world onto a 2D plane, it is no more or less 'distorted' than other projections including a rectangular perspective projection .. it is what it is.
Example source fisheye image.
A critical consideration is antialiasing, required when sampling any discrete signal. The approach here is a simple supersampling antialiasing, that is,each pixel in the output image is subdivided into a 2x2, 3x3..grid andthe inverse mapping applied to the subsamples. The final value for the outputpixel is the weighted average of the inverse mapped subsamples.There is a sense in which the image plane is considered to be a continuousfunction. Since the number of samples that are inverse mapped is the principle determinant ofperformance, high levels of antialiasing can be very expensive, typically2x2 or 3x3 are sufficient especially for images captured from video in whichneighbouring pixels are not independent in the first place.For example a 3x3 antialiasing is 9 times slower than no antialiasing.In general the jagged edges are more noticeable in featureswith a sharp colour/intensity boundary.
Default perspective view looking forwards, 100 degrees horizontal field of view.