本文整理汇总了Python中color.Color.countColors方法的典型用法代码示例。如果您正苦于以下问题:Python Color.countColors方法的具体用法?Python Color.countColors怎么用?Python Color.countColors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类color.Color
的用法示例。
在下文中一共展示了Color.countColors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: calcColor
# 需要导入模块: from color import Color [as 别名]
# 或者: from color.Color import countColors [as 别名]
def calcColor(self,red,green,blue):
hsl = Hsl()
color = Color()
pix = "OTHER"
HSL = hsl.rgb2hsl(red, green, blue)
HSL[1] = round(HSL[1],2)
HSL[2] = round(HSL[2],2)
grayLevel = self.calcGrayLevel(red,green,blue)
colorLevel = self.calcColorLevel(red,green,blue)
grayLumLevel = self.calcGrayLumLevel(red, green, blue)
for i in range(0,len(Hsl.__hueThresh__)):
try:
if(HSL[0]>=Hsl.__hueThresh__[i][0] and HSL[0]<=Hsl.__hueThresh__[i][1]):
if(HSL[1]>=Hsl.__satThresh__[i][0] and HSL[1]<Hsl.__satThresh__[i][1]):
if(HSL[2]>=Hsl.__lumThresh__[i][0] and HSL[2]<Hsl.__lumThresh__[i][1]):
pix = Hsl.__hslColors__[i]
if(grayLevel==0):
pix = Hsl.__hslColors__[i] + str(int(colorLevel))
else:
if(pix=="Black" or pix=="White"):
pix += str(colorLevel)
elif(pix=="Grey"):
pix += str(colorLevel)
else:
pix = "Gray" + str(grayLumLevel) + Hsl.__hslColors__[i] + str(colorLevel)
if(color.countColors(Hsl.__hslColors__[i])>=2):
pix = color.reassignLevels(pix,red,green,blue)
return str(int(grayLevel)) + pix
except IndexError:
print "rgb::calcColor2() out of range!\n"
print "__hueThresh__.Size: {}".format(len(Hsl.__hueThresh__))