對極幾何嘅典型用例兩台相機從唔同嘅角度影同一場景嘅相片 , 而兩幅視圖 之間 啲拏褦可以攞 對極幾何描述 返 。
對極幾何 (英文 :Epipolar geometry )係處理立體視覺 嘅幾何,意指兩台相機從兩笪埞唔同嘅嚟睇一幅 3D 場景嗰陣(可以3D物體,或者佢上高嘅一粒點或者一條線),啲3D 點戥佢哋啲 2D 投影存在有好多啲幾何拏褦,啲喺圖像點之間造成咗一啲約束條件。一般嚟講,啲拏褦可以基於近似假設相機成針孔相機模型 推導出嚟;但一啲特殊嘅相機(譬如推掃式嘅)會需要到遞啲模型。對極幾何係八點算法 或者多視角幾何 嘅基礎概念,雖然啲後者對原本嘅過程有返唔同程度嘅擴展。
下圖描繪咗兩台睇住
X
{\displaystyle \mathrm {X} }
點嘅針孔相機。喺真實嘅相機中,圖像面實際上係擺喺焦點後(試惗相機CCD ),並產生啲圖像係關於鏡頭焦點中心對稱嘅。之不過,爲咗方便,對極幾何入便擺啲圖像面去焦點中心(即Cardinal point )前面(圖中兩幅灰藍色面),嚟保持啲圖像上下左右嘸因對稱性而翻轉。其中,
O
L
{\displaystyle \mathrm {O} _{L}}
同
O
R
{\displaystyle \mathrm {O} _{R}}
代表緊兩台相機鏡頭嘅對稱中心。
X
{\displaystyle \mathrm {X} }
作爲兩台相機關注緊嘅點,個點
x
L
{\displaystyle \mathrm {x} _{L}}
同個
x
R
{\displaystyle \mathrm {x} _{R}}
即係點
X
{\displaystyle \mathrm {X} }
喺啲圖像面上嘅投影。
對極幾何
每台相機都影到 3D 世界嘅 2D 圖像。噉樣嘅從 3D 到 2D 嘅轉換喊做透視投影 ,係攞針孔相機模型嚟描述。建模好多時係透過啲射線係從某相機發出而且穿過佢個焦點中心嘅嚟做投影。每條發出嘅光線對應圖像嗰度嘅一粒點。
相關概念 [ 編輯 ]
兩粒相機焦點中心連成嘅線
O
L
O
R
¯
{\displaystyle {\overline {\mathrm {O} _{L}\mathrm {O} _{R}}}}
係「基線 」(英文 :baseline ),條線戥粒 3D 點構成嘅平面喊做「對極平面 」(圖中綠色面,英文 :epipolar plane )。基線戥兩幅圖像交叉嘅兩粒點
e
L
{\displaystyle \mathrm {e} _{L}}
、
e
R
{\displaystyle \mathrm {e} _{R}}
喊做「對極點 」(英文 :epipole,epipolar point ),係邊一幅圖像就係邊一台相機嘅對極點;亦都可以話,係台相機個中心發嘅射線穿過第個中心嗰陣,戥台機幅圖像面交叉嘅點。一條「對極線 」(英文 :epipolar line )係喺一幅圖像上,投影點譬如
x
R
{\displaystyle \mathrm {x} _{R}}
戥對極點
e
R
{\displaystyle \mathrm {e} _{R}}
連成嘅線
x
R
e
R
¯
{\displaystyle {\overline {\mathrm {x} _{R}\mathrm {e} _{R}}}}
;對極線亦都可以話係幅對極平面戥兩便圖像面嘅兩條交線,或者話係喺一幅圖像度睇到嘅一串點重疊(圖中
O
L
,
X
,
X
1
,
…
{\displaystyle \mathrm {O} _{L},\mathrm {X} ,\mathrm {X} _{1},\dots }
疊成
x
L
{\displaystyle \mathrm {x} _{L}}
)、喺第幅圖像度反映成嘅線(
x
R
e
R
¯
{\displaystyle {\overline {\mathrm {x} _{R}\mathrm {e} _{R}}}}
)。
特殊情況下,兩台相機圖像面係平行嘅嗰陣(或者一台相機平行圖像面嚟移動),條基線亦都平行於啲圖像面,而啲對極線係一排平行線(交於無限遠)。
對極約束 [ 編輯 ]
令
R
,
T
{\displaystyle \mathbf {R} ,\mathbf {T} }
係兩便參考系之間嘅旋轉同平移,點
X
{\displaystyle \mathrm {X} }
喺兩個參考系入便啲坐標(
X
L
{\displaystyle \mathbf {X} _{L}}
同
X
R
{\displaystyle \mathbf {X} _{R}}
)可以透過
X
R
=
R
X
L
+
T
{\displaystyle \mathbf {X} _{R}=\mathbf {R} \mathbf {X} _{L}+\mathbf {T} }
表示到。乘埋反對稱矩陣 (skew-symmetric matrix)
T
^
{\displaystyle {\hat {\mathbf {T} }}}
,因爲佢戥
T
{\displaystyle \mathbf {T} }
正交,所以
T
^
T
=
0
{\displaystyle {\hat {\mathbf {T} }}\mathbf {T} =0}
:
T
^
X
R
=
T
^
R
X
L
+
T
^
T
=
T
^
R
X
L
{\displaystyle {\hat {\mathbf {T} }}\mathbf {X} _{R}={\hat {\mathbf {T} }}\mathbf {R} \mathbf {X} _{L}+{\hat {\mathbf {T} }}\mathbf {T} ={\hat {\mathbf {T} }}\mathbf {R} \mathbf {X} _{L}}
再乘埋
X
R
T
{\displaystyle \mathbf {X} _{R}^{\mathrm {T} }}
,因爲佢戥
T
^
X
R
{\displaystyle {\hat {\mathbf {T} }}\mathbf {X} _{R}}
正交,得到
X
R
T
T
^
X
R
=
X
R
T
T
^
R
X
L
=
0
{\displaystyle \mathbf {X} _{R}^{\mathrm {T} }{\hat {\mathbf {T} }}\mathbf {X} _{R}=\mathbf {X} _{R}^{\mathrm {T} }{\hat {\mathbf {T} }}\mathbf {R} \mathbf {X} _{L}=0}
即有對極約束(epipolar constraint)式:
X
R
T
T
^
R
X
L
=
0
{\displaystyle \mathbf {X} _{R}^{\mathrm {T} }{\hat {\mathbf {T} }}\mathbf {R} \mathbf {X} _{L}=0}
令
E
=
T
^
R
{\displaystyle \mathbf {E} ={\hat {\mathbf {T} }}\mathbf {R} }
,即當乘積
T
^
R
{\displaystyle {\hat {\mathbf {T} }}\mathbf {R} }
係本質矩陣 (essential matrix),所以改寫成:
X
R
T
E
X
L
=
0
{\displaystyle \mathbf {X} _{R}^{\mathrm {T} }\mathbf {E} \mathbf {X} _{L}=0}
對於啲圖像面座標
x
{\displaystyle \mathbf {x} }
,同埋某個對應嘅深度距離
λ
{\displaystyle \lambda }
,有:
λ
L
x
L
=
X
L
{\displaystyle \lambda _{L}\mathbf {x} _{L}=\mathbf {X} _{L}}
λ
R
x
R
=
X
R
{\displaystyle \lambda _{R}\mathbf {x} _{R}=\mathbf {X} _{R}}
所以從一幅圖面轉到另一幅圖面嘅對極約束式都幾乎相同:
x
R
T
E
x
L
=
0
{\displaystyle \mathbf {x} _{R}^{\mathrm {T} }\mathbf {E} \mathbf {x} _{L}=0}
未校準相機 [ 編輯 ]
相機座標系啲點座標未必可以代表佢喺圖像上對應像素點;所以引入校準矩陣
K
{\displaystyle \mathbf {K} }
(calibration matrix),係噉啲圖像面座標
x
{\displaystyle \mathbf {x} }
同埋參考系座標
X
{\displaystyle \mathbf {X} }
到像素座標
x
′
{\displaystyle \mathbf {x} '}
嘅轉換可以寫得成:
x
′
=
K
x
{\displaystyle \mathbf {x} '=\mathbf {K} \mathbf {x} }
λ
x
′
=
K
X
{\displaystyle \lambda \mathbf {x} '=\mathbf {K} \mathbf {X} }
係噉原對極約束式可以轉成式:
x
R
′
T
K
−
T
E
K
−
1
x
L
′
=
0
{\displaystyle \mathbf {x} _{R}'^{\mathrm {T} }\mathbf {K} ^{-\mathrm {T} }\mathbf {E} \mathbf {K} ^{-1}\mathbf {x} '_{L}=0}
令
F
=
K
−
T
E
K
−
1
{\displaystyle \mathbf {F} =\mathbf {K} ^{-\mathrm {T} }\mathbf {E} \mathbf {K} ^{-1}}
,即當乘積
K
−
T
E
K
−
1
{\displaystyle \mathbf {K} ^{-\mathrm {T} }\mathbf {E} \mathbf {K} ^{-1}}
係基礎矩陣 (fundamental matrix),可以改寫成未校準相機嘅對極約束式:
x
R
′
T
F
x
L
′
=
0
{\displaystyle \mathbf {x} _{R}'^{\mathrm {T} }\mathbf {F} \mathbf {x} '_{L}=0}
另外,從對極平面直接映射可以有以下證明[1] :
令
x
L
,
x
R
{\displaystyle \mathbf {x} _{L},\mathbf {x} _{R}}
點
X
{\displaystyle \mathrm {X} }
喺兩便圖像噶投影點座標,因爲
X
{\displaystyle \mathrm {X} }
喺經
x
L
{\displaystyle \mathbf {x} _{L}}
嘅射線上,所以有對極線
l
R
{\displaystyle \mathbf {l} _{R}}
、上高有點
x
R
{\displaystyle \mathbf {x} _{R}}
嘅;因爲
x
L
,
x
R
{\displaystyle \mathbf {x} _{L},\mathbf {x} _{R}}
都係
X
{\displaystyle \mathrm {X} }
喺對極平面
π
{\displaystyle \mathrm {\pi } }
嘅像 ,因爲兩者射影等價 於點集
O
L
,
X
,
X
1
,
…
{\displaystyle \mathrm {O} _{L},\mathrm {X} ,\mathrm {X} _{1},\dots }
(即點集喺左圖像面啲投影
x
L
i
{\displaystyle \mathbf {x} _{Li}}
戥右圖像面啲投影
x
R
i
{\displaystyle \mathbf {x} _{Ri}}
等價),所以互相之間有2D單映射 關係
x
R
=
H
x
L
{\displaystyle \mathbf {x} _{R}=\mathbf {H} \mathbf {x} _{L}}
;因爲對極線係穿過對極點,所以
l
R
=
[
e
′
]
×
H
π
x
L
{\displaystyle \mathbf {l} _{R}=[\mathbf {e} ']_{\times }\mathbf {H} _{\pi }\mathbf {x} _{L}}
;係噉可以令
F
=
[
e
′
]
×
H
π
{\displaystyle \mathbf {F} =[\mathbf {e} ']_{\times }\mathbf {H} _{\pi }}
。而對於某一點
x
R
{\displaystyle \mathbf {x} _{R}}
喺
l
R
{\displaystyle \mathbf {l} _{R}}
上,有
x
R
T
l
R
=
x
R
T
F
x
L
=
0
{\displaystyle \mathbf {x} _{R}^{\mathrm {T} }\mathbf {l} _{R}=\mathbf {x} _{R}^{\mathrm {T} }\mathbf {F} \mathbf {x} _{L}=0}
,即有對極約束條件。
對極約束同三角測量 [ 編輯 ]
若果兩台相機嘅相對位置已知,有以下兩個重要嘅觀察結果:
假設投影點
x
R
{\displaystyle \mathrm {x} _{R}}
已知,對極線
x
R
e
R
¯
{\displaystyle {\overline {\mathrm {x} _{R}\mathrm {e} _{R}}}}
已知,而且點
X
{\displaystyle \mathrm {X} }
投影到右圖度嘅點
x
R
{\displaystyle \mathrm {x} _{R}}
上,位於條特定嘅對極線
x
R
e
R
¯
{\displaystyle {\overline {\mathrm {x} _{R}\mathrm {e} _{R}}}}
度。即係話對於幅圖像入便觀察到嘅每粒點,都必然喺第幅圖像上一條已知對極線度觀察到。係噉有極線約束:
X
{\displaystyle \mathrm {X} }
喺右相機平面上嘅投影
x
R
{\displaystyle \mathrm {x} _{R}}
必須包含喺對極線
x
R
e
R
¯
{\displaystyle {\overline {\mathrm {x} _{R}\mathrm {e} _{R}}}}
當中。所有啲點
X
{\displaystyle \mathrm {X} }
譬如
X
1
{\displaystyle \mathrm {X} _{1}}
、
X
2
{\displaystyle \mathrm {X} _{2}}
、
X
3
{\displaystyle \mathrm {X} _{3}}
喺
O
L
X
L
¯
{\displaystyle {\overline {\mathrm {O} _{L}\mathrm {X} _{L}}}}
上嘅都可以驗證返呢個約束。噉樣即係可以測試到兩粒點係咪對應 返同一粒 3D 點。啲對極約束亦都可以通過兩台相機之間嘅本質矩陣
E
{\displaystyle \mathbf {E} }
或者基礎矩陣
F
{\displaystyle \mathbf {F} }
嚟描述到。
若果點
x
L
{\displaystyle \mathrm {x} _{L}}
同
x
R
{\displaystyle \mathrm {x} _{R}}
已知,係噉佢哋啲投影線亦都係已知嘅。若果兩粒圖像點對應返相同嘅 3D 點
X
{\displaystyle \mathrm {X} }
,係噉投影線必須喺
X
{\displaystyle \mathrm {X} }
度精確相交。即係話,可以根據兩粒圖像點嘅坐標計返
X
{\displaystyle \mathrm {X} }
,即所謂嘅三角測量 。
簡化案例 [ 編輯 ]
對極幾何可以簡化,如果兩台相機啲圖像平面吻合嘅話。喺種情況下,對極線亦都吻合埋(
x
L
e
L
¯
{\displaystyle {\overline {\mathrm {x} _{L}\mathrm {e} _{L}}}}
=
x
R
e
R
¯
{\displaystyle {\overline {\mathrm {x} _{R}\mathrm {e} _{R}}}}
)。另外,啲對極線係平行於基線
O
L
O
R
¯
{\displaystyle {\overline {O_{L}O_{R}}}}
,而且可以喺實踐中戥所述兩個圖像嘅水平軸對齊返。噉樣即係對於一幅圖像啲每粒點,只需沿水平線查睇就搵得到佢對應第幅圖像粒點。[2]
如果相機位置唔可以噉擺法,係噉嚟自啲相機嘅嗰啲圖像坐標可以轉換到模擬得出有返公共嘅圖像面。個過程喊做圖像校正 。
推掃式相機嘅對極幾何 [ 編輯 ]
戥使用二維CCD嘅傳統frame相機唔同,推掃式相機 (Push broom scanner )採用一維CCD陣列來產生又長又連續嘅圖像帶,叫做「圖像地毯」。呢種傳感器嘅對極幾何形狀戥針孔投影相機嘅極線幾何形狀完全唔同。首先,推掃式傳感器嘅對極線唔係直線,而係雙曲線。其次,對極「曲線」pair唔存在。 [3] 之喺一些特殊條件下,衛星圖像嘅對極幾何可以認為係一種線性模型。 [4]