HoloLensWithOpenCVForUnityExample

https://github.com/EnoxSoftware/HoloLensWithOpenCVForUnityExample

What's new

  • Support for Hololens1 and Hololens2. (XR System: Legacy Built-in XR / XR Plugin Management WindowsMR / XR Plugin Management OpenXR)

Demo Video (old version)

Environment

Setup

  1. Download the latest release unitypackage. HoloLensWithOpenCVForUnityExample.unitypackage
  2. Create a new project. (HoloLensWithOpenCVForUnityExample)
    • Change the platform to UWP in the "Build Settings" window.
  3. Import the OpenCVForUnity.
    • Select MenuItem[Tools/OpenCV for Unity/Open Setup Tools].
    • Click the [Move StreamingAssets Folder] button.
    • Leave the following files and delete the rest. ("StreamingAssets/OpenCVForUnity/objdetect/haarcascade_frontalface_alt.xml", "lbpcascade_ frontalface.xml")
  4. Clone HoloLensCameraStream repository.
    • Copy the "HoloLensCameraStream/HoloLensVideoCaptureExample/Assets/CamStream/" folder to the "Assets/" folder.
  5. Import the Microsoft Mixed Reality Toolkit. (Recommend using MixedRealityFeatureTool)
    • Follow the MRTK2 configuration dialog to set up the project.
  6. Import the HoloLensWithOpenCVForUnityExample.unitypackage.
  7. Add the "Assets/HoloLensWithOpenCVForUnityExample/*.unity" files to the "Scenes In Build" list in the "Build Settings" window.
  8. Configure settings in the "Project Settings" window.
    • Add Define Symbols: the following to Scripting Define Symbols depending on the XR system used in your project; Legacy built-in XR: BUILTIN_XR; XR Plugin Management (Windows Mixed Reality): XR_PLUGIN_WINDOWSMR; XR Plugin Management (OpenXR):XR_PLUGIN_OPENXR.
    • Enable WebCam Capabilties in Publishing settings tab.
  9. (Optional) Setup a performance environment suitable for Holorens. (See Recommended settings for Unity - Mixed Reality | Microsoft Learn)
  10. Build the project: You can now build the Unity project, which generates a Visual Studio Solution (which you will then have to also build). With the Build Settings window still open, click Build. In the explorer window that appears, make a new folder called App, which should live as a sibling next to the 'Assets` folder. Then click Select Folder to generate the VS solution in that folder. Then wait for Unity to build the solution.
  11. Open the VS Solution: When the solution is built, a Windows explorer folder will open. Open the newly-built VS solution, which lives in App/HoloLensWithOpenCVForUnityExample.sln. This is the solution that ultimately gets deployed to your HoloLens.
  12. Configure the deploy settings: In the Visual Studio toolbar, change the solution platform from ARM to x86 if you are building for Hololens1 or to ARM64 if you are building for Hololens2; Change the deploy target (the green play button) to Device (if your HoloLens is plugged into your computer), or Remote Machine (if your HoloLens is connected via WiFi).
  13. Run the app: Go to Debug > Start Debugging. Once the app is deployed to the HoloLens, you should see some confirmation output in the Output window.
    • (Print the AR marker "CanonicalMarker-d10-i1-sp500-bb1.pdf" on an A4 size paper)
Project AssetsBuild Settings

ProjectAssets.jpg

BuildSettings.jpg

Player Settings

PlayerSettings.jpg

ScreenShot (old version)

screenshot01.jpg

screenshot02.jpg

screenshot03.jpg

screenshot04.jpg

screenshot05.jpg

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值