本文整理汇总了Python中SimpleCV.ImageClass.Image.applyLayers方法的典型用法代码示例。如果您正苦于以下问题:Python Image.applyLayers方法的具体用法?Python Image.applyLayers怎么用?Python Image.applyLayers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleCV.ImageClass.Image
的用法示例。
在下文中一共展示了Image.applyLayers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: circleDistance
# 需要导入模块: from SimpleCV.ImageClass import Image [as 别名]
# 或者: from SimpleCV.ImageClass.Image import applyLayers [as 别名]
def circleDistance(self):
"""
**SUMMARY**
Compare the hull mask to an ideal circle and count the number of pixels
that deviate as a fraction of total area of the ideal circle.
**RETURNS**
The difference, as a percentage, between the hull of our blob and an idealized
circle of our blob.
"""
w = self.mHullMask.width
h = self.mHullMask.height
idealcircle = Image((w, h))
radius = min(w, h) / 2
idealcircle.dl().circle((w / 2, h / 2), radius, filled=True, color=Color.WHITE)
idealcircle = idealcircle.applyLayers()
print self.mHullMask
print idealcircle
print self.mHullMask.width
print self.mHullMask.height
print idealcircle.width
print idealcircle.height
netdiff = (idealcircle - self.mHullMask) + (self.mHullMask - idealcircle)
numblack, numwhite = netdiff.histogram(2)
return float(numwhite) / (radius * radius * np.pi)
示例2: circleDistance
# 需要导入模块: from SimpleCV.ImageClass import Image [as 别名]
# 或者: from SimpleCV.ImageClass.Image import applyLayers [as 别名]
def circleDistance(self):
"""
Compare the hull mask to an ideal circle and count the number of pixels
that deviate as a fraction of total area of the ideal circle
"""
idealcircle = Image((self.width(), self.height()))
radius = min(self.width(), self.height()) / 2
idealcircle.dl().circle((self.width()/2, self.height()/2), radius, filled= True, color=Color.WHITE)
idealcircle = idealcircle.applyLayers()
netdiff = (idealcircle - self.mHullMask) + (self.mHullMask - idealcircle)
numblack, numwhite = netdiff.histogram(2)
return float(numwhite) / (radius * radius * np.pi)