def getImgs(self, colorMap, littleImgs): spectrumImgs = [] closestImgCheatSheet = {} for i in range(0, len(self.colors)): closestImg = remoji.getClosestImg(self.colors[i], littleImgs, colorMap, self.lilImgDir, oneColor = True) print 'closestImg:', closestImg spectrumImgs.append(closestImg) return spectrumImgs
def getImgs(self, colorMap, littleImgs): spectrumImgs = [] closestImgCheatSheet = {} for i in range(0, len(self.colors)): #tmpImg = Image.new('RGB', (1,1), self.colors[i]) #tmpInfo = remoji.ImageInfo('tmpTile', tmpImg) closestImg = remoji.getClosestImg(self.colors[i], littleImgs, colorMap, self.lilImgDir, oneColor = True) spectrumImgs.append(closestImg) return spectrumImgs
def getImgs(self, colorMap, littleImgs): spectrumImgs = [] closestImgCheatSheet = {} for i in range(0, len(self.colors)): #tmpImg = Image.new('RGB', (1,1), self.colors[i]) #tmpInfo = remoji.ImageInfo('tmpTile', tmpImg) closestImg = remoji.getClosestImg(self.colors[i], littleImgs, colorMap, self.lilImgDir, oneColor=True) spectrumImgs.append(closestImg) return spectrumImgs
def buildColorMap(lilImgDir, mapFile): st = time.time() colorMap = {} lilImgs = remoji.getLittleImgs(lilImgDir) os.system('rm '+ mapFile) f = open(mapFile, 'w+') i = 0 for r in range(0, 64): for g in range(0, 64): for b in range(0, 64): closestImg = remoji.getClosestImg((r*4, g*4, b*4), lilImgs, colorMap, lilImgDir, oneColor = True) i += 1 print i / float(262144) nt = time.time() print str(nt - st), 'seconds' pickle.dump(colorMap, f)
def buildColorMap(lilImgDir, mapFile): st = time.time() colorMap = {} lilImgs = remoji.getLittleImgs(lilImgDir) os.system('rm '+ mapFile) f = open(mapFile, 'w+') i = 0 # pool = Pool(processes = 4) for r in range(0, 64): for g in range(0, 64): for b in range(0, 64): closestImg = remoji.getClosestImg((r*4, g*4, b*4), lilImgs, colorMap, lilImgDir, oneColor = True) #closestImg = pool.apply_async(remoji.getClosestImg, [(r, g, b), lilImgs, colorMap, lilImgDir, True]).get() #f.write(str((r, g, b)) + ':' + closestImg + '\n') i += 1 print i / float(262144) nt = time.time() print str(nt - st), 'seconds' pickle.dump(colorMap, f)
def buildColorMap(lilImgDir, mapFile): st = time.time() colorMap = {} lilImgs = remoji.getLittleImgs(lilImgDir) os.system('rm ' + mapFile) f = open(mapFile, 'w+') i = 0 # pool = Pool(processes = 4) for r in range(0, 64): for g in range(0, 64): for b in range(0, 64): closestImg = remoji.getClosestImg((r * 4, g * 4, b * 4), lilImgs, colorMap, lilImgDir, oneColor=True) #closestImg = pool.apply_async(remoji.getClosestImg, [(r, g, b), lilImgs, colorMap, lilImgDir, True]).get() #f.write(str((r, g, b)) + ':' + closestImg + '\n') i += 1 print i / float(262144) nt = time.time() print str(nt - st), 'seconds' pickle.dump(colorMap, f)