• 沒有找到結果。

CH1 Introduction to 3D Photography 甚麼是

N/A
N/A
Protected

Academic year: 2022

Share "CH1 Introduction to 3D Photography 甚麼是"

Copied!
7
0
0

加載中.... (立即查看全文)

全文

(1)

CH1 Introduction to 3D Photography

甚麼是 3D photography 呢?簡單來說,就是用各種方法取得物體的「形狀

(geometry)」和「材質(material)」,就可以建構出這的物體的 3D 模型(3D model)。

1.1 Range Acquisition

是指得到物體 geometry 的方法總稱。

1.1.1 Range Imaging

Range Imaging是一種常見的方法,泛指在一張 2D 平面圖的每個 pixel 存放

「深度值(depth)」的技術。深度──或者說距離(distance)──是空間中 一特定點,例如我們的眼睛,到物體各點的距離(見圖 1)。從圖學(Graphics) 的術語來說,也可以稱作為 Z-Index Value。

圖 1

圖中的眼就是所謂的「特定點」,中間是我們的投影面,亦即前文所提的「2D 平 面圖」。從眼睛穿過每個 pixel 皆可打出一條射線,射線會命中目標物體的各個 地方。這些 pixel 所存的值就是從眼睛到射線打中點的距離。

多張 Range Image Plane 可以疊合出整個物體的 geometry。

(2)

1.1.2 Range Acquisition的分類:

Range Acquisition

Contact 直 接 以 機 器 探 測

(probing)、超音 波或電磁波等方式 取得 geometry。

是最準確但也最費 時的方法。

Transmissive 用超音波、MRI 等 斷層掃描方式取得 不 同 深 度 的 截 面 圖 , 然 後 再 進 行 volume

rendering,即可得 geometry。

Reflective 利用反射波的方式 得到 geometry。

Optical 光波 配合 Range Image 技 術 建 構

出 物 體 的

geometry。 具體方法說明請見 後續的 scribe

Non-Optical 如雷達、聲納等方法

Passive 只去擷取物體現有 的光學資訊,然後 得到 depth。

Active 主動介入場景,改

變場景的光線配 置,以這種方式得

到 depth。

Active Variants of Passive Methods

Time of Flight Triangulation

(3)

CH2 Passive Approach: Stereo

人的肉眼能感受到物體遠近等空間概念,主要是仰賴左右眼影像交疊。但是一般

2D影像並無法給人左右眼正確而適當的影像,使人產生真實世界的遠近感。一

張正常的影像只是一隻眼睛看到的結果。

立體圖(Stereo Image)把左眼可看到的景象做成藍色,右眼作成紅色,製在 同一張影像,然後當使用者戴上左藍右紅的特殊眼鏡時,左右眼就會看見不同角 度的影像。只要這兩個角度合乎人類的眼距,就會讓人產生在看真實景物的錯覺。

Stereo就是從這樣的概念得來的靈感。

2.1 Get Started

如果我們手上有兩張 Image Plane A & B,目標物體某點 P 在 A 跟 B 對應的點 分別是 X 跟 Y,則只要再利用已知的焦點 O(for A)和 O’(for B)和拍攝角度

(這兩者皆掌控於拍攝者手中),找出 XO 和 YO’的交點,即為 P 在空間(3D)

中的位置。

圖 2

但最大的問題在於如何找出 A B 兩張 Image Plane 中,各自是哪一點對應到空 間中的同一點。以下我們會把 X 跟 Y 稱作對應點(Correspondences),上述 的問題也就成了尋找對應點(Search for correspondences)。

2.2步驟

2.2.1. Camera Calibration

X Y

A B

(4)

2.2.2. Image Rectification

見左圖。O 是焦點,P 是物 體 上 一 點 , π 表 I m age P l an e s。根據 Epipolar Geometry,對應點會在共 軛 ( c o n j u g a t e ) 的 epipolar line上,於是尋找 對應點變成了 1D 的問題,

如此一來便可加快搜尋。

所謂的 Image Rectification 就是適當地扭曲圖片讓共軛的 epipolar line 共線 並且和 u 軸平行(即變成在同一垂直高度的水平線)。

2.2.3. Correspondence 尋找左右兩張圖中的對應點。

我們利用 Disparity 來幫助我們尋找對應點。當我們擁有矯正過的圖片(rectified images)時,因為 epipolar line 已和 u 軸平行,共軛的 epipolar lines 也已在 同一垂直位置,所以 Disparity 可視為兩個對應點的水平位移量,i.e. x – x’,其 中 x 表其中一張 image plane 中對應點的 x 座標,x’表另一張的對應點 x 座標。

Disparity有以下的特性:

a) 對很遠的點(depth 值大)來說,disparity = 0。

b) 比較近的點會有比較大的 disparity c) 點的 depth 值和 disparity 成反比

因為距離比較遠的點,相機的移動對 image plane 上的移動影響較小。如同我 們看很遠的東西,會很難察覺它在移動。

更詳細的過程請見後續的演算法說明。

2.2.4. Reconstruction

用已得到的 2D(image plane)對應點資訊復建出物體的 3D 資訊

兩個對應點跟各自的焦點形成兩條線,其交點就是此點在空間中的實際座標(圖

2)。如果沒有相交,則求一點使得距離兩條線最近,換言之,就是此兩條歪斜線

(oblique lines)公垂線(the line perpendicular to both the oblique lines)

的中點。

2.3 Correspondences)基本演算法

在此我們會把一張 image plane 叫做「左邊的影像(left image)」,另一張叫

「右邊的影像(right image)」。

(5)

因為對應點必落在共軛的 epipolar lines 上,所以我們演算法可以這樣寫:

For each For each For each

For each set of conjugate set of conjugate set of conjugate epipolar lineset of conjugate epipolar lineepipolar lineepipolar linessss

ForForForFor each each each pi each pi pixel pixel xel xel on the epipolar line on the epipolar line on the epipolar line on the epipolar line in the left imagein the left imagein the left imagein the left image

i) i) i) i) compared with compared with compared with compared with every pixelevery pixelevery pixel onevery pixel on on on the conjugate the conjugate the conjugate the conjugate line ( line ( line ( line (in the rightin the rightin the rightin the right)))) iiiiiiii)))) pickpickpick the pixel with pick the pixel with the pixel with the pixel with minimumminimumminimum costminimumcostcost cost

但是只單單用點來判斷,很容易受到 noise 干擾,所以我們改使用 Window。

For each For each For each

For each set of conjugate set of conjugate set of conjugate epipolar lineset of conjugate epipolar lineepipolar lineepipolar linessss

ForForForFor each each each pi each pi pixel pixel xel xel on the epipolar line on the epipolar line on the epipolar line on the epipolar line in the left imagein the left imagein the left imagein the left image i) i) i) i) for each for each for each for each disdisdisparitydisparityparityparity

for each pixelfor each pixel in the windowfor each pixelfor each pixel in the window in the window in the window, compute difference, compute difference, compute difference , compute difference iiiiiiii)))) findfindfind the find the the the disparitydisparitydisparity with disparity with with with minimumminimumminimum SSDminimumSSDSSD SSD

其中 disparity 就是前文曾提到的 x-x’。

另外 SSD 是指差方和(sum of squared difference),也就是對每個 disparity 的 window 中所有對應點差值平方的總和。平方的意義在於消除負值。

另外我們可以改變一下迴圈的內外圈次序:

For each For each For each

For each set of conjugate set of conjugate set of conjugate epipolar lineset of conjugate epipolar lineepipolar lineepipolar linessss i) i) i) i) for each for each for each disfor each disdisdisparityparityparity parity

ForForForFor each each each pi each pi pi pixel xel xel xel on the epipolar line on the epipolar line on the epipolar line on the epipolar line in the left imagein the left imagein the left imagein the left image for each pixelfor each pixel in the windowfor each pixelfor each pixel in the window in the window in the window, compute difference, compute difference, compute difference , compute difference iiiiiiii)))) findfindfindfind the the the disparity the disparitydisparitydisparity with with with minimum with minimumminimumminimum SSDSSDSSDSSD atatat each pixelat each pixel each pixel each pixel

注意「find the disparity with minimum SSD」後面多了「at each pixel」,而 且是包在「for each line」迴圈這層,和「for each disparity」迴圈平行。

而這樣改變得以加快的原因是 Window間彼此會重疊,而左右兩張圖的 window 同時移動,就只需要重新計算多的部分和少掉的部分。已經計算過的差值就不用 再計算一次。

原本:5x5 格都要重算差值 後來:中間 4x5 格可以不用重算

next loop

next loop

(6)

Window size是要密切觀察的參數。過小,則細節充分卻太多 noise;過大,則 充分穩固卻太少細節。另外,除了方框形的 Window,也有圓形等變體的用法,

例如 Gaussian。

2.4 Correspondences的進階演算法

在開始之前,我們要先介紹 Ordering Constraint 的概念。

在左右兩張圖上,物體 feature point 的次序通常是一樣的,舉例來說,照片 A 拍人的右前側,則照片裡由左而右是右眼、鼻子和左眼;照片 B 拍人的左前側,

那麼這三者由左而右的次序理當是相同 的。這就稱作「Ordering Constraint」。

然而,Ordering Constraint 並非必然 的結果。

右圖是一種 occlusion,顯示了 b 跟 d 兩個 feature points 在左右兩張 image plane中的次序不相同,不合乎

Ordering Constraint。

2.4.1. Dynamic Programming(要合乎 Ordering Constraint)

我們可以把共軛的 epipolar lines 上,左邊 image plane的點依序編號作 row,右邊的當 column,如右圖。Edge cost 定為 similarity of regions between image features。

然後我們就可以把我們的問題轉換成典型的圖 論問題:從左上角走到右下角,只能走→、↘、

↓三個方向,求 min-cost path。這是個 DP 問題。

最後的結果可能是這樣:

這表示左圖的 1 號點和右圖的 2 號點是對 應點,左圖的 2、3 和右圖的 2 是對應點,

依此類推。

(7)

2.4.2.

參考文獻

相關文件

[r]

臺中市別名「文化城」。清朝之前,為平埔族群巴則海族

2.教師總結:我們在開始對自己感謝的時候,體驗到滿 足與珍惜,原來我們擁有這麼多。在感謝自己的身體

一開始,老師先教我們認識 器材,後來就讓我們自己拍 照。我覺得拍蚜蟲的照片很 好玩,因為蚜蟲本來只有一

利用 determinant 我 們可以判斷一個 square matrix 是否為 invertible, 也可幫助我們找到一個 invertible matrix 的 inverse, 甚至將聯立方成組的解寫下.

我們已經了解在已知各 statement 的對錯情況之下它們用 connective 以及 not 連接之 後其對錯的狀況, 我們也知道一個 statement form 的否定為何.. 不過一個單一的

使用 BibTEX 的 L A TEX 文件, 編譯過程有時有點讓人困惑。我們這裡假設以 foo.tex 為我們的 L A TEX 檔 (BibTEX 檔叫什麼無妨, 只要我們在文中引用

[r]