[Image-SIG] passing parameters to functions used by Image.point?

Joerg Baumann Joerg.Baumann@stud.informatik.uni-erlangen.de
Tue, 8 Aug 2000 23:12:50 +0200 (MET DST)


On 8 Aug 2000, Michael A. Miller wrote:

> class Thresholder:
>     ...
>     def apply_thresholds(self):
>         self.out = self.image.point(lambda i: min(i,self.low))
> 
try this:
      def apply_thresholds(self):
          self.out = self.image.point(eval("lambda i: min(i,"+`self.low`+")"))

it will compile a suitable 1 argument function on the fly with a low-value
hardwired during compilation.

have fun,
  joerg

  Joerg Baumann       joerg.baumann@stud.informatik.uni-erlangen.de
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+  
  Beware of bugs in the above code; I have only proved it correct, 
  not tried it.
                  Don Knuth