• 沒有找到結果。

用於崁入虛擬物體於影像序列中的擴充實境技術

N/A
N/A
Protected

Academic year: 2021

Share "用於崁入虛擬物體於影像序列中的擴充實境技術"

Copied!
6
0
0

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

全文

(1)

行政院國家科學委員會補助專題研究計畫成果報告

※※※※※※※※※※※※※※※※※※※※※※※※※

※ ※

※ 用於崁入虛擬物體於影像序列中的擴充實境技術  ※

※       ※

※※※※※※※※※※※※※※※※※※※※※※※※※

計畫類別:■個別型計畫  □整合型計畫

計畫編號:NSC 89-2213-E-009-093-

執行期間: 88 年 8 月 1 日至 89 年 7 月 31 日

計畫主持人:陳 稔 國立交通大學資工系教授

共同主持人:賈叢林 中正理工學院電機系教授

本成果報告包括以下應繳交之附件:

□赴國外出差或研習心得報告一份

□赴大陸地區出差或研習心得報告一份

□出席國際學術會議心得報告及發表之論文各一份

□國際合作研究計畫國外研究報告書一份

執行單位:交通大學資訊工程學系

中 華 民 國 八十九 年 九 月 十 日

(2)

行政院國家科學委員會專題研究計畫成果報告

用於崁入虛擬物體於影像序列中的擴充實境技術

Calibr ation-Fr ee Augmented Reality For Embedding Vir tual

Objects In A Real Image Sequence

計畫編號:NSC 89-2213-E-009-093

執行期限:88 年 8 月 1 日至 89 年 7 月 31 日

主持人:陳稔 國立交通大學資工系教授

協同主持人:賈叢林 中正理工學院電機系教授

E-mail:

zchen@csie.nctu.edutw

Tel:03-5731875

一、中文摘要 本計畫在一段現有影片中崁入一件物品(稱 虛擬物體),而使這融合後的影片如同原先就有該 件物品存在而拍的。我們所發展之技術不同以往 之處是我們不必假設攝影機在拍攝影片時已將相 機在影片中的場景位置設定好,而事後要崁入的人 或物亦先規劃好其位置,然後再做崁合工作。另外, 我們也不限制相機的投影公式是某種近似公式(如 affine projection)。 為了逼真地將虛擬物體擺設到真實影像中, 我們必須解決(一)空間的一致性(二)物理特性的一 致性及(三)真實場景和虛擬物體的互動三個問 題。 在本計畫中,使用者能手拿攝影機拍一段影 片回來後,便可以將虛擬物體放置到影片中。因為 最後輸出的結果為 2D 影像,而空間一致性的要求 並不須要計算出物體的 Euclidean space 3D 才有辦 法達成,只要知道物體間次序(ordering)關係,便可 以將虛擬物體正確的擺設到真實場景中,進而可以 做 重 行 投 影 。 因 此 , 我 們 提 出 利 用 投 影 幾 何 (Projective geometry),計算出實際場景在 projective space 下的三維座標,在此空間下,物體間的長度,角 度,比例,平行性會失真,但次序是不變的,再利用 epipolar geometry 及物體 rigidity 的 constraints 便可 將虛擬物體擺設到所要崁入的影像中,進而計算出 虛擬物體在 projective space 中的座標。如此,在其 他影像中,只要計算出虛擬物體應投影的地方,並 且計算此區域的 projective depth,比較虛擬物體和 真 實 場 景 間 的 depth 關 係 , 便 可 以 解 決 遮 蔽 (Occlusion)的問題。 關鍵詞:虛擬實境;影像三維資訊重建技術;虛擬物 體的擺設;遮蔽問體。 Abstr act

This project attempts to merge a 3D virtual object in an image sequence. The resultant augmented virtual object will look so natural that its appearance in the scene is seamless. Our method is different from

the existing methods in the literature in several aspects. First, we do not assume that the camera position in the scene is known in advance and that the position where the virtual object is to be placed is prearranged. Next, no approximate projection model of the camera such as an orthographic or affine one is assumed. Thus, our method is easy to use and it yields a more precise result.

For a realistic augmented reality result we shall consider three issues: (1) the spatial consistency, (2) the physical consistency, and (3) the interaction between the real scene and the virtual object.

In this project we plan to shot some outdoor or indoor scenes with a hand-held video recorder for a later combining of a virtual object which is constructed by a vision based technique with a photo-realistic texture. The final output is the augmented 2D scene images, so we do not need to use the Euclidean geometry to model the virtual object and real scene. Instead, we will work in the projective space, since we do not assume a calibrated camera. To begin with, we arrange a proper placement of the virtual object in two selected scene images using the epipolar and rigidity constraints and then derive the projective coordinates of the virtual object with respect to the scene. To solve the occlusion problem, we need to compute the projective depth of the part of the scene, which is overlapped with the virtual object, and compare the depth ordering between the scene and the virtual object.

Keywor ds: Virtual reality, Object placement,

Occlusion. 二、緣由與目的 擴充實境(Augmented reality)[1]技術在探討 如何將電腦圖學技術展現的影像逼真地崁入到實 際拍攝到的影像中,以供人們觀看。利用此一技術, 我們可以將不存在的物體,或一般看不到的東西, 加入所拍攝的影像中,如此可以豐富我們視覺資訊 的接受。最常看到 Augmented reality 的展現,就屬 影片工業,其稱為特效(Special effects)。從影片中,

(3)

我們可以看到慧星逼真的撞到地球,看到恐龍再度 復活,看到許許多多不存在的景物。但這些效果是 要花許多人力物力慢慢的兜出來的。 為了逼真地將虛擬物體擺設到真實影像中, 我們必須解決(一)空間的一致性(二)物理特性的一 致性及(三)真實場景和虛擬物體的互動三個問 題。第一個問題在於如何將物體擺設進去而不會 有懸空,穿透別的真實物體,遮蔽的問題。其次則是 在於打光的效果,重力的影響等等。最後則是碰撞 等等的效果。而現今的研究重點多在如何達成空 間一致性上。 目前國外有許多大學研究機構正致力研究 Augmented reality 並將其應用在不同領域上。在 MIT AI Lab[1], GE[1],及 UNC Chapel Hill[1],他們 將此一技術應用在醫療診斷輔助上,整合 CT,MRI, 超音波影像,醫生藉由 see-through HMD 可以同時 看到患者身上腫瘤,胎兒的位置,避免一邊聽診一 邊看照片的不便。在哥倫比亞大學[1],波音公司[1] 則是利用 Augmented reality 來協助做機器的組裝 及檢修。法國 INRIA[4]-[9]利用 Augmented reality 來做河邊,橋上燈光擺設的模擬。其他研究單位還 有 CMU Robotics institute[3],及國內中研院[10]在 做此相關研究。 前述的單位研究的方法多著重在校正好的相 機,才能有效的將虛擬物體擺設到真實影像中,然 在現實應用中,相機校正的工作常是煩雜的且不易 做 的 。 而 在 Rochester 大 學 的 K. N. Kutulakos[11][12],試著將要相機校正工作的限制 拿掉,他們假設相機投影模型為平行投影[15],因此 利用兩張影像,可以建構出實際場景在 affine space 下的三維座標。而藉由操作者指定虛擬物體在二 張影像的成像,可以計算出虛擬物體在此 affine space 的位置,如此可以逼真的將物體擺設到其他 的影像中。然因其假設相機投影模型為平行投影, 為一 approximation model,因此所計算出的三維資 訊只能接近真實的,如此會影響電腦產生影像和實 際拍攝影像的合成。 在本計畫中,我們希望使用者能手拿攝影機 拍一段影片回來後,便可以將虛擬物體放置到影片 中。因為最後輸出的結果為 2D 影像,而空間一致 性的要求並不須要計算出物體的 Euclidean space 3D 才有辦法達成,只要知道物體間次序(ordering) 關係,便可以將虛擬物體正確的擺設到真實場景中, 進而可以做重行投影。因此,我們提出利用投影幾 何[16]-[28](Projective geometry),便於計算出實際 場景在 projective space 下的三維座標,在此空間下, 物體間的長度,角度,比例,平行性會失真,但次序是 不變的,再利用 epipolar geometry 及物體 rigidity 的 constraints 便可將虛擬物體擺設到所要崁入的影像 中,進而計算出虛擬物體在 projective space 中的座 標。如此,在其他影像中,只要計算出虛擬物體應投 影的地方,並且計算此區域的 projective depth,比較 虛擬物體和真實場景間的 depth 關係,便可以解決 遮蔽(Occlusion)的問題。 三、研究方法與成果 本 計 畫 將 採 用 電 腦 視 覺 技 術 來 解 決 Augmented reality 中 虛 擬 物 體 的 擺 設 (Object placement)及遮蔽(Occlusion)二個問題。而要處理 上述二個問題,首先,我們必須能夠估測出現實場 景的三維資訊,如此,才能指定虛擬物體要擺設在 真實場景中的那個位置。在知道虛擬物體和真實 場景的空間關係後,我們便能計算出虛擬物體和在 真實場景所拍得的影像間的投影關係,如此便能將 虛擬物體正確的投影在每一張影像中。而也因為 知道虛擬物體和真實場景的空間關係,便可以用其 間的景深關係來解決遮蔽問題。比較細節的方法 及進行步驟如下: 步驟一: 影像三維資訊重建技術 我們擬採用投影幾何(Projective geometry)原理, 發展出一套未校正相機三維場景重建的技術。其 所牽涉到的工作有: 1. 影像中立體匹配(Stereo matching)的建立:由 於影像的擷取是來自於連續的拍攝,因此若相 機移動的速度不會很快,則兩張影像間的差異 不會很大。我們偵測影像中基本的特徵,如角 點(Corner),利用 correlation 方法,輔以空間關 係,找出兩張影像間的點對應。 2. 兩張影像間投影幾何關係的推導:在兩張影 像 間 , 會 存 在 一 個 3x3 的 矩 陣 , 稱 之 為 Fundamental matrix, F。此一關係即為此二張 影 像 及 其 所 對 應 之 三 維 場 景 的 epipolar geometry。 3. 分 解 Fundamental matrix 為 二 個 投 影 矩 陣 (Projection matrix),P1及 P2:Fundamental matrix

是由兩張影像的投影矩陣所合成。因此我們 以第一張影像(二張影像選一即可)為參考座 標,設定其投影矩陣 P1 為[I|0]3x4,則由 F 便可 以分解出另一張影像的投影矩陣。而此二個 投影矩陣分別為二張影像中,以第一張影像所 定義出的參考投影空間(Projective space)的投 影矩陣,其和 Euclidean space 中的投影矩陣將 會相差一個轉換矩陣。 4. 投影空間中場景三維座標的估測:在得到兩 張影像的投影矩陣後,只要給定兩張影像中的 任一對點對應,利用三角定位方式,便可鎖定 影像點對應在投影空間的三維點座標。 步驟二: 虛擬物體的擺設 欲將虛擬物體擺設到所有拍攝得的真實影像中, 若是採用人工一張張的去調整修飾將是很煩雜 的工作。我們發展出一套物件擺設的工具,協助 使用者將虛擬物體擺設到其所選取的兩張影像 中。透過之前談到的未校正相機三維場景重建技 術,可以決定虛擬物體要落在真實場景中的那一 個位置,以及其和其他實際物體的空間關係,如此, 虛擬物體在其他影像的投影便可以藉由此影像 和參考影像之間的 Fundamental matrix 關係,自動 的產生出來。為協助使用者方便的擺設物體到影 像中,我們完成下列工作: 1. 發展一套快速的 3D 投影程式。此系統允許使 用者調整虛擬物體投影中的虛擬相機參數,並

(4)

將其疊合在真實影像中。使用者可以即時的 看到虛擬物體在影像上的可能投影,並選擇一 個其所認為最像的樣子。

2. 引入 epipolar geometry 及 rigidity constraints 到 第二張影像的擺設工作中:當我們決定物體 在第一張影像的成像後,便利用兩張影像間的 epipolar geometry constraint,使虛擬物體上各 點座標在第二張影像的投影被限制在其對應 的 epipolar line 上,以加快使用者決定虛擬物 體在第二張的投影。 3. 由 物 體 在 二 張 影 像 的 投 影 , 決 定 其 在 Projective space 的三維位置。 步驟三: 遮蔽(Occlusion)問題的解決 在得知虛擬物體在以某張影像為參考影像所定 義出的 Projective space 三維座標後,其他影像便 可 以 和 此 一 張 參 考 影 像 做 關 連 , 找 出 其 間 的 Fundamental matrix,並設定參考影像的投影矩陣 為[I|0]3x4。如此,另一個求得的投影矩陣均是在同 一個 Projective space 中,也因此,我們可以將之前 算出的虛擬物體 Projective space 的三維座標重 新投影,而獲得其在真實影像的成像。再根據這 部份真實及虛擬物體相重疊地方,計算此區域真 實影像所對應的三維點座標,並將這些點座標的 景深和虛擬物體相比,便可判斷出誰在前,誰在後, 解決了遮蔽的問題。 在實作過程中,為了簡化整個擴充實境系統 之操作流程,我們提供一個目前在視窗作業系統 下,常見之精靈模式,透過我們的AR操作精靈, 使用者只需一步步依據畫面所顯示之指示進行, 便能完成整個擴充實境之程序。在擺設物體進入 第一張影像之即時繪製虛擬物體畫面,我們先透 過 OpenGL 函式庫繪製影像於精靈畫面中,再將 此結果疊合於第一張影像之上,讓使用者觀看其 擺設之整體效果。 圖 1 至圖 4 是我們將檯燈擺進真實畫面中的 結果圖。圖 5 至圖 8 為我們將一磁片盒擺進真實 畫面中的結果圖,其中物體繪製方面包含了該磁 片盒表面的材質資料,使得繪製出來的效果更逼 真,而在光源方面,我們也透過光源設定,來儘 量符合真實場景中之情形,最後並依據所設定之 光源資訊及虛擬物體(磁片盒)所在平面,而繪 製出磁片盒在桌面上的陰影圖,如此,整個完成 的最後結果圖。圖 9 至圖 12 為多重擺設之結果 圖,透過我們的擴充實境系統,將一奶粉罐接著 擺設進入先前已經擺設磁碟盒的影像中,其中會 發生遮蔽問題,經由我們遮蔽演算法自動加以處 理之後,正確地決定出前後遮蔽的關係。 四、結論 在本計劃中,我們採用電腦視覺技術來解決 Augmented Reality 中 虛 擬 物 體 的 擺 設 (Object Placement)及遮蔽(Occlusion)二個問題。首先,我們 透過虛擬物體之擺設程序,計算出虛擬物體和影 像中真實場景間的關係,之後,透過未校正相機 重建技術計算出來的影像之投影矩陣,便能將虛 擬物體正確的投影在每一張影像中。而也因為知 道虛擬物體和真實場景的空間關係,便可以用其間 的景深關係來解決遮蔽問題。 五、參考文獻

[1] R. Azuma, “A Survey of Augmented Reality”, Presence: Tele-operation and Virtual Environment, vol. 6, no. 4, 355-385, Aug. 1997.

[2] P. Jancene, et al., “RES: computing the interactions between real and virtual objects in video sequences”, Proceedings of Networked Realities Conference, 1995.

[3] Takeo Kanade, et al., “Video-Rate Z Keying: A New Method for Merging Image for Merging Images”, Technical Report 95-38, The Robotics Institute in CMU, 1995.

[4] M.-O. Berger. G. Simon, S. Petitjean and B. Wrobel-Dautcourt, “Mixing Synthesis and Video Images of Outdoor Environments: Application to the Bridges of Paris”, Proceedings of the 13th ICPR, 90-94, Vienna, 1996.

[5] M.-O. Berger and G. Simon. “Robust Image Composition Algorithms for Augmented Reality”, Proc. of the 3rd ACCV, Hong Kong. [6] M.-O. Berger. “Resolving Occlusion in

Augmented Reality: a Contour Based Approach without 3D Reconstruction”, Proc. of CVPR’97, 91-96, Puerto Rico, USA, 1997. [7] G. Simon and M.-O. Berger, “A two-stage

robust statistical method for temporal registration from features of various type”, Proc. of ICCV, 261-266, Bombay, India, 1998.

[8] E. Boyer and M.-O. Berger, “Smooth Surface Reconstruction from Image Sequences”, Proc. of ICIP’95, Washington, 1995.

[9] G. Simon, V. Lepetit and M.-O.Berger, “Computer Vision Methods for Registration: Mixing 3D Knowledge and 2D Correspondences for Accurate Image Composition”, International Workshop on Augmented Reality, San Francisco, 1998. [10] Chu-Song Chen, et al., "Integrating Virtual

Objects into Real Images for Augmented Reality", ACM Symposium on Virtual Reality Software and Technology, Taipei, November 1998.

[11] K. N. Kutulakos, J. R. Vallino, “Calibration-Free Augmented Reality”, IEEE Transactions on Visualization and Computer Graphics, vol. 4, no. 1, 1-19, 1998.

[12] K. N. Kutulakos and J. R. Vallino, “Affine Object Representations for Calibration-Free Augmented Reality”, Proceedings of 1996 IEEE Virtual Reality Annual International Symposium, 25-36.

[13] C. Chevier, “Handling Interactions between Real and Virtual Worlds”, Computer Graphics

(5)

International.

[14] S. Feiner, B. MacIntyre, T. Hollerer, “A Touring Machine: Prototyping 3D Mobile Augmented Reality Systems for Exploring the Urban Environment”, Proceedings of ISWC’97, pp. 74-81, Cambridge, MA, Oct. 13-14, 1997.

[15] Jan J. Koenderink and Andrea J. van Doorn, “Affine structure from motion,” J. Opt. Soc. Am. A., Vol. 8, No. 2, pp. 377-385, Feb. 1991.

[16] Roger Mohr and Emmanuel Arbogast, “It can be done without camera calibration,” Pattern Recognition Letters, Vol. 12, No. 1, pp. 39-43, Jan. 1991.

[17] R. Szeliski, “Video Mosaics for Virtual Environments,” IEEE Computer Graphics and Applications, Vol. 6, pp. 22-30, Mar. 1996. [18] T. Moons, L. Van Gool, M. Proesmans, and E.

Pauwels, “Affine Reconstruction from Perspective Image Pairs with a Relative Object-Camera Translation in Between,” IEEE Tran. PAMI, vol. 18, no. 1, pp. 77-82, Jan. 1996.

[19] Q. T. Luong and T. Vieville, “Canonic Representations for the Geometries of Multiple Projective Views,” in ECCV’94, pp. 589-599, 1994.

[20] O. D. Faugeras, “What can be seen in three dimensions with an uncalibrated stereo rig?” in ECCV’92, pp. 563-578, 1992.

[21] O. D. Faugeras and Luc Robert, “What can

two images tell us about a third one?” International Journal of Computer Vision, 18, pp. 5-19, 1996.

[22] Q. T. Luong and O. D. Faugeras, “A stability analysis of the fundamental matrix,” in Proceeding of ECCV’94, pp. 577-588, 1994. [23] Zhengyou Zhang et al., “A robust technique

for matching two uncalibrated inages through the recovery of the unknown epipolar geometry,” Artificial Intelligence, 78, pp.87-119, 1995.

[24] A. Shashua, “Projective Structure from Uncalibrated Images: Structure from Motion and Recognition,” IEEE Tran. PAMI, Vol. 16, No. 8, pp.778-790, Aug. 1994.

[25] A. Shashua, “Projective Depth: A Geometric Invariant For 3D Reconstruction From Two Perspective/Orthographic Views For Visual Recognition,” in Proc. of Fourth ICCV, pp. 583-590.

[26] R. Hartley and R. Gupta, “Computing Matched-epipolar Projections,” in Proceeding of IEEE Conf. On CVPR, pp. 549-555, 1993. [27] R. Hartley, “Projective Reconstruction an

Invariants from Multiple Images,” IEEE Tran. PAMI, vol. 16, no. 10, pp. 1036-1041, Oct. 1994.

[28] R. Hartley, “Euclidean Reconstruction from Uncalibrated Views,” Application of Invariance in Computer Vision, pp. 237-256, 1994.

圖 1 擺設檯燈進入影像結果Ⅰ

圖 2 擺設檯燈進入影像結果Ⅱ

(6)

圖 5 擺設磁片盒進入影像結果Ⅰ

圖 6 擺設磁片盒進入影像結果Ⅱ

圖 7 擺設磁片盒進入影像結果Ⅲ

圖 8 擺設磁片盒進入影像結果Ⅳ

圖 9 繼續擺奶粉罐進入影像結果Ⅰ

圖 10 繼續擺奶粉罐進入影像結果Ⅱ

數據

圖 1  擺設檯燈進入影像結果Ⅰ 圖 2  擺設檯燈進入影像結果Ⅱ
圖 5  擺設磁片盒進入影像結果Ⅰ 圖 6  擺設磁片盒進入影像結果Ⅱ

參考文獻

相關文件

Each of the chapters begin with the primary objective of the Zen school and then goes on to analyze the failings of the contemporary Zen schools. The treatise puts forth the view

After lots of tests, we record two players’ winning probabilities and average number of rounds to figure out mathematical principles behind the problems and derive general formulas

Reading Task 6: Genre Structure and Language Features. • Now let’s look at how language features (e.g. sentence patterns) are connected to the structure

 Promote project learning, mathematical modeling, and problem-based learning to strengthen the ability to integrate and apply knowledge and skills, and make. calculated

Wang, Solving pseudomonotone variational inequalities and pseudocon- vex optimization problems using the projection neural network, IEEE Transactions on Neural Networks 17

Then, we tested the influence of θ for the rate of convergence of Algorithm 4.1, by using this algorithm with α = 15 and four different θ to solve a test ex- ample generated as

Using this formalism we derive an exact differential equation for the partition function of two-dimensional gravity as a function of the string coupling constant that governs the

Define instead the imaginary.. potential, magnetic field, lattice…) Dirac-BdG Hamiltonian:. with small, and matrix