第四章 實驗結果
4.3 色彩模型辨識實驗
4.3.2 色彩模型選用
於色彩模型辨識階段嘗詴了使用 RGB、正規化 RGB、YC
b
Cr
以及 HSV 等色 彩空間建立色彩模型,我們計算一個近似於統計學中 Z 分數 (Z-values) 的評量 參數,用以判斷各個色彩空間對於不同人物的色彩模型能夠被區分的程度,其假 設各個色彩模型分佈為常態分佈,選取兩個欲判斷之色彩模型,以標準差較大的 模型作為基準,判斷標準差較小之模型平均數距離標準差較大之模型的標準差 數,再參考模型的平均以及標準差,方能判斷各個色彩空間是否適合於進行色彩 模型辨識。考慮 i、j 兩個色彩模型,
與 分別為平均值與標準差,計算公式定 義為) , max(
j
,
i j i j
z i
(4.4)圖 4.17. 人物之外切矩形偵測,(a)畫面影像,(b)前景分佈,(c)前 景分佈投影至 X 軸,(d)前景分佈投影至 Y 軸,(e)擷取出 人物之外切矩形。
(a) (b)
(c) (d)
(e)
44
表 4.2. 身體區域之偵測結果
No. 前景分佈 影像畫面
1
2
3
4
5
6
7
使用 RGB 色彩空間進行分析,如表 4.3 所示,各個空間皆與亮度有相當大
mean:215.9536, std:18.5115, maximum point: 456 at R = 207
0 50 100 150 200 250
mean:224.1761, std:18.175, maximum point: 893 at G = 255
0 50 100 150 200 250
mean:221.469, std:19.9224, maximum point: 815 at B = 255
μ: 215, σ: 18.51 μ: 224, σ: 18.18 μ: 221, σ: 19.92
mean:64.6559, std:28.0373, maximum point: 236 at R = 55
0 50 100 150 200 250
mean:58.9064, std:27.1811, maximum point: 251 at G = 51
0 50 100 150 200 250
0 50 100 150
mean:79.73, std:26.432, maximum point: 187 at B = 73
μ: 64, σ: 28.03 μ: 58, σ: 27.18 μ: 79, σ: 26.43
mean:213.5654, std:22.23, maximum point: 470 at R = 224
0 50 100 150 200 250
0 200 400 600
mean:94.2515, std:13.6749, maximum point: 606 at G = 96
0 50 100 150 200 250
0 200 400 600
mean:91.4477, std:13.7998, maximum point: 606 at B = 92
μ: 213, σ: 22.23 μ: 94, σ: 13.67 μ: 91, σ: 13.8
mean:65.0872, std:11.8892, maximum point: 359 at R = 67
0 50 100 150 200 250
mean:50.7167, std:9.8556, maximum point: 479 at G = 52
0 50 100 150 200 250
mean:46.939, std:9.267, maximum point: 545 at B = 48
μ: 65, σ: 11.89 μ: 50, σ: 9.86 μ: 46, σ: 9.27
mean:210.9875, std:13.1886, maximum point: 583 at R = 216
0 50 100 150 200 250
mean:227.9987, std:14.1197, maximum point: 557 at G = 233
0 50 100 150 200 250
0 2000 4000 6000
mean:249.0446, std:11.7126, maximum point: 7700 at B = 255
μ: 210, σ: 13.19 μ: 227, σ: 14.12 μ: 249, σ: 11.71
46
mean:83.2427, std:1.3917, maximum point: 6542 at r = 83
0 50 100 150 200 250
0 2000 4000 6000
mean:86.447, std:1.7956, maximum point: 6258 at g = 86
0 50 100 150 200 250
mean:85.3151, std:1.7041, maximum point: 4910 at b = 86
μ: 83, σ: 1.39 μ: 86, σ: 1.8 μ: 85, σ: 1.7
mean:80.7492, std:6.2809, maximum point: 837 at r = 80
0 50 100 150 200 250
mean:72.8227, std:5.0353, maximum point: 974 at g = 72
0 50 100 150 200 250
mean:101.4413, std:8.1361, maximum point: 565 at b = 103
μ: 80, σ: 6.28 μ: 72, σ: 5.04 μ: 101, σ: 8.14
mean:136.7283, std:8.1959, maximum point: 1583 at r = 138
0 50 100 150 200 250
mean:60.0461, std:4.112, maximum point: 2418 at g = 60
0 50 100 150 200 250
0 500 1000 1500
mean:58.253, std:4.9859, maximum point: 1941 at b = 57
μ: 136, σ: 8.2 μ: 60, σ: 4.11 μ: 58, σ: 4.99
mean:102.379, std:8.6862, maximum point: 1075 at r = 103
0 50 100 150 200 250
0 500 1000 1500
mean:79.1523, std:4.3231, maximum point: 1504 at g = 80
0 50 100 150 200 250
mean:73.4309, std:6.6632, maximum point: 999 at b = 74
μ: 102, σ: 8.68 μ: 79, σ: 4.32 μ: 73, σ: 6.66
mean:78.1599, std:1.4041, maximum point: 4412 at r = 78
0 50 100 150 200 250
mean:84.4635, std:1.0521, maximum point: 4709 at g = 85
0 50 100 150 200 250
mean:92.353, std:1.872, maximum point: 2928 at b = 93
μ: 78, σ: 1.4 μ: 84, σ: 1.05 μ: 92, σ: 1.87
的第 1、5 類及深色系的第 2、4 類,由直方圖上觀察可得,各個模型的分佈並沒 有如同 RGB 般淺色系偏右深色系偏左的現象,確實減低了其分佈與亮度之間的 影響,且各個分佈的變異數也比於 RGB 的分佈較為小,其分佈明顯較為窄。我 們藉由計算 z 值比較深色系的兩類以及淺色系的兩類是否容易區分,如表 4.5 所 示,深色系與淺色系皆在 r、g 空間有較好的區分效果。
表 4.5. 比較淺色系與深色系可區分的程度於 rgb 模型
r g b
5 ,
z 1
(淺色系) 3.57 1.11 3.744 ,
z 2
(深色系) 2.53 1.39 3.44我們再以 YC
b
Cr
空間進行分析,如表 4.6 所示,其轉換方式如 3.1.2 節所介 紹。YCb
Cr
將亮度與彩度進行分離,從亮度觀察,可以明顯區分出深色系與淺色 系的差異,淺色系的 1、5 類 Y 值平均偏大,深色系的 2、4 類 Y 值平均偏小,而這可能造成同為淺色系或深色系的模型難以區分,我們再計算深色系與淺色系 之 z 值,如表 4.7 所示。同為深色系與淺色系的色彩模型在亮度上確實難以區分,
但在 C
b
、Cr
上仍有一定的區分效果,在這些詴驗的樣本中又以 Cb
的可區分程度 為佳。雖然同為深色系或淺色系的模型無法透過 Y 進行區分,但其可有效的區分 深色系與淺色系的模型,表 4.8
4.9 比較相異亮度的色系間能區分的程度,比起
rgb 模型,YCb
Cr
藉由 Y 使得相異亮度的色彩模型能明顯區分,其 z 值至少也有 5.85,而在 Cr
上 z 值至少也有 2.96 的水準。考慮 rgb 三個通道來看,最佳之 z 值 出現在z 5 b , 4
,其值為 2.85,且 z 值全部皆小於 3,因此 rgb 模型在分辨相異亮度 間的色彩模型之效能仍不及 YCb
Cr
。經由上述討論,其反應出 YCb
Cr
比 rgb 模型48
mean:206.0139, std:15.7603, maximum point: 595 at Y = 199
0 50 100 150 200 250
0 1000 2000 3000
mean:128.0397, std:2.0251, maximum point: 3749 at Cb = 128
0 50 100 150 200 250
mean:124.5727, std:1.6948, maximum point: 4854 at Cr = 124
μ: 206, σ: 15.76 μ: 128 σ: 2.02 μ: 124 σ: 1.69
mean:69.9592, std:23.4075, maximum point: 268 at Y = 63
0 50 100 150 200 250
mean:136.3029, std:3.499, maximum point: 992 at Cb = 137
0 50 100 150 200 250
mean:129.0432, std:1.6216, maximum point: 2352 at C r = 129
mean:127.4635, std:12.3624, maximum point: 687 at Y = 131
0 50 100 150 200 250
mean:109.0592, std:3.7389, maximum point: 2115 at Cb = 108
0 50 100 150 200 250
mean:180.6566, std:8.048, maximum point: 2073 at Cr = 184
μ: 127, σ: 12.36 μ: 109, σ: 3.74 μ: 180, σ: 8.05
mean:62.717, std:8.7425, maximum point: 557 at Y = 64
0 50 100 150 200 250
mean:124.1965, std:2.1278, maximum point: 2077 at Cb = 124
0 50 100 150 200 250
0 500 1000 1500
mean:134.592, std:1.9344, maximum point: 1848 at C r = 134
mean:209.4285, std:11.4579, maximum point: 761 at Y = 216
0 50 100 150 200 250
0 500 1000 1500
mean:139.784, std:2.8514, maximum point: 1876 at Cb = 140
0 50 100 150 200 250
mean:119.0016, std:1.8785, maximum point: 2960 at Cr = 119
μ: 209, σ: 11.46 μ: 139, σ: 2.85 μ: 119, σ: 1.88
表 4.8. 比較淺色系與深色系間可區分的程度於 rgb 模型
r g b
2 ,
z 1
0.48 2.78 1.974 ,
z 1
2.19 1.62 1.82 ,
z 5
0.32 2.38 1.114 ,
z 5
2.77 1.16 2.85表 4.9. 比較淺色系與深色系間可區分的程度於 YC
b
Cr
空間Y C
b
Cr
2 ,
z 1
5.85 2.28 2.964 ,
z 1
9.13 1.87 5.182 ,
z 5
5.98 0.86 5.324 ,
z 5
12.83 5.26 7.77HSV 色彩空間在處理上將會遇到一些問題,當亮度 (Value) 過低時色度 (Hue) 將失去意義;當飽和度 (Saturation) 過低時,色度將不穩定。為了避免上 述的問題我們在建立 HSV 色彩模型時加入了門檻值。HSV 之門檻值使用
o
T 36
H
、ST
= 22.95、VT
= 25.5,H 介於 36 o
間則歸於0 o
,以消除 H 值0 o
與359 o
度間不連續的現象。S 小於 22.95 代表含有過多的白色成份,顏色將不易區分,因此 H 值也歸為 0 度,S 值也歸 0。V 值低於 25.5 表示色彩亮度偏暗,亦不易識 別其顏色,因此 H 也歸為 0 度。
表 4.10 中,受到 H 之特性關係,僅以出現最大值之 H 值表示,而 S、V 仍
50
mean:1.4958, std:13.6662, maximum point: 13874 at H = 0
0 50 100 150 200 250
0 5000 10000
mean:0.43643, std:3.7449, maximum point: 13855 at S = 0
0 50 100 150 200 250
mean:225.79, std:18.1001, maximum point: 1053 at V = 255
H = 0 μ: 0, σ: 3.74 μ: 225, σ: 18.1
mean:166.9564, std:49.3187, maximum point: 762 at H = 181
0 50 100 150 200 250
0 100 200 300
mean:70.6508, std:23.7987, maximum point: 316 at S = 0
0 50 100 150 200 250
0 50 100 150
mean:81.259, std:26.6808, maximum point: 184 at V = 74
H = 181 μ: 70, σ: 23.8 μ: 81, σ: 26.68
mean:1.203, std:14.52, maximum point: 10905 at H = 0
0 50 100 150 200 250
mean:146.1938, std:16.1004, maximum point: 843 at S = 147
0 50 100 150 200 250
mean:214.6707, std:21.8229, maximum point: 470 at V = 225
H = 0 μ: 146, σ: 16.1 μ: 214, σ: 21.82
mean:4.6234, std:29.2747, maximum point: 6982 at H = 0
0 50 100 150 200 250
0 100 200 300
mean:71.5515, std:15.6509, maximum point: 324 at S = 77
0 50 100 150 200 250
0 100 200 300
mean:66.3285, std:11.8791, maximum point: 364 at V = 68
H = 0 μ: 71, σ: 15.65 μ: 66, σ: 11.88
mean:147.3788, std:22.7664, maximum point: 1404 at H = 151
0 50 100 150 200 250
mean:38.5463, std:9.0828, maximum point: 860 at S = 39
0 50 100 150 200 250
mean:250.0465, std:11.7105, maximum point: 8045 at V = 255
H = 151 μ: 38, σ: 9.08 μ: 250, σ: 11.71
建立色彩模型,再擷取人物於畫面中與攝影機距離由遠到近的各個影像,以直方 圖激發的方式進行詴驗,其正確率計算方式為
%
100
人物畫面影像數 辨識正確之影像數正確率 (4.6)
圖 4.18 比較上半身區域取樣數與兩個色彩空間對正確率之影響,我們可得 YC
b
Cr
的正確率皆大於 rgb 模型。使用直方圖交集[11]以及直方圖激發於 YC
b
Cr
進行比較,直方圖交集取用所 有上半身區域之像素點建立模型,並與預先建立的色彩模型做交集運算,其考量 範圍最為完整,詴驗之正確率為 100%,但由於其需經由建立模型、交集運算兩 個處理程序,在運算效率上較直方圖激發來得慢。我們統計所有詴驗樣本之上半 身區域像素點數,其平均為 735 個像素,在使用直方圖交集時平均每次處理皆要 運算如此的點數,且需經過兩個處裡程序。使用直方圖激發則依照取樣區域數而 定,每個取樣區域為7
7之遮罩,共 49 個像素點,而由圖 4.18 觀察可得,在取 樣數為 7 時正確率即以逼近 100%,而使用像素點僅 343 個像素。經由上述討論,圖 4.18. 比較 YC
b
Cr
與 rgb 之正確率52
直方圖激發比起直方圖交集有更佳的處理效能,而我們在處理的影像為連續的影 像序列,因此透過數個影像間進行主要投票,則可再次縮減直方圖激發的取樣數 至 3 個取樣樣本,並且維持辨識水準。