OpenCV之图像归一化(normalize)
生活随笔
收集整理的這篇文章主要介紹了
OpenCV之图像归一化(normalize)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
什么圖像歸一化
通俗地講就是將矩陣的值通過某種方式變到某一個區間內
圖像歸一化的作用
目前能理解的就是歸一化到某個區間便于處理,希望高人可以指點
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表示執行相應歸一化后矩陣的范數值,beta不使用。
3、稀疏矩陣歸一化僅支持非零像素
NORM_MINMAX
數組的數值被平移或縮放到一個指定的范圍,線性歸一化。
$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∞范數 ,即矩陣各元素絕對值的最大值(切比雪夫距離)
NORM_L1
分母為L1-范數,即矩陣元素的絕對值之和(曼哈頓距離)
NORM_L2
分母為L2-范數,即矩陣各元素的歐幾里德距離之和
總結
以上是生活随笔為你收集整理的OpenCV之图像归一化(normalize)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 利用jspx解决jsp后缀被限制拿she
- 下一篇: CodeForces369C On Ch