Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'd like to transform a sequence of circular fisheye-images to cubic or spherical panorama images to be used in a panorama-viewer based on OpenGL. The viewer-part is nemas problemas but the transform from fisheye to panorama is not my usual cup of tea. I was kind of expecting a google would solve this, but so far I have come up with next to nothing. What would the preferred method be? OpenGL or pixelshaders?

The image sequence is coming from a camera so it has to be done in realtime (or as fast as possible). I have used PanoTools for Photoshop before so I know a little about the process, but not much about the math behind. Any kind soul out there who could get me started? Any resources that could be useful? This can't be something new but I guess it's not that common either. Anyway it's a fun project ... =)

Update:

Found this awesome online shader-laboratory: https://www.shadertoy.com

Just too bad I can't add my own image-inputs here...

share|improve this question
    
That's exactly my cup of tea. Please refer me to a sample of a fish-eyed image –  Aron Boguta Apr 29 '13 at 10:25
    
Here's an example of the kind of image from google: pbase.com/pganzel/image/114943873.jpg (not mine) –  Andreas Zita Apr 29 '13 at 12:43
    
And this is what I'd like the result to look like: hugin.sourceforge.net/docs/manual/250px-Cubic.jpg. Or this: hugin.sourceforge.net/docs/manual/250px-Equirectangular.JPG –  Andreas Zita Apr 29 '13 at 12:48

2 Answers 2

up vote 1 down vote accepted

Since you're going to have a real-time panorama viewer anyway, it seems to me you could configure your panorama viewer to view the fisheye images directly. There is no need to convert them to a cubemap or lat-long format first.

A panorama viewer works by drawing a mesh of some shape (e.g. a cube or sphere) around the camera, and setting up texture coordinates on the mesh such that the image gets wrapped around the mesh in the same mapping used to generate the original image. So viewing fisheye images with it is just a matter of coding up the right mapping. I would suggest building a reasonably tessellated hemisphere and mapping spherical coordinates on the hemisphere to polar coordinates around the center of the 2D fisheye image. No pixel shaders will be needed, just standard texture mapping.

You will need the right mapping between the radial coordinate of the fisheye image and the polar angle of the sphere. Unfortunately, there is no standard fisheye mapping - there are several variations that are all called "fisheye". Wikipedia describes some. The docs for your lens might say what kind of mapping it uses, or you might just have to experiment a bit until things look right.

share|improve this answer

The image you provided even simplifies the whole thing.

What you are looking for is called polar to rectangular coordinates transformation. It's very simple.

You can find some reference here : http://www.cliffsnotes.com/study_guide/Polar-Coordinates.topicArticleId-11658,articleId-11630.html

No point in me going over the topic again as it's avaialable everywhere :)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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