本文整理汇总了Python中SimpleCV.Image.threshold方法的典型用法代码示例。如果您正苦于以下问题:Python Image.threshold方法的具体用法?Python Image.threshold怎么用?Python Image.threshold使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimpleCV.Image
的用法示例。
在下文中一共展示了Image.threshold方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _findGalaxyBulgeBlobs
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import threshold [as 别名]
def _findGalaxyBulgeBlobs(galaxy):
img = galaxy.imageWithoutBackground
graynp = img.getGrayNumpy()
stretched = np.array(graynp, dtype=np.float32)*(255.0/graynp.max())
stretched = Image(stretched)
return stretched.threshold(220).binarize().invert().findBlobs(minsize=4)
示例2: Image
# 需要导入模块: from SimpleCV import Image [as 别名]
# 或者: from SimpleCV.Image import threshold [as 别名]
droplets = Image('data_s7.jpg')
## Once you have an image you can do a ton of stuff!
## URL (official documentation) about available methods:
## http://simplecv.org/docs/SimpleCV.html#i/SimpleCV.ImageClass.Image
## Display the image & the image size
# droplets.show()
# time.sleep(5)
img_size = droplets.size()
# print 'Image size:', img_size
## Convert to black and white (applying a simple threshold value)
droplets = droplets.threshold(75)
# droplets.show()
# time.sleep(5)
## Cropping the image into the four pieces
## The x coords are always the whole size
x = 55
segment_height = img_size[1]/4
y_coords = [i * segment_height for i in range(4)]
# print segment_height, y_coords
avg_sizes = []
for y in y_coords: