[Image-SIG] passing parameters to functions used by Image.point?
Michael A. Miller
mmiller3@iupui.edu
08 Aug 2000 13:51:28 -0500
I'm trying to come up with an image thresholding class. I'd like
to use the Image.point method to do the thresholding, but I'm not
sure of how to make this work. Here's what I'm trying to do:
class Thresholder:
...
def apply_thresholds(self):
self.out = self.image.point(lambda i: min(i,self.low))
This doesn't work because self.low is not accessible to the
lambda. The traceback is
self.out = self.image.point(lambda i: min(i,self.low))
NameError: self
Can anyone help me with passing parameters such as self.low to
lambda functions for Image.point? Even better - can anyone point
me to an existing PIL image thresholding implementation?
Regards, Mike
--
Michael A. Miller mmiller3@iupui.edu
Krannert Institute of Cardiology, IU School of Medicine
Indiana Center for Vascular Biology and Medicine