dognose wrote:I was looking at some of the new image manipulation features in Mathmatica.
Here is there example of Text Removal from an image:
http://www.wolfram.com/products/mathema ... Image.htmlI'm wondering if anyone has any good ideas on how to reproduce these effects (or improve upon them) in IM
I was thinking of making a mask with the one color, then bluring the rest of the image and using that as the fill.
Here is how you do it, but you need my morphology script (
http://www.fmwconcepts.com/imagemagick/index.html)
original duck:

two iterations of morphologic grayscale close:
morphology -m grayscale -t close -i 2 duck.png duck_close2.png

then subtract the latter from the former:
convert duck.png duck_close2.png -compose difference -composite duck_diff.png

(this is the bottom hat image)
then threshold the result
convert duck_diff.png -threshold 25% duck_diff_t25.png

Then do a binary morpologic dilate
morphology -m binary -t dilate duck_diff_t25.png duck_diff_t25_dilate.png

(you can cover over the top part of the image manually to get rid of the non-text white areas easy enough also, if you want by compositing a smaller black image from the top and which is just short of the text area. But I did not go that far here)
then composite the duck with the morphologic close using the last result as a mask
convert duck.png duck_close2.png duck_diff_t25_dilate.png -composite duck_comp_over.png

Voila, this keeps the original image where there was no text and the morphologic closed image where there was text (plus a little elsewhere, unfortunately)