OpenCV中矩阵归一化函数normalize()的原理讲解及公式 C++/Python代码实例

Table of Contents

函数原型

参数说明

不同norm_type下的计算公式

NORM_L1

NORM_L2

NORM_INF

NORM_MINMAX

参考文章

代码实例

代码输出

Python代码使用normalize

图像输出

笔者备注


函数原型

void cv::normalize    (    InputArray     src,
InputOutputArray     dst,
double     alpha = 1,
double     beta = 0,
int     norm_type = NORM_L2,
int     dtype = -1,
InputArray     mask = noArray() 
)

笔者说明:这个函数的作用就是把需要处理的数据通过某种算法限制在你需要的一定范围内。

参数说明

参数 英文说明 笔者翻译及说明
src input array. 输入矩阵
dst output array of the same size as src . 输出矩阵,与输入矩阵尺寸相同
alpha

norm value to normalize to or the lower 

range boundary in case of the range normalization.

如果norm_type为NORM_MINMAX ,则alpha为最小值或最大值;如果norm_type为其他类型,则为归一化要乘的系数【重点】
beta

upper range boundary in case of the range

 normalization; it is not used for the norm normalization.

如果norm_type为NORM_MINMAX ,则beta为最小值或最大值;如果norm_type为其他类型,beta被忽略,此处不会被用到,一般传入0【重点】
norm_type normalization type (see cv::NormTypes). 归一化类型,常见的有NORM_L1, NORM_L2, NORM_INF, NORM_MINMAX
dtype

when negative, the output array has the same type as src;

 otherwise, it has the same number of channels as src

 and the depth =CV_MAT_DEPTH(dtype).

如果取负值时,dst与src同样的类型;否则,dst和src有同样的通道数,且此时图像深度为CV_MAT_DEPTH(dtype)
mask optional operation mask. 可选操作掩膜

不同norm_type下的计算公式

以数列{

评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值