2012年9月14日 星期五

擴增實境 - A simple Augmented Reality demo


A simple Augmented Reality demo

最近研究了一個有趣的主題 : Augmented Reality ; AR, 中文翻譯為 擴增實境. 並且用目前的研究心得寫了一個簡單的 demo program.

這是一個 使用 marker 的 AR demo program. 其原理是使用 webcam 抓取影像, 對影像做 marker detection, 根據四邊形的 marker 在 2D image 上的形變狀況 推導出 marker 所在之 3D 平面的 3D transform. 然後使用此 3D transform, 在抓取的影像中繪制 3D 物件. 如此, 就把真實的影像 和虛擬的物件融合在一起.


2012年9月8日 星期六

攝像頭校正 camera calibration - part 1 camera model

PART 1 Camera Model


所謂 Camera model 是使用幾何(geometry)的方式描述真實世界中的物體在 camera 影像平面上的成像方式. 本文會說明最基本的 camera model, 也就是針孔攝像頭模型(pinhole camera model). 另外, 使用鏡片(lens)可以增加進入成像平面的單位時間光線總量,因此縮短了曝光所需要的時間, 但是使用lens也造成了影像或多或少產生了畸變(distortions), 因此我們還需要了解 lens distortion model.
有了camera 的 geometry model 以及 lens 的 distortion model 就可以建構完整的 camera 的內部參數(intrinsic parameter),   camera calibration 需要使用到 camera 的內部參數.


2012年9月1日 星期六

Android 建立 surface 的過程


Android 的圖形系統是 Client-Server 架構, Server SurfaceFlinger, Client 則是應用程式.
應用程式第一次執行時, Window Management Service (WMS) 會開啟一個 session, openSession()函式會被調用. openSession()函式在BSP的位置和程式代碼如下:


2012年8月14日 星期二

探討 Android gralloc HAL – part2

gralloc HAL有幾個比較重要的函式, 分別是 gralloc_alloc, gralloc_alloc_buffer,  init_pmem_area,  gralloc_free, 另外, 還有一個class : SimpleBestFitAllocator.
這些函式的程式代碼在

2012年8月2日 星期四

探討 Android gralloc HAL – part 1


整個 Android 2.2的圖型模組, 不論是 2D, 3D應用程式運行, 只要是圖形相關的應用, 都需要配置 graphic buffer, 在 Android 中負責這工作的模組就是 gralloc HAL(gralloc 硬體抽象層).

Gralloc HAL 的程式碼在 /hardware/libhardware/modules/gralloc/Gralloc.cpp
動態連結庫 gralloc.default.so 位置在系統路徑 /system/lib/hw/


2012年8月1日 星期三

Android – screen compatibility mode


工程師的工作不外乎要 debug, 最近又遇到一個 issue.

WVGA(width=800, height=480) 的平台上, 執行應用程式, 該應用程式卻 allocate(width=533, height=320) graphic buffer. 造成畫面內容顯示不正確.