def average(self, aligned = True):
''' averaging procedure, this function saves the newly calculated average'''
if aligned:
dataset = self.algimgs
else:
dataset = self.imgs
s = MyRGBImg(np.zeros(dataset[0].data.shape))
s = color.rgb2lab(s.data)
for i, picture in enumerate(dataset):
print("Averaging image: " , i)
# convert both to lab
im = color.rgb2lab(picture.data)
#perform operations
s += im
s = s / float(len(dataset))
self.avg = MyRGBImg(color.lab2rgb(s))
评论列表
文章目录