はじめに
CameraFramesというUWPのサンプルプロジェクトを修正して各種センサーのデータを可視化してみた。
近距離赤外線
Youtube
近距離深度
Youtube
修正したプロジェクトをGitHubに置いた → https://github.com/sotanmochi/CameraFramesSampleForHoloLensRS4
検証環境
- Windows 10 Pro Insider Preview (Version: 1803, OS build: 17127.1)
- Visual Studio 2017 (Version 15.6.6)
- HoloLens RS4 Preview (OS build: 10.0.17123.1004)
サンプルプロジェクトの取得
Windows-universal-samplesのmasterブランチをcloneする。```
$ git clone https://github.com/Microsoft/Windows-universal-samples.git
# サンプルプロジェクトの実行
[Windows-universal-samples](https://github.com/Microsoft/Windows-universal-samples/tree/master/)には色々なサンプルが含まれているが、今回は[CameraFrames](https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/CameraFrames)を使う。
CameraFramesのソリューションファイル(Windows-universal-samples\Samples\CameraFrames\cs\CameraFrames.sln)をVisual Studioで開いてビルド・デプロイする。
実行してSource GroupのSensor Streamingを選択すると「Access is denied.」と表示されてHoloLensのセンサーデータを使えない。各種センサーのデータを使えるようにプロジェクトの設定を変更していく。

# HoloLensのSensor Streamsを取得できるようにプロジェクト設定を変更
## 開発環境のレジストリの内容確認
開発環境のレジストリエディタ(regedit.exe)でcapabilityClass_Restrictedの内容を事前確認しておく。
capabilityClass_RestrictedのMemberCapabilityに「perceptionSensorsExperimental」が含まれていること。

## Package.appxmanifestの修正
「CameraFrames\cs\Package.appxmaniest」にPackageとCapabilitiesの設定を追記する。
- Packageにrescapを追加
- CapabilitiesにperceptionSensorsExperimentalを追加
修正後のPackage.appxmanifestは最終的に以下のようになる。
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
IgnorableNamespaces="uap mp rescap"
・・・(中略)・・・
```実行結果
Package.appxmanifestを修正するとHoloLensのセンサーデータを使えるようになった。実行結果は以下のようになる。