LoginSignup
4
5

More than 5 years have passed since last update.

C#でHoloLens RS4 PreviewのResearch modeを使う

Last updated at Posted at 2018-04-15

はじめに

CameraFramesというUWPのサンプルプロジェクトを修正して各種センサーのデータを可視化してみた。

近距離赤外線
CameraFrames01_ShortThrowToFReflectivity.jpg
Youtube

近距離深度
CameraFrames02_ShortThrowToFDepth.jpg
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には色々なサンプルが含まれているが、今回はCameraFramesを使う。
CameraFramesのソリューションファイル(Windows-universal-samples\Samples\CameraFrames\cs\CameraFrames.sln)をVisual Studioで開いてビルド・デプロイする。

実行してSource GroupのSensor Streamingを選択すると「Access is denied.」と表示されてHoloLensのセンサーデータを使えない。各種センサーのデータを使えるようにプロジェクトの設定を変更していく。

CameraFrames00.jpg

HoloLensのSensor Streamsを取得できるようにプロジェクト設定を変更

開発環境のレジストリの内容確認

開発環境のレジストリエディタ(regedit.exe)でcapabilityClass_Restrictedの内容を事前確認しておく。
capabilityClass_RestrictedのMemberCapabilityに「perceptionSensorsExperimental」が含まれていること。

RegEditCapability.jpg

Package.appxmanifestの修正

「CameraFrames\cs\Package.appxmaniest」にPackageとCapabilitiesの設定を追記する。

  • Packageにrescapを追加
  • CapabilitiesにperceptionSensorsExperimentalを追加

修正後のPackage.appxmanifestは最終的に以下のようになる。

<?xml version='1.0' encoding='utf-8'?>
<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"
  >
  <Identity Name="Microsoft.SDKSamples.CameraFrames.CS" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" Version="1.0.0.0"/>

・・・(中略)・・・

  <Capabilities>
    <rescap:Capability Name="perceptionSensorsExperimental"/>
    <DeviceCapability Name="microphone"/>
    <DeviceCapability Name="webcam"/>
  </Capabilities>
</Package>

実行結果

Package.appxmanifestを修正するとHoloLensのセンサーデータを使えるようになった。実行結果は以下のようになる。

近距離赤外線
CameraFrames01_ShortThrowToFReflectivity.jpg

近距離深度
CameraFrames02_ShortThrowToFDepth.jpg

参考情報

4
5
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
4
5