| |
Oswald
Registered: Apr 2002 Posts: 5094 |
Converting animation into lossy charset - how ?
I've always wondered how an algorithm decides how far is a char from another. any pointers ? |
|
| |
MagerValp
Registered: Dec 2001 Posts: 1078 |
This should be a good starting point: http://stackoverflow.com/questions/613146/computing-the-differe.. |
| |
Krill
Registered: Apr 2002 Posts: 2980 |
You also might want to take a look at how JPEG compression works, which divides the image into 8x8 blocks prior to quantisation: http://www.fileformat.info/mirror/egff/ch09_06.htm.
The resulting image data is then represented in the frequency domain, and those coefficients you can compare and cluster rather easily and prioritise luminance differences over chrominance differences, as the eye is more perceptive to the former. Well, etc.pp. :) |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
looks like quite a complex topic, FFT is a good idea, but I'd like to think there's a primitive c64 demo way :) fex what if each pixel checks how itself and its 8 neighbours differ from the pixels at the same position in the compared char. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
why dont you simply try it? with a simple compare function like you say its pretty easy to knock up afterall :) |
| |
Krill
Registered: Apr 2002 Posts: 2980 |
Quoting Oswaldlooks like quite a complex topic, FFT is a good idea, but I'd like to think there's a primitive c64 demo way :) fex what if each pixel checks how itself and its 8 neighbours differ from the pixels at the same position in the compared char. We're talking about pre-processing here, and this has been on a far more complex level than the C-64 can manage for years now, for modern demos. |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
I'm actually trying :)
Gunnar, yes I know, I'm just lazy to mess with FFT totally new territory for me, altho i know what its basically, but its a totally different thing when you have to code it (or make some alien code to work) |
| |
Mixer
Registered: Apr 2008 Posts: 452 |
Very simple and very lossy system that makes very ugly pictures.
Make a random charset. Randomize it so that first char has 0 pixels set and last char has all pixels set. Second char has 1 random pixel set etc.
Count the set pixels in the char-area of the source image and replace the char with random char that has equal number of pixels set. This is like calculating the average luminocity over the char-area and matching it with charset.
One can go to many directions with this, for instance, the random charset generated don't need to be "linearly random". Also, once the image is matched to the noise charset, one can locate where each noise char is used and compare original image regions on those locations as more accurate 4x4 pixel luminosities, and alter the 8x8 noise charset quarters if a part of them is similar enough and iterate. |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
macthing against char rom now, prototype fills the destination currently with 'N' :) more to debug.. |
| |
4mat
Registered: May 2010 Posts: 66 |
I think my petscii converter does a simple tally per 8x8 grid against the char rom, then picks the highest scoring char. Good thing is if you use a custom char set it'll always pick something regardless of the size. (in Party Bit the credit pictures were done with a 6 char font) Doing colour pics was a bit more involved, I went with a threshold level around the rgb values in the pic and compared against the palette's rgb. (Probably should have used luminance as well but I didn't) |
| |
Krill
Registered: Apr 2002 Posts: 2980 |
Quoting 4matI think my petscii converter does a simple tally per 8x8 grid against the char rom, then picks the highest scoring char. Good thing is if you use a custom char set it'll always pick something regardless of the size. Matching against an existing set of chars makes the problem a lot easier, i think. Generating an "optimal" set of arbitrary chars, on the other hand... :) |
... 38 posts hidden. Click here to view all posts.... |
Previous - 1 | 2 | 3 | 4 | 5 - Next |