Discussing image filters for Livecode (was: "Blurred vision" ...)
Wilhelm Sanke
sanke at hrz.uni-kassel.de
Sat May 14 17:28:46 EDT 2011
On Wed May 11, 2011, Hanson hanson at runrev.com wrote (in post "Re:
"Blurred vision" of Rev newsletter, Apr 21"):
:
> ...thank you very much for your great contributions to image processing
> with LiveCode and for sharing your work with us. Your e-mail, reviewing
> some of the history of image processing with LiveCode is fascinating and
> your stacks are extremely interesting...
>
> Mit Freundlichen Gruessen,
>
> Hanson Schmidt-Cornelius
> LiveCode Team
Hello Hanson,
Thank you very much for your well-meant - if somewhat exuberant - words.
We need to remind us that many developments by Livecode users often
rely on the cooperation with others and on the sometimes lively
discussions in the Rev lists. This does of course not exclude the
possibility that now and then somebody invents a really new wheel.
For my part, quite a number of projects or stacks were collaborative
ones, and in many other cases I profited by ideas and practical
proposals from list members and elsewhere, to which latter point also
belong attempts to port Lua scripts to Livecode and to reverse-engineer
a couple of Gimp filters. "More about Masks" ("MoreAboutMasksRev3.zip")
is another such example, a stack produced in close cooperation with
Bernd Niggemann and including the discussion of ideas and proposals by
Jim Hurley and Scott Rossi.
The fact that you, as a member of the Livecode team, placed an article
about image processing in a Rev newsletter is surely an indication of a
renewed interest in this area on the side of Livecode. Livecode - as an
authoring tool - is so multi-faceted in its possibilities and - as image
processing comprises only a small part of its potential - image
processing with Livecode is therefore of limited interest to the
majority of its users, especially as there are so many useful image
programs around from other parties.
I personally hope that this new interest of the Livecode team will
result in improved conditions for image processing in the medium future.
Especially I hope that a number of bugs impeding image processing that
have been around for quite a time will eventually be fixed and the way
imagedata are handled in Livecode will be improved and speeded up, maybe
following the example of the Lua language with its simpler and elegant
structure for image handling. Lua, like Livecode, is based on "C", so it
must not be too difficult to incorporate Lua-like procedures into
Livecode as an added alternative.
I have updated the "Blurred Vision" stack to
<http://www.sanke.org/Software/BlurredVision2.zip>
and added 8 more blur-like filters, so the total sum is 16 now, and some
other non-blur filters like two "Seurat" filters under the "noise"
button (The French painter Seurat was the inventor of "pointillistic
painting", using pixels of the main colors to create paintings that are
best viewed from some distance). The new blur filters are:
- "Gaussian blur", a standard matrix filter
- "Jitter Lua" and "Jitterblur Lua", which exchange pixels ramdomly from
a chosen range and produce very nice effects
- "Pick", reverse-engineered from Gimp, which "picks" randomly one pixel
out of 9 (3x3 matrix) or out of 25 (5x5 matrix) and sets this pixel as
the center one
- "Wet paint", which creates the impression of paint trickling down on a
canvas
- "Random shapes" in three versions. "Ovals", "Rects", and "cubism
(polygons)", which are placed randomly and with a chosen maximum size on
an image, where the color of these graphics is being determined by the
center pixel underneath the respective graphics. By using the "cubism"
filter you can achieve effects that come very close to those of the Lua
"Voronoi" filter--
A few recommendations to achieve special effects:
- Apply "despeckle extreme" (from the median filters) twice to an image
and then use "colorful lithography" under "lithography". You will surely
be impressed by the results.
- Apply "Seurat color" with a density of 100 or higher, then "simple
despeckle" and "lithography", after that set the image to "grayscale"
under "colors". The result is sort of an "halftone" image, similar to
one of the most complex Lua filters of the same name.
- Select "ovals" from "Random shapes", choose a distortion width of "3"
and "7000" or "10000" repetitions. Apply "basic despeckle", then
"lithography" and possibly after that "simple despeckle". You will get a
nice painting-like image. You might also apply "increase saturation"
(under "colors") here twice for a better looking picture.
One last remark concerning a statement in Hanson's newsletter article.
You had written that the blur filter
> "introduces an algorithm that can be used to smooth images in order to
> remove fine detail texture or noise. This is often useful when
> applying image processing algorithms that look at larger detail
> objects in an image."
This is surely partially true, but what you need here is a very special
blur filter, like an extended "Gaussian blur" filter (The "Gaussian
blur" I added to my stack is not sufficient here). The best way to
remove "fine detail texture or noise" is to use a median/despeckle
filter, this is what the name stands for. You can try out that for yourself:
- Use "add noise" from the noise button, then apply the "Rev blur"
filter. You will see that some pixels may be removed, but on the whole
the noise pixels are just blurred like all other pixels.
- Now again "add noise" to a new or reset image, then apply "simple
despeckle". Now the added noise will have been completely removed,
despite the fact that the "simple despeckle" filter works on the basis
of a rect of only 2x2 pixels of which the median value is then set.
The main thing with such an assortment of filters is to experiment, to
try to produce various effects, and possibly, too, to modify the scripts
of the filter buttons to create new ones.
Enjoy, in case you are interested.
Kind regards,
Wilhelm Sanke
More information about the use-livecode
mailing list