,.
. :%%%. .%%%.
__%%%(\ `%%%%% .%%%%%
/a ^ '% %%%% %: ,% %%"`
'__.. ,'% .-%: %-' %
~~""%:. ` % ' . `.
%% % ` %% .%: . \.
%%:. `-' ` .%% . %: :\
%(%,%..." `%, %%' %% ) )
%)%%)%%' )%%%.....- ' "/ (
%a:f%%\ % / \`% "%%% ` / \))
%(%' % /-. \ ' \ |-. '.
`' |% `() \| `()
|| / () /
() 0 | o
\ /\ o /
o ` /-|
___________ ,-/ ` _________ ,-/ _________________ INCLUDES _ OCAML _ SOURCE _ CODE _ EXAMPLES _____________________________________________

Sunday, February 1, 2015

The Wee Planet Effect

This time, I am going to present one the most artistic image processing filter since my first post. So be ready for the Wee Planet effect. Expressed in technical terms, Wee Planets are stereographic projection of equirectangular panoramas. Actually, I had absolutely no idea what it was until I found this beautiful flickr album by chance https://flic.kr/ps/nnt65 (the funny part is that this album is the Alexandre Duret-Lutz's album, he is my current algorithmic teacher). Take a quick look then you will realize how many incredible possibilities this filter can offer. In addition to this, it is possible to implement as you will see and this transformation can be also interesting if you want to interactively observe a certain place under different angles by changing the longitude and latitude of your viewing point. See below :

Before starting, just note that this post will contain a very few source code because the most difficult part is mainly the photographer's job. Indeed, if you want to get this effect, you will need an appropriate picture, a equirectangular panorama as I said before. Basically, it's a panorama that represents a 360˚ horizontal and 180˚ vertical field of view. But there is a problem... there aren’t any camera lenses capable of capturing such an enormous field of view yet in only one capture. Because the solution is beyond the scope of this tutorial, I suggest you to do your tests with the equirectangular panoramas of the previous flickalbum or if you still want to know the solution, just go here : http://goo.gl/uqpFiV.
I will use that :



The first task is to apply a simple vertical flip to your image (assuming that your picture was not taken upside down). I think I already talked about the flip transformation in one of my posts but...

Guess what? We have nearly already finished. You just have to apply a polar effect to your image now. The polar effect consists in converting the cartesian coordinates (x,y) of every pixels into their polar coordinates. So this effect has as purpose to project your image on a circle (see the illustrations). To get this result, you have to calculate the polar coordinates r (a radius) and φ (an angle in radians) where r = sqrt(x2 + y2) and φ = 4*atan(y/x). Now, you can move every pixels to their new location (x',y') (only if x' and y' are inside the image matrix representation) where x' = r / 4 * cos(φ) + (image width/2) and y' = r / 4 * sin(φ) + (image height/2). Here is a small source code example :


Finally, I get these results (I can now read this Japanese message or not... Maybe it's written 'Parking') :

EDIT: It turned that 駐車禁止 means 'No Parking', I was close...



さようなら!

Links 
:
http://www.dailymail.co.uk/news/article-1222162/Sensational-images-artists-mini-planets-styled-worlds-favourite-landmarks.html