def generateLuminance(self, image): #image = self.images[0] for x in xrange(self.cpr): for y in xrange(self.cpc): hist = image.cellAt(x, y).histogram() self.histograms[x][y] += hist for x in xrange(self.cpr): for y in xrange(self.cpc): largest = max(self.histograms[x][y]) lum = numpy.where(self.histograms[x][y] == largest)[0][0] self.histograms[x][y] = lum pImage.setIwMatrix(self.histograms)
def generateLuminance2(self): count = 1 total = len(self.images) for image in self.images: print count count += 1 for x in xrange(self.cpr): for y in xrange(self.cpc): hist = image.cellAt(x, y).histogram() self.histograms[x][y] += hist image.free() for x in xrange(self.cpr): for y in xrange(self.cpc): largest = max(self.histograms[x][y]) lum = numpy.where(self.histograms[x][y] == largest)[0][0] self.histograms[x][y] = lum pImage.setIwMatrix(self.histograms)