Terry,
return math.sqrt(sum([h*i*i for i,h in enumerate(histogram)]) / self.Area())
Ran at the same speed as my 'fast' version and without the square brackets was
slower.
Thanks,
Keir
--
http://mail.python.org/mailman/listinfo/python-list
Thanks for the fast responses.
Tim, you're right I did have my lambda parameters the wrong way round.
Fixing up the order had no effect on the speed (platform is x64 win7).
Ian, I was basing my code off Fredrik Lundh post on comparing images.
http://effbot.org/zone/pil-comparing-images.htm
Terry
Hi All,
The following function was showing up in my profiles as a large bottle neck:
# Slow version
def RMSBand(self, histogram):
"""Calculates the root-mean-squared value for the given colour stream
histogram."""
intermediateResult = map(lambda (i, h): h*(i**2), zip(histogram,