Neighborhood Maximum/Minimum in IM?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
User avatar
foxyshadis
Posts: 15
Joined: 2010-04-29T19:29:46-07:00
Authentication code: 8675308
Location: Fresno, California

Neighborhood Maximum/Minimum in IM?

Post by foxyshadis »

I looked through the documentation and the filter list and didn't see this, so I'm wondering if it's something that's in IM or that someone has implemented it in script. Many image-editing programs have a local min/max filter that uses 3x3, 5x5 etc, and it's handy in some instances. (For instance, on scans, a good way to squash dither patterns into solid colors without seriously impacting lettering is to average the local min & max together.)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Neighborhood Maximum/Minimum in IM?

Post by fmw42 »

use -morphology dilate or erode (in non-binary mode) to do local min and max operations with various shapes and sizes: see http://www.imagemagick.org/Usage/morphology/

or see my statsfilt script at the link below. it does 3x3 min or max (as well as other filters).
User avatar
foxyshadis
Posts: 15
Joined: 2010-04-29T19:29:46-07:00
Authentication code: 8675308
Location: Fresno, California

Re: Neighborhood Maximum/Minimum in IM?

Post by foxyshadis »

Thanks, the Hit/Miss & Pattern Matching methods on the page help solve another problem I was about to start experimenting with. Awesome!
Post Reply