發表文章

ARToolkit官方文件閱讀筆記[2]: How does ARToolKit work?

原文 How does ARToolKit work? 筆記 Table 1 shows some typical maximum ranges for square markers of different sizes. These results were gathered by making maker patterns of a range of different sizes (length on a side), placing them perpendicular to the camera and moving the camera back until the virtual objects on the squares disappeared. Pattern Size (inches) Usable Range (inches) 2.75 16 3.50 25 4.25 34 7.37 50 Table 1: Tracking range for different sized patterns. The simpler the pattern the better. Patterns with large black and white regions (i.e. low frequency patterns) are the most effective. Replacing the 4.25 inch square pattern used above, with a pattern of the same size but much more complexity, reduced the tracking range from 34 to 15 inches.

ARToolkit官方文件閱讀筆記[1]: 第一個範例

原文 Your First ARToolKit Example 筆記  In each platform you have generally two choices: click on the program from your OS explorer or starting from the command line: the last choice is better since it give you the error and standard output stream (and ARToolKit used it a lot). In this video dialog you can change the output size of the video or the video format acquired from the camera. You need to notice that better the format is similar to ARToolKit tracking format, faster is the acquisition (RGB more efficient). In some camera driver you can also change the frame rate. By default this dialog is associate to your first video input so you can have some problems (see the FAQ ). If you hit the "t" key on the keyboard you will be prompted to enter a new threshold value. This should be a value between 0 and 255; the default is 100. Hitting the "d" key will show the thresholded video image below the main video window . Possible tracking patterns found in the input...

Open Scene Graph 的動畫功能?

第二篇Open Scene Graph 的文章就要來宣告暫時停止投入osg的研究了。停止是因為我想做的東西必須要能夠運行骨骼(骨架)動畫,尤其是要能夠運行從3ds max bipe輸出的動畫,但我後來發現幾個事實讓我覺得osg的骨架動畫開發之路可能會非常顛仆,(1)骨架動畫的功能是最近這一版(7.28)才剛加上 OpenSceneGraph 2.8.2 release - bug/build fix release ,可能還需要許多修改;內建的骨架動畫範例用viewer跑不出效果,看來不是預設就能夠運行 (2) 目前似乎不支援從3ds max輸出的骨架動畫,對岸有高手說他正在寫相關的外掛 (3) 對於新骨架動畫功能的討論非常很少,一支手指可以數得出來 基於這些考量,我還是先停下深入研究osg的腳步,再找找看有沒其他更適合的engine

安裝Open Scene Graph

圖片
在網路上找到這篇寫得很仔細的安裝步驟說明文章 Installing OpenSceneGraph 2.8.0 ,我照著步驟做,結果"大致上是成功的",step狀況紀錄如下: (2). 官方的檔案有點難下載,有時下載一半就會斷掉 (6). 解開release版本以後,複製底下的資料夾,蓋到debug資料夾上面。事實上不會有檔案會被蓋到,因為debug版的檔名和release版的都不一樣 (9). 這個指令呼叫的是release版的程式 (10). 最後開始測試,順利開啟"T1000牛"! 以下開始設定Visual Studio (2).  照著各步驟做完以後,找到code來測試,編譯時發現要貼上的osgGA a .lib、osgGA a d.lib怎麼都會多了一個「a」,把a移除之後,release可以正常編譯和執行出結果 所謂的"大致上是成功的"的意思是發現編譯和執行debug版時,編譯可以成功,但執行的時候會發生錯誤,程式說有記憶體問題,接著自動關閉,編譯時錯誤訊息如下: 「LDR: LdrpWalkImportDescriptor() failed to probe C:\Program Files\OpenSceneGraph-2.8.0\bin\osg55-osgd.dll for its manifest, ntstatus 0xc0150002...」 新手我當作沒看到這個訊息。

手動關閉Alert組件的方法

正常關閉Alert組件的方法是在介面上按下是、否、取消的按鈕後即自動關閉,並且可以指定觸發的處理事件。 但實際使用時發現,Alert本身並沒有提供關閉視窗的方法,如果要經由程式來關閉Alert的話,可以使用PopupManager提供的方法。 import mx.managers.PopUpManager; var alert : Alert = Alert.show( message ); PopUpManager.removePopUp( alert );

在AIR中偵測使用者是否閒置的方法

AIR API預設上就支援這個功能了。NativeApplication.nativeApplication.timeSinceLastUserInput值可以取得目前閒置的時間。 private function init():void{ NativeApplication.nativeApplication.idleThreshold = 10; // 設定閒置通知的秒數 NativeApplication.nativeApplication.addEventListener(Event.USER_IDLE , onUserIdle ) ; NativeApplication.nativeApplication.addEventListener(Event.USER_PRESENT , onUserIdle ) ; } private function onUserIdle( event:Event ):void{ if(event.type == Event.USER_IDLE){ // 閒置 }else if(event.type == Event.USER_IDLE){ // 回復使用 } } 可是似乎沒有提供方法可以立刻中斷或reset閒置時間,不管是重設idleThreshold或者removeListener都不行。 idleThreshold 是用來設定「閒置通知事件」的發出時間點,但不管有沒有註冊監聽的事件,timeSinceLastUserInput的值是永遠都啟動、並且持續計算的。

Flex最底層的Application是一個Singleton Class

因此在app的任一個子物件中,用Application.application就可以access到最底層的屬性和物件了。換句話說,最底層的(public的)屬性和物件都是全域的,用一個最簡單的範例做demo。 主程式裡面有一個數字,可以按主程式的按鈕去累加。 main.mxml <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" xmlns:comp="comp.*"> <mx:Script> <![CDATA[ [Bindable] public var counter:int = 0; ]]> </mx:Script> <mx:Label text="'counter' property in flex app root:" /> <mx:Label text="{counter}" /> <mx:HBox> <mx:Label text="access 'counter' from root:" /> <mx:Button mouseDown="counter++;" label="plus"/> </mx:HBox> <comp:TestApplicationSingleton/> </mx:Application> 另外做一個組件,在組件內部可以直接access到主程式裡面那個累加的數字 comp/TestApplicationSingleton.mxml <?xml version="1.0" encoding="utf-8"?> <mx:Panel x...