[Image-SIG] Removing specific range of colors from scanned image

Fredrik Lundh fredrik at pythonware.com
Tue Apr 28 21:18:23 CEST 2009


On Tue, Apr 28, 2009 at 8:58 PM, Scott David Daniels
<Scott.Daniels at acm.org> wrote:

> Warning: this distance function is the product of the three elements,
> so an exact match on red, green, or blue will look like a match on all.
>
> Try something like this:
>     distance2 = 3 * distance ** 2
>     mask = ImageMath.eval("convert((((r-R)**2 + (g-G)**2 + (b-B)**2) "
>                                      " < distance2) * 255, 'L')",
>                           **locals())

Yeah, brain was not fully engaged when I wrote that.  Sorry for that,
and thanks for fixing it.

</F>


More information about the Image-SIG mailing list