I want to convert regular panoramic photos to polar coordinates to create a "tiny earth" effect but i cannot figure out how to solve this. I would assume there is some helpful Core Graphics filter or third party library but i cannot find any.
Example:
This is actually quite simple, you just have to apply polar coordinates. Here is a fully commented example (implemented in C++ and using OpenCV only for data structures and image loading and display):
Sample input panorama (source):
Resulting image:
EDIT:
To answer your remark about the black borders, you can adjust the mapping function (which maps pixel coordinates in the final image to pixel coordinates in the panorama image) to achieve what you want to do. Here are some examples:
Source panorama:
1) Original mapping: pixels with radius>panorama.rows/2 are left un-touched (hence you can have whatever background image show up there)
Result:
2) Closest-point mapping: pixels with radius>panorama.rows/2 are mapped to the closest valid pixel in the panorama.
Result:
3) Zoomed-in mapping: the tiny-earth image is zoomed in so that pixels with radius>panorama.rows/2 are mapped to valid panorama pixels, however some parts of the panorama are now mapped outside the tiny-earth image (at the top/bottom/left/right)
Result:
4) Logarithmic mapping: a non-linear mapping involving the log function is used to minimize the areas of the panorama which are mapped outside the tiny-earth image (you may adjust the 100 constant to scale more or less).
Result: