Tuesday, August 16, 2011

Your own Images to ASCII arts application - Part II (Design)

NEW!! Executable project is @ http://code.google.com/p/image-to-ascii/


OK!!! let's look at the design of our application, Image to ASCII converter. First I have to tell you that the application is very simple. Even I also thought it will be very difficult to implement such an application. I don't know how other people out there implemented this but when I think  I came up with a very simple solution. In a pictorial view my solution is like this.


How to convert raster to a ASCII art


The above image show how I plan the thing. First the user will have to point out the image. Then the image will get converted to a gray scale image. Then the second step is to do a multi level threshhold to the image.
In a multi level threshold we simply make set of color groups. As an example pixels which are having color value 200 to 255 will put in to a one group while color value 150 to 199 put in to another group. The multi level thresholding will be obvious when you look at the below image.


Multi level thresholding
After the multi level thresholding what I'm doing is assigning relevant ASCII character to each level as shown in the below figure. Selecting the correct ASCII character for a value is bit tricky. Therefore we have to put some character for a level and check weather it is relevant. As an example get the letter "M" when a set of Ms are together they represent back color.
Map ASCII characters to color levels


Now we talked about the algorithm for creating an ASCII image form a Raster image. Now it is a matter of implementing this algorithm using some language, which we are going to talk in my next post.. bye!  

No comments:

Post a Comment