[plt-scheme] image manipulation
Matthew Flatt wrote:
> Have you tried the relatively new `get-argb-pixels' and
> `set-argb-pixels' methods? These copy pixel information to and from a
> byte string.
>
> These methods are still not at fast as they can be, and I doubt that
> they're fast enough for your purposes. But I wonder whether they're on
> the right path. Are these the right kinds of operations to add and
> optimize?
Thank you Matt, I feel a bit foolish not having seen this procedure. I played
a little bit with, of course this is not like having fast, direct-access arrays
of pixels, with full plethora of software support, but I *am* satisfied.
In view of Scheme limitations what can we expect? Having A.R.G.B. strings gives
random access 'unboxed' vectors of bytes. That is the basis. The details can
be improved. Some garbage is produced unavoidably when manipulating pixels,
since the chars have to be converted to numbers, and back to chars.
There are memory problems as well, since, typically, image processing is
a number-crunching business. It is absolutely undesirable to keep just 8 bits
of precision *during* the manipulations, filtering, interpolation, Fourier,
and other related treatments. So, we have to convert everything to numbers,
*real* numbers.
And in Scheme this means vectors of vectors of numbers, which is of course
quite heavy, but I doubt anybody can do anything with, without introducing
UNBOXED arrays of numbers.
There is no place for different colour depths than 3planes*8bits, which begins
to fade out in favour of more powerful schemes, but for the moment this is not
a major issue.
Best regards
Jerzy Karczmarczuk