LoginSignup
11
10

More than 5 years have passed since last update.

ofxLeapMotion2の導入手順

Last updated at Posted at 2015-05-01

openFrameworksでLeapMotionを使う方法を解説します。


必要なもの

  1. Xcode
  2. LeapMotion SDK v.2.2.5.26752
  3. Leap Motion.app(1のダウンロードの流れでインストールする)
  4. openFrameworks
  5. ofxLeapMotion2

プロジェクトの作成方法

  1. ofxLeapMotion2をaddonsフォルダに保存。
  2. openFrameworksのProjectGeneratorよりAddonにofxLeapMotion2を選択し生成。
  3. プロジェクトをXcodeで開き、一番上の青のファイルを選択。 LeapMotion_Sample.xcodeproj-2.png
  4. Build Phasesを選択し Run Scriptを選択、すると以下のようなコマンドが書かれています。
    LeapMotion_Sample.xcodeproj.png

  5. これを以下に書き換えます。

cp -f ../../../libs/fmodex/lib/osx/libfmodex.dylib "\$TARGET_BUILD_DIR/\$PRODUCT_NAME.app/Contents/MacOS/libfmodex.dylib"; install_name_tool -change ./libfmodex.dylib @executable_path/libfmodex.dylib "\$TARGET_BUILD_DIR/\$PRODUCT_NAME.app/Contents/MacOS/\$PRODUCT_NAME";
cp -f ../../../addons/ofxLeapMotion2/libs/lib/osx/libLeap.dylib "\$TARGET_BUILD_DIR/\$PRODUCT_NAME.app/Contents/MacOS/libLeap.dylib"; install_name_tool -change ./libLeap.dylib @executable_path/libLeap.dylib "\$TARGET_BUILD_DIR/\$PRODUCT_NAME.app/Contents/MacOS/\$PRODUCT_NAME";
mkdir -p "\$TARGET_BUILD_DIR/\$PRODUCT_NAME.app/Contents/Resources/"
cp -f "\$ICON_FILE" "\$TARGET_BUILD_DIR/\$PRODUCT_NAME.app/Contents/Resources/"

6. LeapMotionを接続してLeapMotion.appを起動
ofApp.cpp — Edited.png

7. 実行してみましょう!

=========================================================
最後にサンプルコードをあげておきます
https://github.com/Hiroki11x/openFrameworksSample/ofxLeapMotion2_Sample

実行するとこういうイメージです

単位展にあったやつ、LeapMotionを使って、手の関節とって簡単に作ってみました! #ofxLeapMotion2

Hiroki Naganumaさん(@hiroki11x)が投稿した動画 - 2015 5月 2 1:00午前 PDT

11
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
10