A little bit about how we wrote a photo mosaic generator for Android
When I was in school, notebooks with photo mosaic on the cover were popular. And at some certain moment I wanted to repeat the same effect, but with my original image. After a bit of browsing the Internet, I found some ready-made solutions for desktops, but some were paid, and some were very old. Thus, it was decided to try to write the most and not just like that, but on the phone with Android on board.
For a start, what is a photo mosaic ? This image, assembled from many others, selected in such a way as to make their set as clearly as possible resemble the original image in outlines.
Example:
')
As you can see, the parts of the mosaic are selected by the dominant color on the processed area of the original image. Thus, the idea of the algorithm of the future application immediately appeared:
1. Divide the original image into sections.
2. Step after the naked to go through each section and determine the dominant color.
3. In the place of each section to insert a thumbnail with the same dominant.
The snag was only HOW to look for the dominant color. Since I was just starting to program, this program was almost the first project in my life, so the first thing I’ve got on the Internet is looking for a super-mega algorithm. Googling a bit, I learned about the histograms and how they are roughly created. If the memory does not fail, I even saw libraries somewhere to find the color histogram. But it’s not interesting, so I decided to look for my solution. As a result, I came to a simple and almost stupid way: look for the arithmetic average of three colors from all the pixels of one area. Having received the first results, even he himself was surprised, this method works quite well.
Having received a charge of motivation, began to write the program itself. In the course of several weeks, in the evenings, in the free time from the university, by trial and error the program was written. Deploy did immediately to the phone HTC Wildfire S with Android 2.3.3 in order to test the performance of the program on a weak hardware.
Later it turned out that even two thousand images as a “tile” of a future mosaic are few. The more material to work, the better and clearer the final image is obtained. With grief in half, he collected almost 7,000 pictures, and the mosaics began to take on quite a decent look. A few edits and selection of a suitable step of the cycle, and the program has earned, like a clock.
At this, my goal was achieved, the next step was to give the program at least some proper look. Since the designer of me is none, and in the markup is not strong, I entrusted this function to my university colleague, who was also interested in developing for Android, the results of his works are given above.
When the development and cutting out of bugs came to an end, the most interesting began: registration and publication to the market. As expected, the process is fairly simple and there is nothing special about it: first register, prepare all the necessary graphics for the market, and then the publication itself. The most exciting moment is that day of waiting until your application appears in the market and the search results will lead to your creation. Probably this is one of the most pleasant feelings - to know that yours, whatever it may be, the work is available to the public and anyone can download and leave a comment. Speaking of comments, I never thought that feedback could be so morally necessary. I remember as a child's delight when you read another review, and the best part is when it is constructive and even criticized. Criticism helps a great deal, to some extent it lowers from heaven to earth and makes you look at things from the other side.
In order to reward ourselves as something for work, we have embedded advertising in the application, which, as it turned out, was not as profitable as expected. I will say briefly, almost a year in AdMob a little more than $ 100 dripped, and this with more than 9000 total downloads and 1500 active downloads.
The only thing we did for distribution was to upload apps to Amazon Market, Samsung Apps, and just for fun on w3bsit3-dns.com.
Initially, the application was conceived as an experiment, and not a way to make money, so we did not invest in advertising or promotion. As soon as downloads passed several thousand, the application began to appear on popular resources, it was even overlooked in some places. In turn, this also can not but rejoice.
As a result, we earned nothing on advertising, but gained experience in developing and publishing the application. Now we both work as Android developers, and a week ago we were offered a good amount for the program and we sold it.