OpenCV之图像归一化(normalize)
生活随笔
收集整理的這篇文章主要介紹了
OpenCV之图像归一化(normalize)
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
什么圖像歸一化
通俗地講就是將矩陣的值通過某種方式變到某一個(gè)區(qū)間內(nèi)
圖像歸一化的作用
目前能理解的就是歸一化到某個(gè)區(qū)間便于處理,希望高人可以指點(diǎn)
opencv文檔中的介紹
C++:voidnormalize(InputArraysrc, InputOutputArraydst, doublealpha=1, doublebeta=0, intnorm_type=NORM_L2, intdtype=-1, InputArraymask=noArray())
C++:voidnormalize(const SparseMat&src, SparseMat&dst, doublealpha, intnormType)
Python:cv2.normalize(src[, dst[, alpha[, beta[, norm_type[, dtype[, mask]]]]]])→ dst
Parameters:
src– input array.
dst– output array of the same size assrc.
alpha– norm value tonormalizeto or the lower range boundary in case of the range normalization.
beta– upper range boundary in case of the range normalization; it is not used for the norm normalization.
normType– normalization type (see the details below).
dtype– when negative, the output array has the same type assrc; otherwise, it has the same number of channels assrcand the depth=CV_MAT_DEPTH(dtype).
mask– optional operation mask.
norm_type有NORM_INF,NORM_MINMAX,NORM_L1和NORM_L2四種。
1、在 NORM_MINMAX 模式下,alpha表示歸一化后的最小值,beta表示歸一化后的最大值。
2、在NORM_L1、NORM_L2、NORM_INF 模式下,alpha表示執(zhí)行相應(yīng)歸一化后矩陣的范數(shù)值,beta不使用。
3、稀疏矩陣歸一化僅支持非零像素
NORM_MINMAX
數(shù)組的數(shù)值被平移或縮放到一個(gè)指定的范圍,線性歸一化。
$dst(i, j) = frac{(src(i, j) - min(src(x, y))) * (beta - alpha)}{max(src(x, y)) - min(src(x, y))} + alpha$
$${x}over{y}$$
NORM_INF
分母為L(zhǎng)∞范數(shù) ,即矩陣各元素絕對(duì)值的最大值(切比雪夫距離)
NORM_L1
分母為L(zhǎng)1-范數(shù),即矩陣元素的絕對(duì)值之和(曼哈頓距離)
NORM_L2
分母為L(zhǎng)2-范數(shù),即矩陣各元素的歐幾里德距離之和
總結(jié)
以上是生活随笔為你收集整理的OpenCV之图像归一化(normalize)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 利用jspx解决jsp后缀被限制拿she
- 下一篇: Linux mint 风扇控制软件