统计效果与Spread效果相似,唯一的区别在于,它会通过对相邻像素值执行数学运算的结果来替换每个像素。宽度和高度定义了相邻像素的大小或孔径。
统计操作的类型可以是以下任意一种:
- ‘gradient’
- ‘maximum’
- ‘mean’
- ‘median’
- ‘minimum’
- ‘mode’
- ‘nonpeak’
- ‘root_mean_square’
- ‘standard_deviation’
用法: wand.image.statistic(stat, width, height, channel)
参数:
参数 | 输入类型 | 描述 |
---|---|---|
stat | basestring | 要计算的统计信息的类型。参见STATISTIC_TYPES。 |
width | numbers.Integral | X轴上相邻像素的大小。 |
height | numbers.Integral | Y轴上相邻像素的大小。 |
channel | basestring | 目标的可选颜色通道。 |
输入图片:
范例1:
# Import Image from wand.image module
from wand.image import Image
# Read image using Image function
with Image(filename ="koala.jpeg") as img:
img.statistic("median", width = 8, height = 5)
img.save(filename ="kl-statistic.jpeg")
输出:
输入图片:
范例2:
# Import Image from wand.image module
from wand.image import Image
# Read image using Image function
with Image(filename ="road.jpeg") as img:
img.statistic("median", width = 8, height = 5)
img.save(filename ="rd-statistic.jpg")
输出:
相关用法
- Python Wand function()用法及代码示例
- Python Wand gaussian_blur()用法及代码示例
- Python Wand transform()用法及代码示例
- Python Wand crop()用法及代码示例
- Python Wand rotational_blur()用法及代码示例
- Python Wand Image()用法及代码示例
- Python Wand shade()用法及代码示例
- Python Wand sharpen()用法及代码示例
- Python Wand adaptive_sharpen()用法及代码示例
- Python Wand noise()用法及代码示例
- Python Wand blue_shift()用法及代码示例
- Python Wand color_matrix()用法及代码示例
注:本文由纯净天空筛选整理自RahulSabharwal大神的英文原创作品 Wand statistic() function in Python。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。