perjantai 14. lokakuuta 2011

HD Mosaics


Like many other families, we have also LOTS of family pictures forgotten into the harddrives of our computers. These times people take so many pictures that it's impossible to enjoy all of them. Lately, I've been thinking some "mass-way" to utilize them.

Some photography companies offer some solution to this: Photobook, different collases etc. But they still use only less than 50 images and the results are not very nice.. Too much automation/decorations-i-dont-want etc. Also, I'm guessing that if i would make an album, it would be watched couple of time with relatives, and then forgotten to a bookshelf. I figured the only real possibility is to get the photos into my walls somehow. Large poster / canvas art is the only real option.

Mosaic are great choise when you are able to print in large enough size. This is what I started to study more.

I hand-picked few hundred best pictures and decided that I will create a mosaic from them, forming our wedding picture. I started to search for a good application to calculate the mosaic: I couldn't find any. All of the programs I found, were mostly grid-based lighting / color matchers. They never could make good enough quality for reasonable sized tiles that actually represent the target picture in any printable size => so that in large scale, I could see the picture they are forming. And in small scale, i could see the photos that are forming it.

I decided to write the generator by myself. Since I (and everyone else who is using only own pictures) have very limited size ("very limited" in this context means something like below 10.000) of source images, i needed to find some way to increase the amount of matches with the actual sources I have. The actual test program is (once again) C/C++ with QtSDK and manual "per-pixel-manipulation".

I start the scanning-process by normalizing the lightness on each of my source- and targetblocks. This way there can be good matches even when the original lightness of two images are completely different: Only relative changes apply. This alone increased the quality of the results so significantly, that it alone could have been already enough. I still wanted more, I started adding different parameters / transforms into the blitting of the source tiles:
* xlip (-1 or 1)
* Angle (Anything user wants. I'm testing between -2 and 2 radians with 0.2 radian steps)
* Scale (Anything user wants. I'm using scales from 0.4 to 0.9 )
* Source offset (i'm scanning all of the possibilites from the source according current scale and angle. With a selectable step).

First i tried the algorithm with just a single tile; to see how the scaling / rotating functionality works. The process had many steps before these results but they are not stored anywhere. I ended up doing the matching only with normalized lighting, discarding the source's color. The blit color is derived from the target picture.




Then I started to add actual tiles I'm going to use in the final picture. With more tiles, the time required for the calculation increases. For each tile, it runs several loops inside other loops. This is not a problem for me, I can wait for couple of hours for good image to render. The original results have VERY large resolution (print quality) and they are scaled down before posted here:






Even tough I haven't made the final photo to be printed. I like the results. As you can see, the tiles really try to form the shapes from the original photo. Its especially visible in tests made with larger blocks. I will post the final source when I get it done! No back to coding :p

Ei kommentteja:

Lähetä kommentti