Re: Gwyneth Paltrow - Jave image->ascii conversion .. and discussion of algorithms
From Markus Gebhard <ukg...@rz.uni-karlsruhe.de>
· alt.ascii-art
· 17 Apr 2001 21:21 · View full thread
Hello CeeJay, Christian 'CeeJay' Jensen wrote: > I was just trying out Jave's imageconversion on one of the images I submitted to the > contest. > Markus how about being able to define your characterset yourself ? You can do that - At least in the one algorithm where it makes sense. There are two of them, that work differently. In the "1 pixel per character"-Algorithm you can not only chose from four given "gradients" but even enter your own (it is an editable textfield). > And how does it choose the right char for a particular area ? That depends on the algorithm - they both work differently. > I can see a few different paths to achive a good conversion > > 1 : simply doing a assesment of the chars and assigning them a shade of grey > on which it bases it's decision on what char to render in that area That's what my "1 pixel per character"-algorithm does. > 2 : Rendering the chars to tiny images and choosing the char > based on fuzzy logic comparisson betwen the rendered image of the char > and the area in which the char should be. I don't think that there are algorithms that do conversion in that way. It is quite complicated to do it so and you have to remember that there are only 126-32=94 characters in Ascii that can be used. So when you go to much into detail it is not very likely that you will find a character that fits good. You will only have the choice between some characters that all do not fit very well. In my "4 pixels per character"-algorithm I do something similar, but by far not as complicated as you described above. Your little drawing is exactly what I need here: > _______ > | | | > | # | | > | # | | > |-#-+---| > | # | | > | ##|## | > |___|___| I devide up all Ascii characters into 4 rectangular regions and write down the "brightness" for each of them to a table. This table is the most important part for the algorithm - It is quite hard to create a good one and I will not make it public :o) Now for conversion you just take four pixels of the source image and try to find the character that fits best. The algorithm finds out what entry in the table is best. You have to decide how to define "best" here (a function that tells you how good an approximation is). Even with only four regions it shows that it is very likely that none of the ascii characters really does fit well. Now if you go further and divide characters into more than 4 regions (e.g.3x2) it all becomes even worse and the results when I tried to do that were not worth considering. Look at that: If you want to have 4 shades of gray for each region, there are 4*4*4*4=256 possible patterns for 4 regions. But you only have 94 characters available - even less if you sort out characters like * (it does not seem to be a good character for ascii images). And some characters are somewhat equal in brightness/area... My algorithm does not use as few as 4 shades of gray for each region - but this is a good way to see why there is so few possibility to improve it. So a division into 4 regions is the maximum of what I think makes sense. Now we have 2 algorithms and you might say "the 4 pixels per character"-algorithm is better. But that depends: If you want a very small result image the 4-a is the best decision, for it will keep some shape information: . ,-. E. ,' Vb._,/ �ELP (Only an example, done by hand) Information of shape seems to be very important to the eye - more important than brightness sometimes. On the other hand, if the image itself does not have much information about shape and has few contrast it is sometimes better not to insist on the shape but to try to keep the brightness as good as possible. Then it is better to chose the 1pixel-algorithm. This also is true if you want to make a very big ascii image with a width of hundreds of characters. The eye will then not see the shape of the characters any longer, it will soften/blur the characters and will only see their brightness. > 3: Do something in between where each char is asssigned a shade of grey AND > some info on what areas of the "cell" it fills. As you can see my 4pixel-algo is somewhat like that. Color information, divided to areas. I can think of one more way to improve the results: One can stress important lines by using characters like for drawing lines: _..-' __.-'' _.--' Up to now I have not seen any algorithm that does that and I am very interested in the results of the competition for we might be able to see results that make use of this or other tricks. > I know most programs just assign a shade of grey to a char and put one pixel = one > char.. > Which as you know don't work .. because a char is much bigger than a pixel and it's not > equally tall as it is wide. Well, it works sometimes. Any other ideas or opinions? Markus
Original message headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: f996b,db78abe5177a5c67 X-Google-Attributes: gidf996b,public X-Google-ArrivalTime: 2001-04-17 14:26:04 PST Path: supernews.google.com!sn-xit-03!supernews.com!cyclone-sjo1.usenetserver.com!news-out-sjo.usenetserver.com!news.tele.dk!193.174.75.178!news-fra1.dfn.de!news-koe1.dfn.de!news.rhrz.uni-bonn.de!news.uni-stuttgart.de!rz.uni-karlsruhe.de!news.rz.uni-karlsruhe.de!not-for-mail From: Markus Gebhard <ukg...@rz.uni-karlsruhe.de> Newsgroups: alt.ascii-art Subject: Re: Gwyneth Paltrow - Jave image->ascii conversion .. and discussion of algorithms Date: Tue, 17 Apr 2001 23:21:40 +0200 Organization: University of Karlsruhe, Germany Lines: 120 Message-ID: <3AD...@rz.uni-karlsruhe.de> References: <9bi18c$s21$1...@news.inet.tele.dk> NNTP-Posting-Host: wn4-jarjar.wn4.uni-karlsruhe.de Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: news.rz.uni-karlsruhe.de 987542546 18072 172.20.12.141 X-Complaints-To: use...@rz.uni-karlsruhe.de X-Mailer: Mozilla 4.77 [en] (Win98; U) X-Accept-Language: en Xref: supernews.google.com alt.ascii-art:5350
About this message.
This message was posted publicly to the newsgroup
alt.ascii-art
in 2001 and is mirrored here unchanged as part of the Historic Archives – only email addresses are masked.
The artwork and text belong to their original authors: if you copy a piece, keep the artist's initials or signature intact and credit them where you can.
Are you the author? Contact us to get your posts attributed, connected to your artist profile, or removed.