• Stars
    star
    257
  • Rank 157,985 (Top 4 %)
  • Language
    C#
  • License
    MIT License
  • Created over 7 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

HoloLens With OpenCVforUnity Example (Support for Hololens1 and Hololens2)

HoloLens With OpenCVForUnity Example

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 https://docs.microsoft.com/en-us/windows/mixed-reality/develop/unity/recommended-settings-for-unity)
  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 Assets Build Settings
ProjectAssets.jpg BuildSettings.jpg
Player Settings
PlayerSettings.jpg

ScreenShot (old version)

screenshot01.jpg

screenshot02.jpg

screenshot03.jpg

screenshot04.jpg

screenshot05.jpg

More Repositories

1

OpenCVForUnity

OpenCV for Unity (Untiy Asset Plugin)
C#
550
star
2

DlibFaceLandmarkDetector

FaceLandmark Detector using Dlib (Unity Asset Plugin)
C#
93
star
3

CVVTuberExample

CVVTuberExample(Computer Vision Virtual YouTuber Example) is an example project of controlling 3D humanoid model ("Unity-chan!" Model) using WebCamTexture.
C#
84
star
4

WebGLFileUploader

This asset adds file upload capability to the Unity WebGL platform.
C#
62
star
5

VuforiaWithOpenCVForUnityExample

Vuforia with OpenCV for Unity Example
C#
61
star
6

FaceMaskExample

This asset is an example project that maps face mask to the detected faces in an image using “OpenCV for Unity” and “Dlib FaceLandmark Detector”.
C#
37
star
7

KinectWithOpenCVForUnityExample

An example of integrating Xbox One Kinect sensor "Kinect v2" with OpenCV for Unity.
C#
36
star
8

HoloLensWithDlibFaceLandmarkDetectorExample

HoloLens With DlibFaceLandmarkDetector Example (Support for Hololens1 and Hololens2)
C#
28
star
9

NatCorderWithOpenCVForUnityExample

An example of a video recording app by using NatCorder and OpenCVForUnity.
C#
26
star
10

RealTimeFaceRecognitionExample

This asset is an example project of face recognition in real time using “OpenCV for Unity”.
C#
25
star
11

FfmpegWithOpenCVForUnityExample

Example of integrating "FFmpeg for Unity" with "OpenCV for Unity"
C#
25
star
12

NatCamWithOpenCVForUnityExample

An example of improving performance of video preview on mobile platform by replacing WebCamTexture of Unity standard API with NatCam.
C#
24
star
13

MarkerLessARExample

This asset is a Marker-Less Augmented Reality Example using the actual environment as input instead of printed square markers and display 3d model in WebCamTexture in real-time.
C#
24
star
14

MagicLeapWithOpenCVForUnityExample

MagicLeap with OpenCVforUnity Example
C#
20
star
15

FaceSwapperExample

This asset is an example of swapping two faces in an image using “OpenCV for Unity” and “Dlib FaceLandmark Detector”.
C#
19
star
16

ARFoundationWithOpenCVForUnityExample

An example of converting an ARFoundation camera image to OpenCV's Mat format.
C#
19
star
17

FaceTrackerExample

This asset is an Non-rigid Face Tracking Example that can model and track the many complex parts of a person’s face in WebCamTexture in real-time.
C#
19
star
18

MarkerBasedARExample

This asset is an Augmented Reality Example that detect and recognize markers and display 3D model in WebCamTexture in real-time.
C#
16
star
19

NatDeviceWithOpenCVForUnityExample

An example of improving performance of video preview on mobile platform by replacing WebCamTexture of Unity standard API with NatDevice.
C#
15
star
20

GoogleVRWithOpenCVForUnityExample

GoogleVR With OpenCVForUnity Example
C#
14
star
21

NrealLightWithOpenCVForUnityExample

An example of a Nreal Light (XREAL Light) MR app by using NRSDK and OpenCVForUnity.
C#
13
star
22

AVProWithOpenCVForUnityExample

This example shows how to convert AVProVideo and AVProLiveCamera texture to OpenCV Mat using AsyncGPUReadback.
C#
13
star
23

YOLOv8WithOpenCVForUnityExample

An example of using OpenCV dnn module with YOLOv8. (ObjectDetection, Segmentation, Classification, PoseEstimation)
C#
13
star
24

YOLOv5WithOpenCVForUnityExample

An example of using OpenCV dnn module with YOLOv5. (ObjectDetection, Segmentation, Classification)
Jupyter Notebook
12
star
25

VideoPlayerWithOpenCVForUnityExample

This example shows how to convert VideoPlayer texture to OpenCV Mat using AsyncGPUReadback.
C#
10
star
26

OpenCVObjectDetector

ObjectDetector using OpenCV (UnityPlugin)
C#
9
star
27

OpenCVForUnityPlayMakerActions

You can use All methods of OpenCVforUnity in PlayMaker.
C#
8
star
28

MagicLeapWithDlibFaceLandmarkDetectorExample

MagicLeap with DlibFaceLandmarkDetector Example
C#
8
star
29

DlibFaceLandmarkDetectorPlayMakerActions

You can use almost all the methods of methods of DlibFaceLandmarkDetector in PlayMaker.
C#
7
star
30

VisualScriptingWithOpenCVForUnityExample

Example of using OpenCVForUnity with VisualScripting
6
star
31

BarracudaWithOpenCVForUnityExample

An example of integrating Barracuda with OpenCVForUnity.
C#
5
star
32

OpenCVCameraCalibrationTest

Improved calibration performance using findChessboardCornersSB and calibrateCameraRO method.
C#
3
star
33

NrealLightWithDlibFaceLandmarkDetectorExample

An example of a Nreal Light MR app by using NRSDK and DlibLandmarkDetector.
C#
2
star
34

VisualScriptingWithDlibFaceLandmarkDetectorExample

Example of using DlibFaceLandmarkDetector with VisualScripting
1
star
35

NativeGalleryWithOpenCVForUnityExample

This example shows how to use the NativeGallery plugin to retrieve an image or video file path from the in-device storage gallery in an Android/iPhone device via a file picker and apply image processing using OpenCVForUnity.
C#
1
star