Hi Paul

2008/10/7 paul taney <[EMAIL PROTECTED]>:
> I have this silly color filter that Stefan gave me:
>
> def vanderwalt(image, f):
>    """colorfilter, thanks to Stefan van der Walt"""
>    RED, GRN, BLU = 0, 1, 2
>    bluemask = (image[...,BLU] > f*image[...,GRN]) & \
>               (image[...,BLU] > f*image[...,RED])
>
>    return bluemask

Here's a heuristic method that may work.  The above statement is equivalent to

image[...,BLU] > f*max(image[...,GRN], image[...,RED])

So I would construct a new array with the maximum of the red and green
values.  Then, divide that new image by the blue image -- this gives
you all the different "f" values above.  Calculate the histogram of
the "f"s, and pick an f with the right percentile.

Regards
Stéfan
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to