9
1 視覚の幾何学2 参考書 佐藤 淳: 「コンピュータビジョン -視覚の幾何学-」 コロナ社 立体視Stereo Vision (Stereopsis) Main problem – recover 3D depth from two (or more) image views ●一台のカメラから得られた一枚の画像のみからでは、 3D物体の奥行き・形状を一意に決定できない 2つ以上の異なる視点で得られた画像からはこのよう な不定性を取り除き、奥行き・形状を決定できる ●静止シーンの場合、1台のカメラから異なる視点で得られた2枚の画像でもOK ●動く物体の場合、1台のカメラから固定視点で得られた画像系列でOK baseline optical center (left) optical center (right) Focal length World point Depth of p image point (left) image point (right) Slide credit: Kristen Grauman 立体視の原理 Assume parallel optical axes, known camera parameters (i.e., calibrated cameras). We can triangulate via: 三角計測法 Similar triangles (p l , P, p r ) and (O l , P, O r ): Geometry for a simple stereo system Z T f Z x x T r l r l x x T f Z 視差(disparity) Slide credit: Kristen Grauman 物体までの距離: 平行ステレオ視の3D距離推定 P(x,y,z)の座標値 R L R L R R L L R L L x x T f z x x T y x x T y y x x T x x T 左カメラの光学中心がワールド座標の原点とする (左カメラや、両カメラの真ん中のOKDepth from disparity Left image I(x,y) Right image I´(x´,y´) Disparity map D(x,y) (x´,y´)=(x+D(x,y), y) Slide credit: Kristen Grauman

立体視Stereo Vision (Stereopsis) 視覚の幾何学2wuhy/CV10.pdf · エピポーラ幾何(Epipolar geometry) 複数の視点における相対的なカメラの位置Tや姿勢R

  • Upload
    others

  • View
    8

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 立体視Stereo Vision (Stereopsis) 視覚の幾何学2wuhy/CV10.pdf · エピポーラ幾何(Epipolar geometry) 複数の視点における相対的なカメラの位置Tや姿勢R

1

視覚の幾何学2

参考書佐藤 淳:「コンピュータビジョン -視覚の幾何学-」コロナ社

立体視Stereo Vision (Stereopsis)Main problem – recover 3D depth from two

(or more) image views

●一台のカメラから得られた一枚の画像のみからでは、3D物体の奥行き・形状を一意に決定できない

●2つ以上の異なる視点で得られた画像からはこのような不定性を取り除き、奥行き・形状を決定できる

●静止シーンの場合、1台のカメラから異なる視点で得られた2枚の画像でもOK●動く物体の場合、1台のカメラから固定視点で得られた画像系列でOK

baseline

optical center (left)

optical center (right)

Focal length

World point

Depth of pimage point (left)

image point (right)

Slide credit: Kristen Grauman

立体視の原理

Assume parallel optical axes, known camera parameters (i.e., calibrated cameras). We can triangulate via:

三角計測法Similar triangles (pl, P, pr) and (Ol, P, Or):

Geometry for a simple stereo system

Z

T

fZ

xxT rl

rl xx

TfZ

視差(disparity)Slide credit: Kristen Grauman

物体までの距離:

平行ステレオ視の3D距離推定

点P(x,y,z)の座標値

RL

RL

R

RL

L

RL

L

xx

Tfz

xx

Ty

xx

Tyy

xx

Txx

T

左カメラの光学中心がワールド座標の原点とする(左カメラや、両カメラの真ん中のOK)

Depth from disparity

Left image I(x,y) Right image I´(x´,y´)Disparity map D(x,y)

(x´,y´)=(x+D(x,y), y)

Slide credit: Kristen Grauman

Page 2: 立体視Stereo Vision (Stereopsis) 視覚の幾何学2wuhy/CV10.pdf · エピポーラ幾何(Epipolar geometry) 複数の視点における相対的なカメラの位置Tや姿勢R

2

立体視の原理 Algorithm

• Rotate both left and right camera so that they share the same X axis : Or-Ol = T← カメラ中心の平行移動量

• Define a rotation matrix Rrect for the left camera

• Rotation Matrix for the right camera is Rrect・RT

• Rotation can be implemented by image transformation

pl

pr

P

Ol Or

Xl

Xr

Pl Pr

Zl

Yl

Zr

Yr

R, t

tX’l

Xl’ = T, Yl’ = Xl’xZl, Z’l = Xl’xYl’光軸は平行ではない場合変換前座標系:(X,Y,Z)変換後座標系:(X’,Y’X’)→平行

Algorithm

• Rotate both left and right camera so that they share the same X axis : Or-Ol = T

• Define a rotation matrix Rrect for the left camera

• Rotation Matrix for the right camera is Rrect・RT

• Rotation can be implemented by image transformation

pl

pr

P

Ol Or

Xl

Xr

Pl Pr

Zl

Yl

Zr

Yr

R, t

tX’l

Xl’ = T, Yl’ = Xl’xZl, Z’l = Xl’xYl’

立体視の原理

光軸は平行になるように変換(R,tが既知→カメラ校正済み)

Stereo image rectification: example

Source: Alyosha Efros

光軸は平行になるように変換

カメラキャリブレーション済みなら

• R,tが既知

• 光軸は平行になるように変換できる

• 2Dシーンから3D復元p

lp

r

P

Ol Or

Xl

Xr

Pl Pr

Zl

Yl

Zr

Yr

R, t

tX’l

Xl’ = T, Yl’ = Xl’xZl, Z’l = Xl’xYl’

立体視の原理と問題点1

一つの問題:対応点をどう判定するか?

Correlation Approach

For each point ○(xl, yl) in the left image, define a window centered at the point

(xl, yl)LEFT IMAGE

左画像からある点○の周辺領域をテンプレット□とする

テンプレット

Correlation Approach

… search its corresponding point within a search region in the right image

(xl, yl)RIGHT IMAGEテンプレット

テンプレットを用いて、右画像のある領域から対応点を探す

Page 3: 立体視Stereo Vision (Stereopsis) 視覚の幾何学2wuhy/CV10.pdf · エピポーラ幾何(Epipolar geometry) 複数の視点における相対的なカメラの位置Tや姿勢R

3

Correlation Approach

… the disparity (dx, dy) is the displacement when the correlation is maximum

(xl, yl)dx(xr, yr)RIGHT IMAGE

相関評価で最大類似度を取れた点ペアの視差を求める特徴に基づいた立体視

特徴検出

• 特徴:コーナー、線、エッジ

• 対応特徴を見つける

(相関評価による)

⇒視差(disparity)より奥行計算

残りの部分は表面内挿

corner line

structure

よく用いられる相関評価方法1

Wx

xdxd 2)()()( rl II

ラスタスキャン多次元ベクトルと考える

画素毎に差をとって二乗

総和

SSD(Sum of Squared Differences) (二乗誤差)

• 最も基本的な誤差評価関数

• 画像をベクトルとみなせば、

ベクトル間のユークリッド距離

• 外れ値の影響を受けやすい

• 照明変化の影響を受けやすい

Il

IrImage2

Image1

よく用いられる相関評価方法2 SAD(Sum of Absolute Differences) (絶対誤差)

• 画素毎の差分の絶対値の和

• SSDに比べて外れ値の影響を受けにくい

• 照明の影響を受けやすい

Wx

xdxd |)()(|)( lr II

画像領域をベクトルで表現

ベクトル間の市街地距離

よく用いられる相関評価方法3

CC(Cross Correlation) 正規化相互相関

• 領域内の画素値をベクトル化

• ベクトルの各要素から平均値を引く

• ベクトル間の内積(角度)

• 照明変化に強い

SSD,SAD

CC

ノルムが変化しても内積CCは変わらない

,1

)(,

1

)(

|)(||)(|

)()()(

Wx

Wx

Wx

Wx

Wx

dxx

xdx

xdx

r

r

l

l

llrr

llrr

II

II

IIII

IIIId

明るさの正規化

コントラストの正規化

特徴に基づいた立体視

corner

2x

1x

21 xx

fBZ

視差(disparity)

平行ステレオカメラ:2枚の画像から3次元情報を復元

Page 4: 立体視Stereo Vision (Stereopsis) 視覚の幾何学2wuhy/CV10.pdf · エピポーラ幾何(Epipolar geometry) 複数の視点における相対的なカメラの位置Tや姿勢R

4

ボールの3D軌跡の計測平行ステレビデオカメラ

エピポーラ平面

エピポーラ線

右画像 左画像

Local Features:Detectors & DescriptorsDetected

Interest Points/RegionsDescriptors

<0 12 31 0 0 23 …>

<5 0 0 11 37 15 …>

<14 21 10 0 3 22 …>

最近の動向:SIFT or SURF特徴量によって2枚画像間の対応点を探し出す

各点の周辺領域から128次元の特徴量が得られる

最近の方法:

Correspondence

Images from: M. Brown and D. G. Lowe. Recognising Panoramas. In Proceedings of the ) the International Conference on Computer Vision (ICCV2003

Thd

dvvvvd

No

No

i

Ii

Ii

II 2min

1min128

1

22121 )(),(       

パノラマ画像

最近の方法:

出席チェック1

1.対応点同士の相関を判定する方法について、一つの例を挙げて述べなさい(基本考え、式、利点、欠点を含む)

カメラキャリブレーション済みなら

• R,tが既知

• 光軸は平行になるように変換できる

• 2Dシーンから3D復元p

lp

r

P

Ol Or

Xl

Xr

Pl Pr

Zl

Yl

Zr

Yr

R, t

tX’l

Xl’ = T, Yl’ = Xl’xZl, Z’l = Xl’xYl’

立体視の原理と問題点2

もう一つの問題:対応点の探索範囲をどう絞るか?

2眼視の幾何: Two-View Geometry

courtesy of F. Dellaert

x1x’1

x2x’2

x3 x’3

画像間の点(xi to x’i )の対応関係は1)カメラ間の剛体変換(カメラ行列:内部+外部パラメータ)2)シーンの構造により決定

エピポーラ幾何は1)だけに関係がある

Page 5: 立体視Stereo Vision (Stereopsis) 視覚の幾何学2wuhy/CV10.pdf · エピポーラ幾何(Epipolar geometry) 複数の視点における相対的なカメラの位置Tや姿勢R

5

エピポーラ幾何(Epipolar geometry)複数の視点における相対的なカメラの位置Tや姿勢Rの情報をエピポーラ幾何(Epipolar geometry)と呼ばれる画像特有の幾何によって記述できる

O O

もう一方のカメラでは、

画像上のどこに投影されるのか?

エピポーラ幾何(Epipolar Geometry) Baseline: カメラ中心Cと C’を繋がる直線

Epipolar plane : baselineとシーンの中の点Xより決定された平面

from Hartley& Zisserman

baseline

エピポーラ平面

エピポーラライン(Epipolar Lines) Epipolar lines l, l’: epipolar plane と画像面との交線

Epipoles e, e’: baselineと画像面との交点;すべてのEpipolar linesはこの点●に交わる

C C’

from Hartley& Zisserman

エピポーラ平面

ベースライン

Epipolar line

エピポーラライン Epipolar line

Epipoleエピポール

Epipole

http://www.ai.sri.com/~luong/research/Meta3DViewer/EpipolarGeo.html

Epipolar Pencil シーンの中の点X の位置↑を変化すると、

epipolar planes はbaselineの周りに“rotate”• このような平面集合を epipolar pencilと呼ぶ

Epipolar lines はepipole から“radiate”• これは pencil of epipolar linesと呼ぶ

from Hartley& Zisserman

epipolar pencilエピポーラペンシール

pencil of epipolar lines

Why is Epipolar Constraint useful? エピボラ幾何より、片方の画像内の一点は必ずもう一方の画像内のエピポーラ直線(1D)上存在

探索は2次元から1次元に絞られる

O O

エピポール エピポール

エピポーラ線

エピポーラ拘束

一点

Epipolar constraintThis is useful because it reduces the correspondence problem to a 1D search along an epipolar line.

Image from Andrew Zisserman Slide credit: Kristen Grauman

Page 6: 立体視Stereo Vision (Stereopsis) 視覚の幾何学2wuhy/CV10.pdf · エピポーラ幾何(Epipolar geometry) 複数の視点における相対的なカメラの位置Tや姿勢R

6

Epipolar geometry example I: parallel cameras

Epipolar geometry depends only on the relative pose (position and orientation) and internal parameters of the two cameras, i.e. the position

of the camera centres and image planes. It does not depend on the scene structure (3D points external to the camera).

Cross-correlation of neighbourhood regions

epipolarline

translate so that mean is zero

left image band

right image band1

0

0.5

x

target region (Good Feature Point)

left image band

right image band

1

0

x

0.5

target region(Bad Feature Point)

例:Epipolar Lines for Converging Cameras

from Hartley & ZissermanLeft view Right view

epipolar linesの交線 = Epipole !他方のカメラ中心の位置を表すロボット・カメラの移動軌跡の推定

Note, epipolar lines are in general not parallel

特例: Translation Parallel to Image Plane

カメラの運動が画像面と平行する場合、・epipolar linesは平行(エピポールは無限遠)・対応点は対応 epipolar line上に存在 (全種類のカメラ運動)

Page 7: 立体視Stereo Vision (Stereopsis) 視覚の幾何学2wuhy/CV10.pdf · エピポーラ幾何(Epipolar geometry) 複数の視点における相対的なカメラの位置Tや姿勢R

7

特例: Translation along Optical Axis

カメラの運動が画像平面と垂直:

Epipolesはfocus延長線上に一致

一般的に、無限遠点と異なる

e

e’

ステレオから3眼視へ

エピポーラ幾何より、片方の画像内の一点はかならずもう一方の画像内のエピポーラライン(1D)上存在

C C’x’

対応付け:

左側の画像上の1点

右側の画像上の一本の直線

点直線

曖昧性が残っている

一点

Transfer: epipolar transfer

Using more cameras to remove match ambiguity

点点

点直線点直線

3眼視

Multi-Camera

41

自由視点画像系列

42

Page 8: 立体視Stereo Vision (Stereopsis) 視覚の幾何学2wuhy/CV10.pdf · エピポーラ幾何(Epipolar geometry) 複数の視点における相対的なカメラの位置Tや姿勢R

8

出席チェック2

1.エピポーラ幾何の原理図を描き、その原理について述べなさい

透視カメラのエピポーラ幾何

複数のカメラ間の関係や対象物との関係を考えるために、何か基準となる座標系を考えなければならない(各カメラの座標系を元に考えるのではない)

全てのカメラや対象物に対して共通に決められた座標のことをワールド座標(world coordinates)と呼ぶ(ワールド座標を一つ決める)

ワールド座標を基準に考えなければならない

Coordinate Transformations座標変換

If we want to measure something (size of an object, depth of image points, distance between features……), we need to understand the geometry from image to world Coordinate system transformations

• Image (i) camera (c) world (w) object (o)

xc

zc

yc yi

xi

xw

zw

yw

OcOi Ow

Oo

行列・ベクトルの外積(数学の準備)

babbac

ba

0

0

0

;

12

13

23

1221

3113

2332

3

2

1

3

2

1

aa

aa

aa

baba

baba

baba

b

b

b

a

a

a

 

0

0

b)(ab

b)(aa

ba トしているのでは一つの平面をサポーと

θ

c

a

b

:外積のベクトル

幾何変換Geometric transformation

 変換あり

 変換なし

同次座標系で表現:

] with

]0| with

t|[RE'pE'p'

[IEEpp

tRpp'

基本行列 (Essential matrix) 2カメラ間の姿勢と位置:

• R : 3*3 rotation matrix

• t : 3*1 translation vector

pとp’が対応点同士なら:

即ち:同一平面内の三つのベクトルから二つのベクトルの外積と残るもう一つのベクトルの内積は0となる

エピポーラ方程式 自由度が5:

基本行列(E行列) 回転3+(並進3-スケール1)

前提: pとp’は画像座標から計算された物理(カメラ)座標である

(カメラの内部パラメータ既知)

T

T

yx

yx

)1,','('

)1,,( with 0)](['

p

pRptp

RtE

Epp'

with

0

Page 9: 立体視Stereo Vision (Stereopsis) 視覚の幾何学2wuhy/CV10.pdf · エピポーラ幾何(Epipolar geometry) 複数の視点における相対的なカメラの位置Tや姿勢R

9

基本行列 (Essential matrix)エピポーラ方程式 自由度が5:

基本行列(E行列) 回転3+並進3-スケール1

★ Eはランク落ちが発生!→rank(E)=2→等値非ゼロの固有値が二つ存在★ Eが求まれば、tとRに分解することができるRはフルランク自由度は3 → tの自由度は2

T

T

yx

yx

)1,','('

)1,,( with 0)](['

p

pRptp

RtE

Epp'

with

0

babba

0

0

0

12

13

23

aa

aa

aa

自由度が5:

出席チェック3

E行列の自由度は?理由は?