pyfusion.utils package¶
Module contents¶
-
pyfusion.utils.
Entropy
(src)[源代码]¶ 计算影像的信息熵
The Entropy will calculate the information entropy of image
- 参数
src – source image, it should be read by cv2.imread() and grayscale image
- 返回
信息熵
- 返回类型
float
-
class
pyfusion.utils.
Image
(image=None)[源代码]¶ 基类:
object
Image`是一个自定义的类。有两个需要注意的属性——`image`和`data
image`是一个`osgeo.gdal.Dataset`类型的属性,是用`gdal.Open,gdal.OpenEx 或者 `gdal.OpenShared`读出来的数据集,这个属性存储了影像的metadata
`data`是一个`numpy.array`类型的属性,如果你不修改的话,只会从硬盘中将影像读出来。当然也可以赋值
如果直接用`osgeo.gdal.Dataset.ReadAsArray`读出来的像素的shape是(bands, width, height)这样的。类中将shape转成了(width, height, bands),因为opencv使用的这样的shape
- Attributes:
image: the image metadata.
data: the value of the pixel.
-
property
data
¶
-
property
image
¶
-
pyfusion.utils.
RMSE
(src, pan)[源代码]¶ 计算影像的RMSE
- 参数
src – source image, it should be read by cv2.imread() and grayscale image
- 返回
RMSE
- 返回类型
float
-
pyfusion.utils.
R_value
(src, pan)[源代码]¶ 计算影像的相关性系数
- 参数
src – source image, it should be read by cv2.imread() and grayscale image
- 返回
R value
- 返回类型
float
-
pyfusion.utils.
ReadImageFile
(filepath: str)[源代码]¶ Read image
用`gdal.OpenShared`读的只读影像
- 参数
filepath – The file path
- 返回
Image
- 返回类型
pyfusion.utils.Image
-
pyfusion.utils.
avg_grad
(src)[源代码]¶ 计算影像的平均梯度
- 参数
src – source image, it should be read by cv2.imread() and grayscale image
- 返回
average gradient
- 返回类型
float
-
pyfusion.utils.
histMatch
(src, ref)[源代码]¶ 直方图匹配
histMatch函数将会返回以`ref`影像为基准的匹配影像,`src`和`ref`都应该为灰度影像
- 参数
src – 源影像,应该为`numpy.ndarry`的数据结构,应该使用`opencv`包来读入
ref – 参考影像,应该为`numpy.ndarry`的数据结构,应该使用`opencv`包来读入
- 返回
结果影像
- 返回类型
numpy.ndarray
-
pyfusion.utils.
histMatch2
(src, ref)[源代码]¶ 直方图匹配
histMatch2函数功能与histMatch函数类似,但这个处理的不是8位的影像,PCA融合时需要使用
- 参数
src – 源影像,应该为`numpy.ndarry`的数据结构,应该使用`opencv`包来读入
ref – 参考影像,结构为`numpy.ndarry`,dtype为`numpy.float32`
- 返回
结果影像
- 返回类型
numpy.ndarray