Python Imaging Library: ImageStat Module(图像统计模块)
来源:互联网 发布:淘宝热卖的东西 编辑:程序博客网 时间:2024/05/22 11:55
Python Imaging Library: ImageStat Module(图像统计模块)
ImageStat模块计算图像或图像区域的全局统计信息。
函数
Stat
ImageStat.Stat(image) ⇒ Stat instance
ImageStat.Stat(image, mask) ⇒ Stat instance
计算给定图像的统计信息。
如果包含一个掩码,那么仅包含该掩码的区域包含在统计数据中。
ImageStat.Stat(list) ⇒ Stat instance
和上面一样,不同之处在于计算的是之前计算过的直方图的统计信息。
Attributes
下面的属性包含图像中每个层的一个元素的序列。
所有属性都被惰性地评估;如果你不需要该值,它就不会被计算出来。
extrema
stat.extrema
(属性)。计算图像每个通道的最小值和最大值。
count
stat.count
(属性)。计算图像的像素总数。
sum
stat.sum
(属性)。计算图像所有像素的总和。
sum2
stat.sum2
(属性)。计算图像所有像素的平方和。
pixel
stat.mean
(属性)。计算图像的平均像素值。
median
stat.median
(属性)。计算图像的像素中值。
rms
stat.rms
(属性)。计算图像的RMS(均方根)。
var
stat.var
stddev
stat.stddev
(属性)。计算图像的标准差。
例程
# 计算图像统计信息PilImg_Stat1 = Image.open('图像3.jpg')
PilImg_Stat = ImageStat.Stat(PilImg_Stat1)
# 计算图像每个通道的最小值和最大值(stat.extrema)
print("STAT最小值和最大值:", PilImg_Stat.extrema)
# 计算图像的像素总数(stat.count)
print("STAT像素总数:", PilImg_Stat.count)
# 计算图像所有像素的总和(stat.sum)
print("STAT像素总和:", PilImg_Stat.sum)
# 计算图像所有像素的平方和(stat.sum2)
print("STAT像素平方和:", PilImg_Stat.sum2)
# 计算图像的平均像素值(stat.mean)
print("STAT平均像素值:", PilImg_Stat.mean)
# 计算图像的像素中值(stat.median)
print("STAT像素中值:", PilImg_Stat.median)
# 计算图像的RMS(均方根)(stat.rms)
print("STAT均方根:", PilImg_Stat.rms)
# 计算图像的方差(stat.var)
print("STAT方差:", PilImg_Stat.var)
# 计算图像的标准差(stat.stddev)
print("STAT标准差:", PilImg_Stat.stddev)
- Python Imaging Library: ImageStat Module(图像统计模块)
- Python Imaging Library: ImageColor Module(图像颜色模块)
- Python Imaging Library: ImageChops Module(图像通道操作模块)
- Python Imaging Library:ImageDraw Module(图像绘制模块)
- Python Imaging Library: ImageEnhance Module(图像增强模块)
- Python Imaging Library: ImageFilter Module(图像滤波模块)
- Python Imaging Library: ImageGrab Module(图像采集模块)
- Python Imaging Library: ImageMath Module(图像数学运算模块)
- Python Imaging Library: ImageOps Module(图像运算模块)
- Python Imaging Library: ImagePalette Module(图像调色板模块)
- Python Imaging Library: ImagePath Module(图像路径模块)
- Python Imaging Library: ImageQt Module(图像QT模块)
- Python Imaging Library: ImageSequence Module(图像序列模块)
- Python Imaging Library: ImageTk Module(图像Tkinter模块)
- Python Imaging Library: ImageWin Module(图像Windows模块)
- Python Imaging Library: ImageFile Module(图像文件模块)
- Python Imaging Library: PSDraw Module(Postscript打印机模块)
- Python图像处理库PIL的ImageStat模块介绍
- 习题3.4
- 前端案例:纯css代码写出积极向上攀登金字塔
- MySQL中的注释符号的使用
- Tornado官方文档(三)【协同程序(Coroutines)】
- Makefile中=与:=的区别
- Python Imaging Library: ImageStat Module(图像统计模块)
- python 高阶函数和技巧
- nodejs、angular4、Ionic,window开发环境安装
- 课余随笔——图解数据结构
- 学习C++的推荐用书
- Tornado官方文档(四)【Queue示例-一个并发网络爬虫】
- Python徒手实现识别手写数字—图像识别算法(K最近邻)
- RocketMQ源码解析-PullConsumer取消息(2)
- cvCreateStructuringElementEx和cvHoughLines2函数