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

Monday, May 11, 2015

Another Image Processing Software

Hello, let me introduce you a very recent project that I did in less than 2 weeks (I think it deserves its place on this blog). It's another image processing software developed this time in Java using Swing, a GUI widget toolkit for Java and which is part of Oracle's Java Foundation Classes (JFC) — an API for providing a graphical user interface. This software is fully multithreaded.
It obviously includes many useful image processing filters and some extra features :
- Open an image from an URL, from your clipboard or via a screenshot
- Export an image to different classic formats (.png, .jpg, .jpeg, .bmp, .gif)
- Create/Open/Save a project as a .myPSD file which keeps all your modifications history
- Load your own filters (contained in a .jar file) at runtime using the appropriate option (File > Load .jar plugin) or by putting directly your .jar file in the 'plugin' directory. Note that each Java class you write and corresponding to a single filter must implement the following interface :

Your .jar file architecture should be like that (then your filters shall appear in Edit > Others...) :
 .
├── folder1
│   ├── Filter1.class
│   ├── ... (you can also have subfolders)
│   └── FilterN.class
│    ...
└── folderN
     ├── Filter1.class
     ├── ...
     └── FilterN.class
- Management of the opening of several projects with different tabs (closable via the View menu)
- Drawing tools : eraser, pencil, text, paint bucket, color picker, color chooser
- Image analysis : histograms, 2D colorspace
- Different skin themes (Metal, CDE/Motif, Nimbus, GTK+, Windows...)

Download it here (make sure to have a recent version of Java installed).

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

Saturday, January 24, 2015

The Puzzle Filter

New Year, New Post. Today, I will present you a little idea I have had.
We will call it the puzzle filter. This filter doesn't create the impression that your image has been transformed into an already solved puzzle by drawing the outlines of all the pieces like that :
I prefer to explain you how to shuffle it. Here are some results with our classic test image of Lena :
 
According to this result, the function we will see (in 4 parts) will take different parameters like the image matrix representation, its dimensions and also the color of the pieces' outlines, the size n of the pieces which are squares. Here is an example of its declaration (in OCaml) :

Now, the first thing to do is to consider what will be the puzzle pieces according to your image. If the dimensions of your image are 512x512 and the dimensions of the pieces are 64x64 for example, there are therefore only (512/64)*(512/64) = 64 puzzle pieces on your image. And you must stock all these pieces in an array. So your array must have (width/n)*(height/n) indexes and each index must contain a small matrix of size nxn.

After filling your array with all the puzzle pieces of your image, you have to shuffle them. A very simple solution can be to choose 2 random positions (must be different) in your array, swap the content of the corresponding indexes and then just repeat this procedure in function of the number of pieces. Here is an example of source code :

Finally, the last procedure consists in displaying all the puzzle pieces in the new order of your array.
You can also delimit the pieces by drawing their outline using the color parameter of the function.