fix color calculation off by one

This commit is contained in:
j 2011-11-07 12:31:20 +01:00
parent ba186ffd10
commit ecf02a143a

View file

@ -294,7 +294,7 @@ def average_color(prefix, start=0, end=0):
timelines = sorted(filter(lambda t: t!= '%s%sp.png'%(prefix,height), glob("%s%sp*.png"%(prefix, height)))) timelines = sorted(filter(lambda t: t!= '%s%sp.png'%(prefix,height), glob("%s%sp*.png"%(prefix, height))))
for image in timelines: for image in timelines:
start_offset = 0 start_offset = 0
if start and frames + 1500 < start: if start and frames + 1500 <= start:
frames += 1500 frames += 1500
continue continue
timeline = Image.open(image) timeline = Image.open(image)
@ -311,7 +311,6 @@ def average_color(prefix, start=0, end=0):
p = np.asarray(timeline.convert('RGB'), dtype=np.float32) p = np.asarray(timeline.convert('RGB'), dtype=np.float32)
p = np.sum(p, axis=0) / height #average color per frame p = np.sum(p, axis=0) / height #average color per frame
pixels.append(p) pixels.append(p)
if end and frames >= end: if end and frames >= end:
break break