トップ 一覧 検索 ヘルプ RSS ログイン

unity_leapmotion_get_imageの変更点

  • 追加された行はこのように表示されます。
  • 削除された行はこのように表示されます。
----
!!!カメラ画像の取得

Leap Motionのカメラから画像を読み込むときの覚書です。
Leap_Motion_CoreAssets_4.2.0.unitypackageで確認しました (2017/06/13)。

!! シーンにLeap Motionでキャプチャするためのprefabを配置

* LeapMotionのprefabより「LMHeadMountedRig」をシーンに追加
シーンのどこに配置してもOK。
* 手を使わない場合は、配置したprefab内の「Hand Models」を削除
* 配置したprefab内の「CenterEyeAnchor」に、Componentとして「LeapImageRetriever」を追加。
ここのProviderに「LeapHandController」を指定。
* 「LeapImageRetriever」Component内のProviderに「LeapHandController」を指定
* 「CenterEyeAnchor」の"Leap VR Camera Control" Componentを削除
* シーンにQuadを追加し、Materialとして「LeapMotion/Passthrough/Foreground」与える。

「LMHeadMountedRig」は、アクティブなカメラの直下にposition(0, 0, 0)として配置するのがよさそう。

ここでのLeap Motion関連のシーン構成は以下の通り。

 LMHeadMountedRig
   CenterEyeAnchor  <== "LeapImageRetriever" Componentが追加される
     LeapSpace
       LeapHandController
       Quad     <== Materialとして「LeapMotion/Passthrough/Foreground」を与える

これで、Quadにカメラからのキャプチャが表示される。
ただし、キャプチャ自身はスクリーン全体のビューポート的な投影になるため、
生テクスチャを取得する場合はMaterialの「LeapMotion/Passthrough/Foreground」は使わずに、「LeapImageRetriever」から情報を取得することになる。

!! LeapImageRetrieverからカメラでのキャプチャ情報を取得

「CenterEyeAnchor」にComponentとして「LeapImageRetriever」を配置している場合、
「LeapMotionGetImage.cs」みたいなのを作成し、同じGameObject内にこれをComponentとして追加。
C#スクリプト内で
 using Leap.Unity;
 
 LeapImageRetriever imgR = this.GetComponent<LeapImageRetriever>();
のように、LeapImageRetrieverオブジェクトを取得できるようにしている。

! LeapImageRetrieverで取得できる情報
LeapImageRetrieverでは、
* BrightTexture (LeapTextureData型)
* RawTexture (LeapTextureData型)
* Distortion (LeapDistortionData型)
の3つのテクスチャ情報を作成している。

----
{{lastmodified}}