On Tue, 06 Jan 2009 13:12:11 +0100
Cedric Pinson <[email protected]> wrote:

| Hi Anthony,
| Thank you for your answer you wrote a lot of interesting information. I 
| found something intersting with gimp.
| There is a filter called erode, it seems to do what i would want, so i 
| will check what is it exactly to be sure it's what i want.
| Anyway with your information i will be able to do something near.
| 
There are some operators that is ver simular to what I am doing with blur
which are known a morphological operators.

A shell script implementing these operators is in Fred Wienhaus's
ImageMagick script area.
  http://www.fmwconcepts.com/imagemagick/morphology/index.php

Erode and Dialate are the lowest level morphological operators.

It is something I actually want to get implemented in the Core Library

These are all 'convolution' techniques where the new pixels final
value depends on the values of the pixels around that point.

Blur performas a weighted average of the neighborhood

Erode selects the minimum value from the surrounding neigbourhood
Dialiate the maximum value.

Note however that teh original definition of Erode and Dialate was in
terms of binary masks, and not gray scale values.

Now Dialte will probably do what you want, though I do not see how Erode
would do this.  However it only selects the maximum value from each of
the seperate RGB channels.  As the channels are handled separateally
(unless the pixel color selection is basied in intensity rather than
value) you will likely get color distortion in the resulting image.


A discussion of using Morphological operators to delete unwanted text
and logos was in the IM Forums recently.  In many ways this is very
simular to the problem I was exploring, but for 'hole closure' of
removed or masked out text, rather than defining the background
surrounding the image.

See
http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=12517

NOTE that in all the above 'neighbourhood' was NOT defined.  typically
it defaults to just a 3x3 box,  but it can be larger or smaller (4
orthogonal neighbors).  As with blur the size and shape of the
neighbourhood can have a great effect on the final result.

I myself think for large areas with multiple colors involved a averaging
type morphological operator will be better.  EG Blur with a small radius
and thus neighbourhood.

WARNING:  blur uses 2 pass weighted average to generate results for
speed.  It may be better to use a -gaussian  blur instead or even a
-convolve with your own neighbourhood 'convolution kernal' defination.



At this time I am thinking on just how I'd like to implement the
morphological operators (and the compound operators).  I want to keep
them simple, but also to allow users to be able to define more complex
neighbourhoods, using rectangular kernals, defined in various ways
such as grayscale images (with a bias), floating point arrays, and so
on.

When I have fianlly settled on how I want to implement then I can
proceed.  Note that both  -gaussian (weighted average) and -convolve
could end up being replaced by the resulting morphological library
function.

  Anthony Thyssen ( System Programmer )    <[email protected]>
 -----------------------------------------------------------------------------
  Wiz : Our explanations are real. A virtual explanation would be
        something that acted like an explanation, but wasn't.
  Moira : I rest my case.                 -- Rick Cook, "Wizardry Cursed"
 -----------------------------------------------------------------------------
     Anthony's Home is his Castle     http://www.cit.gu.edu.au/~anthony/
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to