Hi,
Here the script i use it seems to work fine for all my cases right now,
i will try on futur data and tell if it works
for most cases
#!/bin/bash
set -e
set -x
file=$1
filewithoutext=$(echo $1 | sed 's/.png//g')
name=$(basename $1 | sed 's/.png//g')
./morphology -m grayscale -t erode -i 1 $file /tmp/${name}_0.png
convert $file -alpha extract /tmp/${name}_alpha.png
composite -gravity center $1 /tmp/${name}_0.png /tmp/${name}_2.png
convert /tmp/${name}_2.png /tmp/${name}_alpha.png -alpha off -compose
Copy_Opacity -composite ${filewithoutext}_final.png
The script can be improve for sure
Cheers,
Cedric
Anthony Thyssen wrote:
> On Tue, 6 Jan 2009 16:55:40 -0800
> Fred Weinhaus <[email protected]> wrote:
>
> | >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.
> | >
> | ...
> | >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.
> |
> | Good point. One may want to have both options. Of course one could
> | convert to HSL or some other space, process the "intensity" channel,
> | then convert back to RGB.
> |
> I did an example of applying a operation to an intensity image and
> mapping that back into changing the original RGB image using the alpha
> composition operator 'lighten'.
>
> Lighten also has the same color distortion problem but comparing the
> same pixel in two or more images, rather than a neighbourhood of pixels.
>
> However you can't Dilate a intensity pattern then map that back to a
> change map for an RGB image as you are dealing with more than two
> choices. You do not know WHICH pixel had the lightest color!
>
> For the same reason you can't just convert to HSL and then dilate
> either!
>
> I had already decided that when I implement morphology I would have both
> grey-scale channel, and RGB intensity selection methods available,
> probably using the exact same method used for 'threshold'.
>
> For threshold, if the channel setting is the default, then threshold
> thresholds the intensity (linked channels) if the channel setting was
> modified then the channels will be dealt with separally.
>
> I suppose we could have a special 'channel' flag that could represent
> these 'linked' and 'unlinked' behaviours, and start to make more use of
> it.
>
> One thing that could be done is add a i_lighten and i-darken option to
> the composition operator to compare color intensities rather that
> channel values.
>
> I am Cc'ing this to Cristy for his input.
>
>
> Anthony Thyssen ( System Programmer ) <[email protected]>
> -----------------------------------------------------------------------------
> Always secure your files, you never know who is lurking about.
> -- Rick Cook, "The Wizardry Compiled"
> -----------------------------------------------------------------------------
> Anthony's Home is his Castle http://www.cit.gu.edu.au/~anthony/
>
--
+33 (0) 6 63 20 03 56 Cedric Pinson mailto:[email protected]
http://www.plopbyte.net
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users