归一化

opencv 中提供的归一化函数

C++: void normalize(const InputArray src, OutputArray dst, double alpha=1, double beta=0, int normType=NORM_L2, int rtype=-1, InputArray mask=noArray())
C++: void normalize(const SparseMat& src, SparseMat& dst, double alpha, int normType)

Parameters:
src – Source array.
dst – Destination array of the same size as src .
alpha – Norm value to normalize to or the lower range boundary in case of the range normalization.
beta – Upper range boundary in case ofthe range normalization. It is not used for the norm normalization.
normType – Normalization type. See the details below.
rtype – When the parameter is negative, the destination array has the same type as src. Otherwise, it has the same number of channels as src and the depth =CV_MAT_DEPTH(rtype) .
mask – Optional operation mask.
The functions normalize scale and shift the source array elements so that

这里写图片描述

(where p=Inf, 1 or 2) when normType=NORM_INF, NORM_L1, or NORM_L2, respectively; or so that

这里写图片描述

when normType=NORM_MINMAX (for dense arrays only). The optional mask specifies a sub-array to be normalized. This means that the norm or min-n-max are computed over the sub-array, and then this sub-array is modified to be normalized. If you want to only use the mask to compute the norm or min-max but modify the whole array, you can use norm() and Mat::convertTo().

In case of sparse matrices, only the non-zero values are analyzed and transformed. Because of this, the range transformation for sparse matrices is not allowed since it can shift the zero level.

例:

normalize(r_hist, r_hist, 0, histImage.rows, NORM_MINMAX, -1, Mat() );

该函数接受下列参数:

r_hist: 输入数组
r_hist: 归一化后的输出数组(支持原地计算)
0 及 histImage.rows: 这里,它们是归一化 r_hist 之后的取值极限
NORM_MINMAX: 归一化方法 (例中指定的方法将数值缩放到以上指定范围)
-1: 指示归一化后的输出数组与输入数组同类型
Mat(): 可选的掩码

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值