From b3bd6838e635d217ad3811aac429c17c27236da3 Mon Sep 17 00:00:00 2001 From: EnoxSoftware Date: Tue, 26 Nov 2024 02:00:07 +0900 Subject: [PATCH] v1.0.9 update OpenCVForUnity version to 2.6.4. --- .../HoloLensWithOpenCVForUnityExample.meta | 0 .../HLArUcoExample.meta | 0 .../HLArUcoExample/CameraParameters.cs | 0 .../HLArUcoExample/CameraParameters.cs.meta | 0 .../HLArUcoExample/HLArUcoExample.cs | 15 +- .../HLArUcoExample/HLArUcoExample.cs.meta | 0 .../HLArUcoExample/HLArUcoExample.unity | 0 .../HLArUcoExample/HLArUcoExample.unity.meta | 0 .../HLArUcoExample/Materials.meta | 0 .../Materials/ArUcoMaterial.mat | 0 .../Materials/ArUcoMaterial.mat.meta | 0 .../HLCameraIntrinsicsChecker.meta | 0 .../HLCameraIntrinsicsChecker.unity | 0 .../HLCameraIntrinsicsChecker.unity.meta | 0 .../HLCameraIntrinsicsCheckerHelper.cs | 0 .../HLCameraIntrinsicsCheckerHelper.cs.meta | 0 .../HLCameraStream2MatHelperExample.meta | 0 .../ComicFilter.cs | 0 .../ComicFilter.cs.meta | 0 .../HLCameraStream2MatHelperExample.cs | 23 +-- .../HLCameraStream2MatHelperExample.cs.meta | 0 .../HLCameraStream2MatHelperExample.unity | 0 ...HLCameraStream2MatHelperExample.unity.meta | 0 .../HLFaceDetectionExample.meta | 0 .../HLFaceDetectionExample.cs | 105 +++++++---- .../HLFaceDetectionExample.cs.meta | 0 .../HLFaceDetectionExample.unity | 0 .../HLFaceDetectionExample.unity.meta | 0 .../HLPhotoCaptureExample.meta | 0 .../HLPhotoCaptureExample.cs | 37 +++- .../HLPhotoCaptureExample.cs.meta | 0 .../HLPhotoCaptureExample.unity | 0 .../HLPhotoCaptureExample.unity.meta | 0 .../HoloLensWithOpenCVForUnityExample.cs | 4 +- .../HoloLensWithOpenCVForUnityExample.cs.meta | 0 .../HoloLensWithOpenCVForUnityExample.unity | 9 +- ...loLensWithOpenCVForUnityExample.unity.meta | 0 .../Materials.meta | 0 .../Materials/HolographicImageBlend.mat | 0 .../Materials/HolographicImageBlend.mat.meta | 0 .../HolographicImageBlendGrayscale.mat | 0 .../HolographicImageBlendGrayscale.mat.meta | 0 .../Materials/TextureSinglePass.mat | 0 .../Materials/TextureSinglePass.mat.meta | 0 .../Materials/TextureSinglePassGrayscale.mat | 0 .../TextureSinglePassGrayscale.mat.meta | 0 .../RectangleTracker.meta | 0 .../RectangleTracker/Scripts.meta | 0 .../Scripts/RectangleTracker.cs | 0 .../Scripts/RectangleTracker.cs.meta | 0 .../RectangleTracker/Scripts/TrackedObject.cs | 0 .../Scripts/TrackedObject.cs.meta | 0 .../RectangleTracker/Scripts/TrackedRect.cs | 0 .../Scripts/TrackedRect.cs.meta | 0 .../Scripts/TrackerParameters.cs | 0 .../Scripts/TrackerParameters.cs.meta | 0 .../Scripts.meta | 0 .../Scripts/ARGameObject.cs | 0 .../Scripts/ARGameObject.cs.meta | 0 .../Scripts/Utils.meta | 0 .../Scripts/Utils/DebugUtils.cs | 0 .../Scripts/Utils/DebugUtils.cs.meta | 0 .../Scripts/Utils/HLCameraStream2MatHelper.cs | 178 ++++++++++++------ .../Utils/HLCameraStream2MatHelper.cs.meta | 0 .../ShowLicense.cs | 0 .../ShowLicense.cs.meta | 0 .../ShowLicense.unity | 0 .../ShowLicense.unity.meta | 0 .../HoloLensWithOpenCVForUnityExample.meta | 0 .../HLArUcoExample.meta | 0 .../HLArUcoExample/CameraParameters.cs | 0 .../HLArUcoExample/CameraParameters.cs.meta | 0 .../HLArUcoExample/HLArUcoExample.cs | 15 +- .../HLArUcoExample/HLArUcoExample.cs.meta | 0 .../HLArUcoExample/HLArUcoExample.unity | 9 +- .../HLArUcoExample/HLArUcoExample.unity.meta | 0 .../HLArUcoExample/Materials.meta | 0 .../Materials/ArUcoMaterial.mat | 0 .../Materials/ArUcoMaterial.mat.meta | 0 .../HLCameraIntrinsicsChecker.meta | 0 .../HLCameraIntrinsicsChecker.unity | 0 .../HLCameraIntrinsicsChecker.unity.meta | 0 .../HLCameraIntrinsicsCheckerHelper.cs | 0 .../HLCameraIntrinsicsCheckerHelper.cs.meta | 0 .../HLCameraStream2MatHelperExample.meta | 0 .../ComicFilter.cs | 0 .../ComicFilter.cs.meta | 0 .../HLCameraStream2MatHelperExample.cs | 27 +-- .../HLCameraStream2MatHelperExample.cs.meta | 0 .../HLCameraStream2MatHelperExample.unity | 9 +- ...HLCameraStream2MatHelperExample.unity.meta | 0 .../HLFaceDetectionExample.meta | 0 .../HLFaceDetectionExample.cs | 105 +++++++---- .../HLFaceDetectionExample.cs.meta | 0 .../HLFaceDetectionExample.unity | 9 +- .../HLFaceDetectionExample.unity.meta | 0 .../HLPhotoCaptureExample.meta | 0 .../HLPhotoCaptureExample.cs | 37 +++- .../HLPhotoCaptureExample.cs.meta | 0 .../HLPhotoCaptureExample.unity | 0 .../HLPhotoCaptureExample.unity.meta | 0 .../HoloLensWithOpenCVForUnityExample.cs | 4 +- .../HoloLensWithOpenCVForUnityExample.cs.meta | 0 .../HoloLensWithOpenCVForUnityExample.unity | 9 +- ...loLensWithOpenCVForUnityExample.unity.meta | 0 .../Materials.meta | 0 .../Materials/HolographicImageBlend.mat | 0 .../Materials/HolographicImageBlend.mat.meta | 0 .../HolographicImageBlendGrayscale.mat | 0 .../HolographicImageBlendGrayscale.mat.meta | 0 .../Materials/TextureSinglePass.mat | 0 .../Materials/TextureSinglePass.mat.meta | 0 .../Materials/TextureSinglePassGrayscale.mat | 0 .../TextureSinglePassGrayscale.mat.meta | 0 .../RectangleTracker.meta | 0 .../RectangleTracker/Scripts.meta | 0 .../Scripts/RectangleTracker.cs | 0 .../Scripts/RectangleTracker.cs.meta | 0 .../RectangleTracker/Scripts/TrackedObject.cs | 0 .../Scripts/TrackedObject.cs.meta | 0 .../RectangleTracker/Scripts/TrackedRect.cs | 0 .../Scripts/TrackedRect.cs.meta | 0 .../Scripts/TrackerParameters.cs | 0 .../Scripts/TrackerParameters.cs.meta | 0 .../Scripts.meta | 0 .../Scripts/ARGameObject.cs | 0 .../Scripts/ARGameObject.cs.meta | 0 .../Scripts/Utils.meta | 0 .../Scripts/Utils/DebugUtils.cs | 0 .../Scripts/Utils/DebugUtils.cs.meta | 0 .../Scripts/Utils/HLCameraStream2MatHelper.cs | 178 ++++++++++++------ .../Utils/HLCameraStream2MatHelper.cs.meta | 0 .../ShowLicense.cs | 0 .../ShowLicense.cs.meta | 0 .../ShowLicense.unity | 0 .../ShowLicense.unity.meta | 0 README.md | 19 +- 137 files changed, 505 insertions(+), 287 deletions(-) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/CameraParameters.cs (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/CameraParameters.cs.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.cs (98%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.cs.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.unity (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.unity.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials/ArUcoMaterial.mat (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials/ArUcoMaterial.mat.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsChecker.unity (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsChecker.unity.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsCheckerHelper.cs (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsCheckerHelper.cs.meta (100%) rename HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample.meta => HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample => HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample}/ComicFilter.cs (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample => HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample}/ComicFilter.cs.meta (100%) rename HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/HLCameraStreamToMatHelperExample.cs => HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/HLCameraStream2MatHelperExample.cs (95%) rename HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/HLCameraStreamToMatHelperExample.cs.meta => HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/HLCameraStream2MatHelperExample.cs.meta (100%) rename HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/HLCameraStreamToMatHelperExample.unity => HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/HLCameraStream2MatHelperExample.unity (100%) rename HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/HLCameraStreamToMatHelperExample.unity.meta => HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/HLCameraStream2MatHelperExample.unity.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.cs (94%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.cs.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.unity (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.unity.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.cs (89%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.cs.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.unity (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.unity.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.cs (95%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.cs.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.unity (99%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.unity.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/Materials.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlend.mat (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlend.mat.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlendGrayscale.mat (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlendGrayscale.mat.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePass.mat (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePass.mat.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePassGrayscale.mat (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePassGrayscale.mat.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/RectangleTracker.cs (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/RectangleTracker.cs.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedObject.cs (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedObject.cs.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedRect.cs (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedRect.cs.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackerParameters.cs (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackerParameters.cs.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/Scripts.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/Scripts/ARGameObject.cs (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/Scripts/ARGameObject.cs.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/DebugUtils.cs (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/DebugUtils.cs.meta (100%) rename HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStreamToMatHelper.cs => HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStream2MatHelper.cs (81%) rename HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStreamToMatHelper.cs.meta => HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStream2MatHelper.cs.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.cs (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.cs.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.unity (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK2}/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.unity.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/CameraParameters.cs (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/CameraParameters.cs.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.cs (98%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.cs.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.unity (99%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.unity.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials/ArUcoMaterial.mat (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials/ArUcoMaterial.mat.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsChecker.unity (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsChecker.unity.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsCheckerHelper.cs (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsCheckerHelper.cs.meta (100%) rename HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample.meta => HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample => HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample}/ComicFilter.cs (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample => HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample}/ComicFilter.cs.meta (100%) rename HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/HLCameraStreamToMatHelperExample.cs => HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/HLCameraStream2MatHelperExample.cs (94%) rename HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/HLCameraStreamToMatHelperExample.cs.meta => HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/HLCameraStream2MatHelperExample.cs.meta (100%) rename HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/HLCameraStreamToMatHelperExample.unity => HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/HLCameraStream2MatHelperExample.unity (99%) rename HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/HLCameraStreamToMatHelperExample.unity.meta => HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/HLCameraStream2MatHelperExample.unity.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK2 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.cs (94%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.cs.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.unity (99%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.unity.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.cs (89%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.cs.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.unity (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.unity.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.cs (95%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.cs.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.unity (99%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.unity.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/Materials.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlend.mat (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlend.mat.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlendGrayscale.mat (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlendGrayscale.mat.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePass.mat (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePass.mat.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePassGrayscale.mat (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePassGrayscale.mat.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/RectangleTracker.cs (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/RectangleTracker.cs.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedObject.cs (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedObject.cs.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedRect.cs (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedRect.cs.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackerParameters.cs (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackerParameters.cs.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/Scripts.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/Scripts/ARGameObject.cs (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/Scripts/ARGameObject.cs.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/DebugUtils.cs (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/DebugUtils.cs.meta (100%) rename HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStreamToMatHelper.cs => HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStream2MatHelper.cs (81%) rename HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStreamToMatHelper.cs.meta => HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStream2MatHelper.cs.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.cs (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.cs.meta (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.unity (100%) rename {HoloLensWithOpenCVForUnityExampleMRTK3 => HLWithOpenCVExampleMRTK3}/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.unity.meta (100%) diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/CameraParameters.cs b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/CameraParameters.cs similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/CameraParameters.cs rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/CameraParameters.cs diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/CameraParameters.cs.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/CameraParameters.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/CameraParameters.cs.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/CameraParameters.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.cs b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.cs similarity index 98% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.cs rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.cs index 085281a..5214e85 100644 --- a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.cs +++ b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.cs @@ -22,7 +22,7 @@ namespace HoloLensWithOpenCVForUnityExample /// An example of marker based AR using OpenCVForUnity on Hololens. /// Referring to https://github.com/opencv/opencv_contrib/blob/master/modules/aruco/samples/detect_markers.cpp. /// - [RequireComponent(typeof(HLCameraStreamToMatHelper), typeof(ImageOptimizationHelper))] + [RequireComponent(typeof(HLCameraStream2MatHelper), typeof(ImageOptimizationHelper))] public class HLArUcoExample : MonoBehaviour { [HeaderAttribute("Preview")] @@ -149,7 +149,7 @@ public class HLArUcoExample : MonoBehaviour /// /// The webcam texture to mat helper. /// - HLCameraStreamToMatHelper webCamTextureToMatHelper; + HLCameraStream2MatHelper webCamTextureToMatHelper; /// /// The image optimization helper. @@ -253,11 +253,11 @@ protected void Start() enableLerpFilterToggle.isOn = enableLerpFilter; imageOptimizationHelper = gameObject.GetComponent(); - webCamTextureToMatHelper = gameObject.GetComponent(); + webCamTextureToMatHelper = gameObject.GetComponent(); #if WINDOWS_UWP && !DISABLE_HOLOLENSCAMSTREAM_API webCamTextureToMatHelper.frameMatAcquired += OnFrameMatAcquired; #endif - webCamTextureToMatHelper.outputColorFormat = WebCamTextureToMatHelper.ColorFormat.GRAY; + webCamTextureToMatHelper.outputColorFormat = Source2MatHelperColorFormat.GRAY; webCamTextureToMatHelper.Initialize(); } @@ -506,12 +506,13 @@ public void OnWebCamTextureToMatHelperDisposed() } /// - /// Raises the web cam texture to mat helper error occurred event. + /// Raises the webcam texture to mat helper error occurred event. /// /// Error code. - public void OnWebCamTextureToMatHelperErrorOccurred(WebCamTextureToMatHelper.ErrorCode errorCode) + /// Message. + public void OnWebCamTextureToMatHelperErrorOccurred(Source2MatHelperErrorCode errorCode, string message) { - Debug.Log("OnWebCamTextureToMatHelperErrorOccurred " + errorCode); + Debug.Log("OnWebCamTextureToMatHelperErrorOccurred " + errorCode + ":" + message); } #if WINDOWS_UWP && !DISABLE_HOLOLENSCAMSTREAM_API diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.cs.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.cs.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.unity b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.unity similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.unity rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.unity diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.unity.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.unity.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.unity.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.unity.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials/ArUcoMaterial.mat b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials/ArUcoMaterial.mat similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials/ArUcoMaterial.mat rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials/ArUcoMaterial.mat diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials/ArUcoMaterial.mat.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials/ArUcoMaterial.mat.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials/ArUcoMaterial.mat.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials/ArUcoMaterial.mat.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsChecker.unity b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsChecker.unity similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsChecker.unity rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsChecker.unity diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsChecker.unity.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsChecker.unity.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsChecker.unity.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsChecker.unity.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsCheckerHelper.cs b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsCheckerHelper.cs similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsCheckerHelper.cs rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsCheckerHelper.cs diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsCheckerHelper.cs.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsCheckerHelper.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsCheckerHelper.cs.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsCheckerHelper.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/ComicFilter.cs b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/ComicFilter.cs similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/ComicFilter.cs rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/ComicFilter.cs diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/ComicFilter.cs.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/ComicFilter.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/ComicFilter.cs.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/ComicFilter.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/HLCameraStreamToMatHelperExample.cs b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/HLCameraStream2MatHelperExample.cs similarity index 95% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/HLCameraStreamToMatHelperExample.cs rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/HLCameraStream2MatHelperExample.cs index f6da3ad..6acc27c 100644 --- a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/HLCameraStreamToMatHelperExample.cs +++ b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/HLCameraStream2MatHelperExample.cs @@ -13,12 +13,12 @@ namespace HoloLensWithOpenCVForUnityExample { /// - /// HLCameraStreamToMatHelper Example + /// HLCameraStream2MatHelper Example /// An example of image processing (comic filter) using OpenCVForUnity on Hololens. /// Referring to http://dev.classmethod.jp/smartphone/opencv-manga-2/. /// - [RequireComponent(typeof(HLCameraStreamToMatHelper))] - public class HLCameraStreamToMatHelperExample : MonoBehaviour + [RequireComponent(typeof(HLCameraStream2MatHelper))] + public class HLCameraStream2MatHelperExample : MonoBehaviour { /// /// The rotate 90 degree toggle. @@ -73,7 +73,7 @@ public class HLCameraStreamToMatHelperExample : MonoBehaviour /// /// The web cam texture to mat helper. /// - HLCameraStreamToMatHelper webCamTextureToMatHelper; + HLCameraStream2MatHelper webCamTextureToMatHelper; readonly static Queue ExecuteOnMainThread = new Queue(); @@ -89,11 +89,11 @@ public class HLCameraStreamToMatHelperExample : MonoBehaviour // Use this for initialization protected void Start() { - webCamTextureToMatHelper = gameObject.GetComponent(); + webCamTextureToMatHelper = gameObject.GetComponent(); #if WINDOWS_UWP && !DISABLE_HOLOLENSCAMSTREAM_API webCamTextureToMatHelper.frameMatAcquired += OnFrameMatAcquired; #endif - webCamTextureToMatHelper.outputColorFormat = WebCamTextureToMatHelper.ColorFormat.BGRA; + webCamTextureToMatHelper.outputColorFormat = Source2MatHelperColorFormat.BGRA; webCamTextureToMatHelper.Initialize(); // Update GUI state @@ -184,12 +184,13 @@ public void OnWebCamTextureToMatHelperDisposed() } /// - /// Raises the web cam texture to mat helper error occurred event. + /// Raises the webcam texture to mat helper error occurred event. /// /// Error code. - public void OnWebCamTextureToMatHelperErrorOccurred(WebCamTextureToMatHelper.ErrorCode errorCode) + /// Message. + public void OnWebCamTextureToMatHelperErrorOccurred(Source2MatHelperErrorCode errorCode, string message) { - Debug.Log("OnWebCamTextureToMatHelperErrorOccurred " + errorCode); + Debug.Log("OnWebCamTextureToMatHelperErrorOccurred " + errorCode + ":" + message); } #if WINDOWS_UWP && !DISABLE_HOLOLENSCAMSTREAM_API @@ -278,8 +279,8 @@ void Update() DebugUtils.TrackTick(); - // For BGRA or BGR format, use the fastMatToTexture2D method. - Utils.fastMatToTexture2D(bgraMat, texture); + // For BGRA or BGR format, use the matToTexture2DRaw method. + Utils.matToTexture2DRaw(bgraMat, texture); } if (webCamTextureToMatHelper.IsPlaying()) diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/HLCameraStreamToMatHelperExample.cs.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/HLCameraStream2MatHelperExample.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/HLCameraStreamToMatHelperExample.cs.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/HLCameraStream2MatHelperExample.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/HLCameraStreamToMatHelperExample.unity b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/HLCameraStream2MatHelperExample.unity similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/HLCameraStreamToMatHelperExample.unity rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/HLCameraStream2MatHelperExample.unity diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/HLCameraStreamToMatHelperExample.unity.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/HLCameraStream2MatHelperExample.unity.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/HLCameraStreamToMatHelperExample.unity.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/HLCameraStream2MatHelperExample.unity.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.cs b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.cs similarity index 94% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.cs rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.cs index 21d0dd0..b42c2c9 100644 --- a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.cs +++ b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.cs @@ -21,7 +21,7 @@ namespace HoloLensWithOpenCVForUnityExample /// An example of detecting face using OpenCVForUnity on Hololens. /// Referring to https://github.com/Itseez/opencv/blob/master/modules/objdetect/src/detection_based_tracker.cpp. /// - [RequireComponent(typeof(HLCameraStreamToMatHelper), typeof(ImageOptimizationHelper))] + [RequireComponent(typeof(HLCameraStream2MatHelper), typeof(ImageOptimizationHelper))] public class HLFaceDetectionExample : MonoBehaviour { /// @@ -67,7 +67,7 @@ public class HLFaceDetectionExample : MonoBehaviour /// /// The webcam texture to mat helper. /// - HLCameraStreamToMatHelper webCamTextureToMatHelper; + HLCameraStream2MatHelper webCamTextureToMatHelper; /// /// The image optimization helper. @@ -177,22 +177,72 @@ bool isDetectingInFrameArrivedThread public Text debugStr; + string cascade_filepath; + string cascade4Thread_filepath; + + /// + /// The CancellationTokenSource. + /// + CancellationTokenSource cts = new CancellationTokenSource(); + // Use this for initialization - protected void Start() + async void Start() { enableDownScaleToggle.isOn = enableDownScale; useSeparateDetectionToggle.isOn = useSeparateDetection; displayCameraImageToggle.isOn = displayCameraImage; imageOptimizationHelper = gameObject.GetComponent(); - webCamTextureToMatHelper = gameObject.GetComponent(); + webCamTextureToMatHelper = gameObject.GetComponent(); #if WINDOWS_UWP && !DISABLE_HOLOLENSCAMSTREAM_API webCamTextureToMatHelper.frameMatAcquired += OnFrameMatAcquired; #endif - webCamTextureToMatHelper.outputColorFormat = WebCamTextureToMatHelper.ColorFormat.GRAY; - webCamTextureToMatHelper.Initialize(); rectangleTracker = new RectangleTracker(); + + // Asynchronously retrieves the readable file path from the StreamingAssets directory. + if (debugStr != null) + { + debugStr.text = "Preparing file access..."; + } + + cascade_filepath = await Utils.getFilePathAsyncTask("OpenCVForUnity/objdetect/lbpcascade_frontalface.xml", cancellationToken: cts.Token); + //cascade4Thread_filepath = await Utils.getFilePathAsyncTask("OpenCVForUnity/objdetect/haarcascade_frontalface_alt.xml", cancellationToken: cts.Token); + cascade4Thread_filepath = await Utils.getFilePathAsyncTask("OpenCVForUnity/objdetect/lbpcascade_frontalface.xml", cancellationToken: cts.Token); + + if (debugStr != null) + { + debugStr.text = ""; + } + + Run(); + } + + // Use this for initialization + void Run() + { + cascade = new CascadeClassifier(); + cascade.load(cascade_filepath); +#if !WINDOWS_UWP || UNITY_EDITOR + // "empty" method is not working on the UWP platform. + if (cascade.empty()) + { + Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/OpenCVForUnity/objdetect/” to “Assets/StreamingAssets/OpenCVForUnity/objdetect/” folder. "); + } +#endif + + cascade4Thread = new CascadeClassifier(); + cascade4Thread.load(cascade4Thread_filepath); +#if !WINDOWS_UWP || UNITY_EDITOR + // "empty" method is not working on the UWP platform. + if (cascade4Thread.empty()) + { + Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/OpenCVForUnity/objdetect/” to “Assets/StreamingAssets/OpenCVForUnity/objdetect/” folder. "); + } +#endif + + webCamTextureToMatHelper.outputColorFormat = Source2MatHelperColorFormat.GRAY; + webCamTextureToMatHelper.Initialize(); } /// @@ -248,28 +298,7 @@ public void OnWebCamTextureToMatHelperInitialized() quad_renderer.sharedMaterial.SetFloat("_VignetteScale", 0.0f); - - cascade = new CascadeClassifier(); - cascade.load(Utils.getFilePath("OpenCVForUnity/objdetect/lbpcascade_frontalface.xml")); -#if !WINDOWS_UWP || UNITY_EDITOR - // "empty" method is not working on the UWP platform. - if (cascade.empty()) - { - Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/OpenCVForUnity/objdetect/” to “Assets/StreamingAssets/OpenCVForUnity/objdetect/” folder. "); - } -#endif - grayMat4Thread = new Mat(); - cascade4Thread = new CascadeClassifier(); - //cascade4Thread.load(Utils.getFilePath("OpenCVForUnity/objdetect/haarcascade_frontalface_alt.xml")); - cascade4Thread.load(Utils.getFilePath("OpenCVForUnity/objdetect/lbpcascade_frontalface.xml")); -#if !WINDOWS_UWP || UNITY_EDITOR - // "empty" method is not working on the UWP platform. - if (cascade4Thread.empty()) - { - Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/OpenCVForUnity/objdetect/” to “Assets/StreamingAssets/OpenCVForUnity/objdetect/” folder. "); - } -#endif } /// @@ -295,15 +324,9 @@ public void OnWebCamTextureToMatHelperDisposed() hasUpdatedDetectionResult = false; isDetecting = false; - if (cascade != null) - cascade.Dispose(); - if (grayMat4Thread != null) grayMat4Thread.Dispose(); - if (cascade4Thread != null) - cascade4Thread.Dispose(); - rectangleTracker.Reset(); if (debugStr != null) @@ -314,12 +337,13 @@ public void OnWebCamTextureToMatHelperDisposed() } /// - /// Raises the web cam texture to mat helper error occurred event. + /// Raises the webcam texture to mat helper error occurred event. /// /// Error code. - public void OnWebCamTextureToMatHelperErrorOccurred(WebCamTextureToMatHelper.ErrorCode errorCode) + /// Message. + public void OnWebCamTextureToMatHelperErrorOccurred(Source2MatHelperErrorCode errorCode, string message) { - Debug.Log("OnWebCamTextureToMatHelperErrorOccurred " + errorCode); + Debug.Log("OnWebCamTextureToMatHelperErrorOccurred " + errorCode + ":" + message); } #if WINDOWS_UWP && !DISABLE_HOLOLENSCAMSTREAM_API @@ -795,6 +819,15 @@ void OnDestroy() if (rectangleTracker != null) rectangleTracker.Dispose(); + + if (cascade != null) + cascade.Dispose(); + + if (cascade4Thread != null) + cascade4Thread.Dispose(); + + if (cts != null) + cts.Dispose(); } /// diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.cs.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.cs.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.unity b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.unity similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.unity rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.unity diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.unity.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.unity.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.unity.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.unity.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.cs b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.cs similarity index 89% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.cs rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.cs index 1de4e8d..25294ca 100644 --- a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.cs +++ b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.cs @@ -9,6 +9,7 @@ using Microsoft.MixedReality.Toolkit.Input; using System.Collections; using System.Linq; +using System.Threading; #if UNITY_2018_2_OR_NEWER using UnityEngine.Windows.WebCam; @@ -41,12 +42,31 @@ public class HLPhotoCaptureExample : MonoBehaviour private CascadeClassifier cascade; private MatOfRect faces; - private IEnumerator Start() + /// + /// The CancellationTokenSource. + /// + CancellationTokenSource cts = new CancellationTokenSource(); + + // Use this for initialization + async void Start() { faces = new MatOfRect(); + // Asynchronously retrieves the readable file path from the StreamingAssets directory. + if (text != null) + { + text.text = "Preparing file access..."; + } + + string cascade_filepath = await Utils.getFilePathAsyncTask("OpenCVForUnity/objdetect/haarcascade_frontalface_alt.xml", cancellationToken: cts.Token); + + if (text != null) + { + text.text = ""; + } + cascade = new CascadeClassifier(); - cascade.load(Utils.getFilePath("OpenCVForUnity/objdetect/haarcascade_frontalface_alt.xml")); + cascade.load(cascade_filepath); var resolutions = PhotoCapture.SupportedResolutions; @@ -56,7 +76,7 @@ private IEnumerator Start() { text.text = "Resolutions not available. Did you provide web cam access?"; } - yield return null; + return; } cameraResolution = resolutions.OrderByDescending((res) => res.width * res.height).First(); @@ -84,6 +104,9 @@ private void OnDestroy() if (cascade != null) cascade.Dispose(); + + if (cts != null) + cts.Dispose(); } private void OnPhotoCaptureCreated(PhotoCapture captureObject) @@ -174,8 +197,8 @@ private void OnPhotoCaptured(PhotoCapture.PhotoCaptureResult result, PhotoCaptur Mat bgraMat = new Mat(targetTexture.height, targetTexture.width, CvType.CV_8UC4); Mat grayMat = new Mat(bgraMat.rows(), bgraMat.cols(), CvType.CV_8UC1); - // For BGRA or BGR format, use the fastTexture2DToMat method. - Utils.fastTexture2DToMat(targetTexture, bgraMat); + // For BGRA or BGR format, use the texture2DToMatRaw method. + Utils.texture2DToMatRaw(targetTexture, bgraMat); Imgproc.cvtColor(bgraMat, grayMat, Imgproc.COLOR_BGRA2GRAY); Imgproc.equalizeHist(grayMat, grayMat); @@ -196,8 +219,8 @@ private void OnPhotoCaptured(PhotoCapture.PhotoCaptureResult result, PhotoCaptur Imgproc.putText(bgraMat, targetTexture.format + " W:" + bgraMat.width() + " H:" + bgraMat.height(), new Point(5, bgraMat.rows() - 10), Imgproc.FONT_HERSHEY_SIMPLEX, 1.5, new Scalar(255, 0, 0, 255), 2, Imgproc.LINE_AA, false); - // For BGRA or BGR format, use the fastMatToTexture2D method. - Utils.fastMatToTexture2D(bgraMat, targetTexture); + // For BGRA or BGR format, use the matToTexture2DRaw method. + Utils.matToTexture2DRaw(bgraMat, targetTexture); bgraMat.Dispose(); grayMat.Dispose(); diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.cs.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.cs.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.unity b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.unity similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.unity rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.unity diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.unity.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.unity.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.unity.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.unity.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.cs b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.cs similarity index 95% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.cs rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.cs index 0387003..9067247 100644 --- a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.cs +++ b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.cs @@ -88,9 +88,9 @@ public void OnHLPhotoCaptureExampleButtonClick() SceneManager.LoadScene("HLPhotoCaptureExample"); } - public void OnHLCameraStreamToMatHelperExampleButtonClick() + public void OnHLCameraStream2MatHelperExampleButtonClick() { - SceneManager.LoadScene("HLCameraStreamToMatHelperExample"); + SceneManager.LoadScene("HLCameraStream2MatHelperExample"); } public void OnHLFaceDetectionExampleButtonClick() diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.cs.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.cs.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.unity b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.unity similarity index 99% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.unity rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.unity index 00c40c4..895ce13 100644 --- a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.unity +++ b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.unity @@ -2131,7 +2131,7 @@ GameObject: - component: {fileID: 1867454789} - component: {fileID: 1867454788} m_Layer: 5 - m_Name: HLCameraStreamToMatHelperExample + m_Name: HLCameraStream2MatHelperExample m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -2223,8 +2223,9 @@ MonoBehaviour: m_PersistentCalls: m_Calls: - m_Target: {fileID: 2004915444} - m_TargetAssemblyTypeName: - m_MethodName: OnHLCameraStreamToMatHelperExampleButtonClick + m_TargetAssemblyTypeName: HoloLensWithOpenCVForUnityExample.HoloLensWithOpenCVForUnityExample, + Assembly-CSharp + m_MethodName: OnHLCameraStream2MatHelperExampleButtonClick m_Mode: 1 m_Arguments: m_ObjectArgument: {fileID: 0} @@ -2343,7 +2344,7 @@ MonoBehaviour: m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 - m_Text: HLCameraStreamToMatHelper Example + m_Text: HLCameraStream2MatHelper Example --- !u!222 &1869573385 CanvasRenderer: m_ObjectHideFlags: 0 diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.unity.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.unity.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.unity.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.unity.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlend.mat b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlend.mat similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlend.mat rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlend.mat diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlend.mat.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlend.mat.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlend.mat.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlend.mat.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlendGrayscale.mat b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlendGrayscale.mat similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlendGrayscale.mat rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlendGrayscale.mat diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlendGrayscale.mat.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlendGrayscale.mat.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlendGrayscale.mat.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlendGrayscale.mat.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePass.mat b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePass.mat similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePass.mat rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePass.mat diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePass.mat.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePass.mat.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePass.mat.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePass.mat.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePassGrayscale.mat b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePassGrayscale.mat similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePassGrayscale.mat rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePassGrayscale.mat diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePassGrayscale.mat.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePassGrayscale.mat.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePassGrayscale.mat.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePassGrayscale.mat.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/RectangleTracker.cs b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/RectangleTracker.cs similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/RectangleTracker.cs rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/RectangleTracker.cs diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/RectangleTracker.cs.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/RectangleTracker.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/RectangleTracker.cs.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/RectangleTracker.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedObject.cs b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedObject.cs similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedObject.cs rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedObject.cs diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedObject.cs.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedObject.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedObject.cs.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedObject.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedRect.cs b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedRect.cs similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedRect.cs rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedRect.cs diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedRect.cs.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedRect.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedRect.cs.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedRect.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackerParameters.cs b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackerParameters.cs similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackerParameters.cs rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackerParameters.cs diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackerParameters.cs.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackerParameters.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackerParameters.cs.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackerParameters.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/ARGameObject.cs b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/ARGameObject.cs similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/ARGameObject.cs rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/ARGameObject.cs diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/ARGameObject.cs.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/ARGameObject.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/ARGameObject.cs.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/ARGameObject.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/DebugUtils.cs b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/DebugUtils.cs similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/DebugUtils.cs rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/DebugUtils.cs diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/DebugUtils.cs.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/DebugUtils.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/DebugUtils.cs.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/DebugUtils.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStreamToMatHelper.cs b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStream2MatHelper.cs similarity index 81% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStreamToMatHelper.cs rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStream2MatHelper.cs index 4436838..ce58b32 100644 --- a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStreamToMatHelper.cs +++ b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStream2MatHelper.cs @@ -25,30 +25,70 @@ namespace HoloLensWithOpenCVForUnity.UnityUtils.Helper /// This is called every time there is a new frame image mat available. /// The Mat object's type is 'CV_8UC4' or 'CV_8UC3' or 'CV_8UC1' (ColorFormat is determined by the outputColorFormat setting). /// - /// The recently captured frame image mat. + /// The recently captured frame image mat. /// The projection matrices. /// The camera to world matrices. /// The camera intrinsics. public delegate void FrameMatAcquiredCallback(Mat mat, Matrix4x4 projectionMatrix, Matrix4x4 cameraToWorldMatrix, CameraIntrinsics cameraIntrinsics); /// - /// Hololens camera stream to mat helper. - /// v 1.0.7 - /// Depends on EnoxSoftware/HoloLensCameraStream (https://github.com/EnoxSoftware/HoloLensCameraStream). - /// Depends on OpenCVForUnity version 2.4.1 (WebCamTextureToMatHelper v 1.1.2) or later. + /// A helper component class for obtaining camera frames from HoloLensCameraStream and converting them to OpenCV Mat format in real-time. + /// + /// + /// The HLCameraStream2MatHelper class captures video frames from a device's camera using HoloLensCameraStream + /// and converts each frame to an OpenCV Mat object every frame. + /// + /// This component is particularly useful for image processing tasks in Unity, such as computer vision applications, + /// where real-time camera input in Mat format is required. It enables seamless integration of OpenCV-based + /// image processing algorithms with HoloLens camera input. + /// + /// + /// FrameMatAcquiredCallback: + /// The FrameMatAcquiredCallback delegate is invoked each time a new frame is captured and converted to a Mat object. + /// This delegate wraps the HoloLensCameraStream.VideoCapture.FrameSampleAcquired callback to provide the frame data + /// in Mat format, along with the projection matrix, camera-to-world matrix, and camera intrinsics for the captured frame. + /// + /// + /// Usage Notes: + /// + /// + /// The callback is executed outside of the Unity application's main thread. To safely use Unity API functions or + /// update Unity objects within the callback, use UnityEngine.WSA.Application.InvokeOnAppThread(() => { ... }) + /// to dispatch operations to the application thread. + /// + /// + /// The Mat object passed to the callback is managed by the helper class and should not be stored for long-term use. + /// Copy the data if further processing is required beyond the callback's scope. + /// + /// + /// /// - /// By setting outputColorFormat to BGRA or GRAY, processing that does not include extra color conversion is performed. + /// Note: By setting outputColorFormat to BGRA or GRAY, processing that does not include extra color conversion is performed. + /// Note: Depends on EnoxSoftware/HoloLensCameraStream. + /// Note: Depends on OpenCVForUnity version 2.6.4 or later. + /// + /// + /// Attach this component to a GameObject and call GetMat() to retrieve the latest camera frame in Mat format. + /// The helper class manages camera start/stop operations and frame updates internally. + /// /// + /// /// Usage: /// Add Define Symbols: "Open File > Build Settings > Player Settings > Other Settings" and add the following to Scripting Define Symbols depending on the XR system used in your project. - /// This is the setup needed to get the correct values from the TryGetCameraToWorldMatrix method. - /// Legacy built-in XR ; "BUILTIN_XR" + /// + /// { + /// Legacy built-in XR : "BUILTIN_XR" /// XR Plugin Management(Windows Mixed Reality) : "XR_PLUGIN_WINDOWSMR" /// XR Plugin Management(OpenXR) : "XR_PLUGIN_OPENXR" + /// } + /// + /// /// - /// + /// /// Combination of camera frame size and frame rate that can be acquired on Hololens. (width x height : framerate) - /// (See https://learn.microsoft.com/en-us/windows/mixed-reality/develop/advanced-concepts/locatable-camera-overview) + /// https://learn.microsoft.com/en-us/windows/mixed-reality/develop/advanced-concepts/locatable-camera-overview + /// + /// { /// /// Hololens1 /// @@ -126,8 +166,10 @@ namespace HoloLensWithOpenCVForUnity.UnityUtils.Helper /// 424x240 : 30 /// 424x240 : 15 /// - /// - public class HLCameraStreamToMatHelper : WebCamTextureToMatHelper + /// } + /// + /// + public class HLCameraStream2MatHelper : WebCamTexture2MatHelper { /// /// This will be called whenever a new camera frame image available is converted to Mat. @@ -140,7 +182,7 @@ public class HLCameraStreamToMatHelper : WebCamTextureToMatHelper protected CameraIntrinsics cameraIntrinsics; /// - /// Returns the camera intrinsics. + /// Return the camera intrinsics. /// /// The camera intrinsics. public virtual CameraIntrinsics GetCameraIntrinsics() @@ -160,6 +202,8 @@ public override string requestedDeviceName _requestedDeviceName = value; if (hasInitDone) Initialize(); + else if (isInitWaiting) + Initialize(autoPlayAfterInitialize); } } } @@ -175,6 +219,8 @@ public override int requestedWidth _requestedWidth = _value; if (hasInitDone) Initialize(); + else if (isInitWaiting) + Initialize(autoPlayAfterInitialize); } } } @@ -190,6 +236,8 @@ public override int requestedHeight _requestedHeight = _value; if (hasInitDone) Initialize(); + else if (isInitWaiting) + Initialize(autoPlayAfterInitialize); } } } @@ -203,7 +251,9 @@ public override bool requestedIsFrontFacing { _requestedIsFrontFacing = value; if (hasInitDone) - Initialize(_requestedIsFrontFacing, requestedFPS, rotate90Degree); + Initialize(_requestedIsFrontFacing, requestedFPS, rotate90Degree, IsPlaying()); + else if (isInitWaiting) + Initialize(_requestedIsFrontFacing, requestedFPS, rotate90Degree, autoPlayAfterInitialize); } } } @@ -218,11 +268,13 @@ public override bool rotate90Degree _rotate90Degree = value; if (hasInitDone) Initialize(); + else if (isInitWaiting) + Initialize(autoPlayAfterInitialize); } } } - public override ColorFormat outputColorFormat + public override Source2MatHelperColorFormat outputColorFormat { get { return _outputColorFormat; } set @@ -232,6 +284,8 @@ public override ColorFormat outputColorFormat _outputColorFormat = value; if (hasInitDone) Initialize(); + else if (isInitWaiting) + Initialize(autoPlayAfterInitialize); } } } @@ -243,13 +297,13 @@ public override float requestedFPS { _requestedFPS = Mathf.Clamp(value, -1f, float.MaxValue); if (hasInitDone) - { Initialize(); - } + else if (isInitWaiting) + Initialize(autoPlayAfterInitialize); } } - new protected ColorFormat baseColorFormat = ColorFormat.BGRA; + new protected Source2MatHelperColorFormat baseColorFormat = Source2MatHelperColorFormat.BGRA; protected System.Object lockObject = new System.Object(); protected System.Object matrixLockObject = new System.Object(); @@ -426,7 +480,7 @@ protected virtual void OnFrameSampleAcquired(VideoCaptureSample sample) if (hasInitEventCompleted && frameMatAcquired != null) { - Mat mat = new Mat(frameSampleHeight, frameSampleWidth, CvType.CV_8UC(Channels(outputColorFormat))); + Mat mat = new Mat(frameSampleHeight, frameSampleWidth, CvType.CV_8UC(Source2MatHelperUtils.Channels(outputColorFormat))); if (baseColorFormat == outputColorFormat) { @@ -434,14 +488,14 @@ protected virtual void OnFrameSampleAcquired(VideoCaptureSample sample) } else { - Mat baseMat = new Mat(frameSampleHeight, frameSampleWidth, CvType.CV_8UC(Channels(baseColorFormat))); + Mat baseMat = new Mat(frameSampleHeight, frameSampleWidth, CvType.CV_8UC(Source2MatHelperUtils.Channels(baseColorFormat))); MatUtils.copyToMat(latestImageBytes, baseMat); - Imgproc.cvtColor(baseMat, mat, ColorConversionCodes(baseColorFormat, outputColorFormat)); + Imgproc.cvtColor(baseMat, mat, Source2MatHelperUtils.ColorConversionCodes(baseColorFormat, outputColorFormat)); } if (_rotate90Degree) { - Mat rotatedFrameMat = new Mat(frameSampleWidth, frameSampleHeight, CvType.CV_8UC(Channels(outputColorFormat))); + Mat rotatedFrameMat = new Mat(frameSampleWidth, frameSampleHeight, CvType.CV_8UC(Source2MatHelperUtils.Channels(outputColorFormat))); Core.rotate(mat, rotatedFrameMat, Core.ROTATE_90_CLOCKWISE); mat.Dispose(); @@ -470,7 +524,7 @@ protected virtual HoloLensCameraStream.CameraParameters CreateCameraParams(HoloL cameraParams.cameraResolutionHeight = resolution.height; cameraParams.cameraResolutionWidth = resolution.width; cameraParams.frameRate = Mathf.RoundToInt(frameRate); - cameraParams.pixelFormat = (outputColorFormat == ColorFormat.GRAY) ? CapturePixelFormat.NV12 : CapturePixelFormat.BGRA32; + cameraParams.pixelFormat = (outputColorFormat == Source2MatHelperColorFormat.GRAY) ? CapturePixelFormat.NV12 : CapturePixelFormat.BGRA32; cameraParams.rotateImage180Degrees = false; cameraParams.enableHolograms = false; cameraParams.enableVideoStabilization = false; @@ -481,7 +535,7 @@ protected virtual HoloLensCameraStream.CameraParameters CreateCameraParams(HoloL #endif /// - /// Returns the video capture. + /// Return the video capture. /// /// The video capture. public virtual HoloLensCameraStream.VideoCapture GetVideoCapture() @@ -574,7 +628,7 @@ protected override void OnDestroy() } /// - /// Initializes this instance by coroutine. + /// Initialize this instance by coroutine. /// protected override IEnumerator _Initialize() { @@ -595,6 +649,10 @@ protected override IEnumerator _Initialize() isInitWaiting = true; + // Wait one frame before starting initialization process + yield return null; + + while (isChangeVideoModeWaiting) { yield return null; @@ -615,7 +673,7 @@ protected override IEnumerator _Initialize() CancelInitCoroutine(); if (onErrorOccurred != null) - onErrorOccurred.Invoke(ErrorCode.UNKNOWN); + onErrorOccurred.Invoke(Source2MatHelperErrorCode.UNKNOWN, "!result2.success"); } else { @@ -660,7 +718,7 @@ protected override IEnumerator _Initialize() CancelInitCoroutine(); if (onErrorOccurred != null) - onErrorOccurred.Invoke(ErrorCode.CAMERA_DEVICE_NOT_EXIST); + onErrorOccurred.Invoke(Source2MatHelperErrorCode.CAMERA_DEVICE_NOT_EXIST, "Did not find a video capture object. You may not be using the HoloLens."); return; } @@ -687,7 +745,7 @@ protected override IEnumerator _Initialize() CancelInitCoroutine(); if (onErrorOccurred != null) - onErrorOccurred.Invoke(ErrorCode.UNKNOWN); + onErrorOccurred.Invoke(Source2MatHelperErrorCode.UNKNOWN, "!result.success"); } else { @@ -709,11 +767,11 @@ protected override IEnumerator _Initialize() } else if (didUpdateThisFrame) { - Debug.Log("HololensCameraStreamToMatHelper:: " + "name:" + "" + " width:" + frameSampleWidth + " height:" + frameSampleHeight + " fps:" + cameraParams.frameRate); + Debug.Log("HLCameraStream2MatHelper:: " + "name:" + "" + " width:" + frameSampleWidth + " height:" + frameSampleHeight + " fps:" + cameraParams.frameRate); - baseColorFormat = (outputColorFormat == ColorFormat.GRAY) ? ColorFormat.GRAY : ColorFormat.BGRA; + baseColorFormat = (outputColorFormat == Source2MatHelperColorFormat.GRAY) ? Source2MatHelperColorFormat.GRAY : Source2MatHelperColorFormat.BGRA; - baseMat = new Mat(frameSampleHeight, frameSampleWidth, CvType.CV_8UC(Channels(baseColorFormat))); + baseMat = new Mat(frameSampleHeight, frameSampleWidth, CvType.CV_8UC(Source2MatHelperUtils.Channels(baseColorFormat))); if (baseColorFormat == outputColorFormat) { @@ -721,11 +779,11 @@ protected override IEnumerator _Initialize() } else { - frameMat = new Mat(baseMat.rows(), baseMat.cols(), CvType.CV_8UC(Channels(outputColorFormat))); + frameMat = new Mat(baseMat.rows(), baseMat.cols(), CvType.CV_8UC(Source2MatHelperUtils.Channels(outputColorFormat))); } if (_rotate90Degree) - rotatedFrameMat = new Mat(frameMat.cols(), frameMat.rows(), CvType.CV_8UC(Channels(outputColorFormat))); + rotatedFrameMat = new Mat(frameMat.cols(), frameMat.rows(), CvType.CV_8UC(Source2MatHelperUtils.Channels(outputColorFormat))); isInitWaiting = false; hasInitDone = true; @@ -763,7 +821,7 @@ protected override IEnumerator _Initialize() initCoroutine = null; if (onErrorOccurred != null) - onErrorOccurred.Invoke(ErrorCode.TIMEOUT); + onErrorOccurred.Invoke(Source2MatHelperErrorCode.TIMEOUT, string.Empty); } else { @@ -771,13 +829,13 @@ protected override IEnumerator _Initialize() initCoroutine = null; if (onErrorOccurred != null) - onErrorOccurred.Invoke(ErrorCode.TIMEOUT); + onErrorOccurred.Invoke(Source2MatHelperErrorCode.TIMEOUT, string.Empty); } } } /// - /// Indicates whether this instance has been initialized. + /// Indicate whether this instance has been initialized. /// /// true, if this instance has been initialized, false otherwise. public override bool IsInitialized() @@ -786,7 +844,7 @@ public override bool IsInitialized() } /// - /// Starts the camera. + /// Start the active camera. /// public override void Play() { @@ -811,7 +869,7 @@ protected virtual IEnumerator _Play() } /// - /// Pauses the active camera. + /// Pause the active camera. /// public override void Pause() { @@ -820,7 +878,7 @@ public override void Pause() } /// - /// Stops the active camera. + /// Stop the active camera. /// public override void Stop() { @@ -845,7 +903,7 @@ protected virtual IEnumerator _Stop() } /// - /// Indicates whether the active camera is currently playing. + /// Indicate whether the active camera is currently playing. /// /// true, if the active camera is playing, false otherwise. public override bool IsPlaying() @@ -857,7 +915,7 @@ public override bool IsPlaying() } /// - /// Indicates whether the active camera device is currently front facng. + /// Indicate whether the active camera device is currently front facng. /// /// true, if the active camera device is front facng, false otherwise. public override bool IsFrontFacing() @@ -866,7 +924,7 @@ public override bool IsFrontFacing() } /// - /// Returns the active camera device name. + /// Return the active camera device name. /// /// The active camera device name. public override string GetDeviceName() @@ -875,7 +933,7 @@ public override string GetDeviceName() } /// - /// Returns the active camera width. + /// Return the active camera width. /// /// The active camera width. public override int GetWidth() @@ -886,7 +944,7 @@ public override int GetWidth() } /// - /// Returns the active camera height. + /// Return the active camera height. /// /// The active camera height. public override int GetHeight() @@ -897,7 +955,7 @@ public override int GetHeight() } /// - /// Returns the active camera framerate. + /// Return the active camera framerate. /// /// The active camera framerate. public override float GetFPS() @@ -906,16 +964,16 @@ public override float GetFPS() } /// - /// Returns the webcam texture. + /// Return the active WebcamTexture. /// - /// The webcam texture. + /// The active WebcamTexture. public override WebCamTexture GetWebCamTexture() { return null; } /// - /// Returns the camera to world matrix. + /// Return the camera to world matrix. /// /// The camera to world matrix. public override Matrix4x4 GetCameraToWorldMatrix() @@ -924,7 +982,7 @@ public override Matrix4x4 GetCameraToWorldMatrix() } /// - /// Returns the projection matrix matrix. + /// Return the projection matrix matrix. /// /// The projection matrix. public override Matrix4x4 GetProjectionMatrix() @@ -933,7 +991,7 @@ public override Matrix4x4 GetProjectionMatrix() } /// - /// Indicates whether the video buffer of the frame has been updated. + /// Indicate whether the video buffer of the frame has been updated. /// /// true, if the video buffer has been updated false otherwise. public override bool DidUpdateThisFrame() @@ -945,10 +1003,12 @@ public override bool DidUpdateThisFrame() } /// - /// Gets the mat of the current frame. + /// Get the mat of the current frame. + /// + /// /// The Mat object's type is 'CV_8UC4' or 'CV_8UC3' or 'CV_8UC1' (ColorFormat is determined by the outputColorFormat setting). /// Please do not dispose of the returned mat as it will be reused. - /// + /// /// The mat of the current frame. public override Mat GetMat() { @@ -964,7 +1024,7 @@ public override Mat GetMat() else { MatUtils.copyToMat(latestImageBytes, baseMat); - Imgproc.cvtColor(baseMat, frameMat, ColorConversionCodes(baseColorFormat, outputColorFormat)); + Imgproc.cvtColor(baseMat, frameMat, Source2MatHelperUtils.ColorConversionCodes(baseColorFormat, outputColorFormat)); } if (rotatedFrameMat != null) @@ -983,7 +1043,7 @@ public override Mat GetMat() } /// - /// Flips the mat. + /// Flip the mat. /// /// Mat. protected override void FlipMat(Mat mat, bool flipVertical, bool flipHorizontal) @@ -1067,12 +1127,12 @@ protected override void ReleaseResources() } /// - /// Releases all resource used by the object. + /// Releases all resource used by the object. /// - /// Call when you are finished using the . The - /// method leaves the in an unusable state. After - /// calling , you must release all references to the so - /// the garbage collector can reclaim the memory that the was occupying. + /// Call when you are finished using the . The + /// method leaves the in an unusable state. After + /// calling , you must release all references to the so + /// the garbage collector can reclaim the memory that the was occupying. public override void Dispose() { if (colors != null) diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStreamToMatHelper.cs.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStream2MatHelper.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStreamToMatHelper.cs.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStream2MatHelper.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.cs b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.cs similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.cs rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.cs diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.cs.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.cs.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.unity b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.unity similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.unity rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.unity diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.unity.meta b/HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.unity.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.unity.meta rename to HLWithOpenCVExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.unity.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/CameraParameters.cs b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/CameraParameters.cs similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/CameraParameters.cs rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/CameraParameters.cs diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/CameraParameters.cs.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/CameraParameters.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/CameraParameters.cs.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/CameraParameters.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.cs b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.cs similarity index 98% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.cs rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.cs index 085281a..5214e85 100644 --- a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.cs +++ b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.cs @@ -22,7 +22,7 @@ namespace HoloLensWithOpenCVForUnityExample /// An example of marker based AR using OpenCVForUnity on Hololens. /// Referring to https://github.com/opencv/opencv_contrib/blob/master/modules/aruco/samples/detect_markers.cpp. /// - [RequireComponent(typeof(HLCameraStreamToMatHelper), typeof(ImageOptimizationHelper))] + [RequireComponent(typeof(HLCameraStream2MatHelper), typeof(ImageOptimizationHelper))] public class HLArUcoExample : MonoBehaviour { [HeaderAttribute("Preview")] @@ -149,7 +149,7 @@ public class HLArUcoExample : MonoBehaviour /// /// The webcam texture to mat helper. /// - HLCameraStreamToMatHelper webCamTextureToMatHelper; + HLCameraStream2MatHelper webCamTextureToMatHelper; /// /// The image optimization helper. @@ -253,11 +253,11 @@ protected void Start() enableLerpFilterToggle.isOn = enableLerpFilter; imageOptimizationHelper = gameObject.GetComponent(); - webCamTextureToMatHelper = gameObject.GetComponent(); + webCamTextureToMatHelper = gameObject.GetComponent(); #if WINDOWS_UWP && !DISABLE_HOLOLENSCAMSTREAM_API webCamTextureToMatHelper.frameMatAcquired += OnFrameMatAcquired; #endif - webCamTextureToMatHelper.outputColorFormat = WebCamTextureToMatHelper.ColorFormat.GRAY; + webCamTextureToMatHelper.outputColorFormat = Source2MatHelperColorFormat.GRAY; webCamTextureToMatHelper.Initialize(); } @@ -506,12 +506,13 @@ public void OnWebCamTextureToMatHelperDisposed() } /// - /// Raises the web cam texture to mat helper error occurred event. + /// Raises the webcam texture to mat helper error occurred event. /// /// Error code. - public void OnWebCamTextureToMatHelperErrorOccurred(WebCamTextureToMatHelper.ErrorCode errorCode) + /// Message. + public void OnWebCamTextureToMatHelperErrorOccurred(Source2MatHelperErrorCode errorCode, string message) { - Debug.Log("OnWebCamTextureToMatHelperErrorOccurred " + errorCode); + Debug.Log("OnWebCamTextureToMatHelperErrorOccurred " + errorCode + ":" + message); } #if WINDOWS_UWP && !DISABLE_HOLOLENSCAMSTREAM_API diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.cs.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.cs.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.unity b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.unity similarity index 99% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.unity rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.unity index e367aa9..842e7d2 100644 --- a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.unity +++ b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.unity @@ -3395,8 +3395,8 @@ MonoBehaviour: _flipVertical: 0 _flipHorizontal: 0 _outputColorFormat: 0 - _timeoutFrameCount: 300 - onInitialized: + _timeoutFrameCount: 1500 + _onInitialized: m_PersistentCalls: m_Calls: - m_Target: {fileID: 1709852086} @@ -3411,7 +3411,7 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 - onDisposed: + _onDisposed: m_PersistentCalls: m_Calls: - m_Target: {fileID: 1709852086} @@ -3426,7 +3426,7 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 - onErrorOccurred: + _onErrorOccurred: m_PersistentCalls: m_Calls: - m_Target: {fileID: 1709852086} @@ -3441,7 +3441,6 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 - avoidAndroidFrontCameraLowLightIssue: 0 --- !u!114 &1709852084 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.unity.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.unity.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.unity.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/HLArUcoExample.unity.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials/ArUcoMaterial.mat b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials/ArUcoMaterial.mat similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials/ArUcoMaterial.mat rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials/ArUcoMaterial.mat diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials/ArUcoMaterial.mat.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials/ArUcoMaterial.mat.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials/ArUcoMaterial.mat.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLArUcoExample/Materials/ArUcoMaterial.mat.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsChecker.unity b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsChecker.unity similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsChecker.unity rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsChecker.unity diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsChecker.unity.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsChecker.unity.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsChecker.unity.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsChecker.unity.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsCheckerHelper.cs b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsCheckerHelper.cs similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsCheckerHelper.cs rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsCheckerHelper.cs diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsCheckerHelper.cs.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsCheckerHelper.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsCheckerHelper.cs.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraIntrinsicsChecker/HLCameraIntrinsicsCheckerHelper.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/ComicFilter.cs b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/ComicFilter.cs similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/ComicFilter.cs rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/ComicFilter.cs diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/ComicFilter.cs.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/ComicFilter.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/ComicFilter.cs.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/ComicFilter.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/HLCameraStreamToMatHelperExample.cs b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/HLCameraStream2MatHelperExample.cs similarity index 94% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/HLCameraStreamToMatHelperExample.cs rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/HLCameraStream2MatHelperExample.cs index f6da3ad..dd06d8d 100644 --- a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/HLCameraStreamToMatHelperExample.cs +++ b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/HLCameraStream2MatHelperExample.cs @@ -13,12 +13,12 @@ namespace HoloLensWithOpenCVForUnityExample { /// - /// HLCameraStreamToMatHelper Example + /// HLCameraStream2MatHelper Example /// An example of image processing (comic filter) using OpenCVForUnity on Hololens. /// Referring to http://dev.classmethod.jp/smartphone/opencv-manga-2/. /// - [RequireComponent(typeof(HLCameraStreamToMatHelper))] - public class HLCameraStreamToMatHelperExample : MonoBehaviour + [RequireComponent(typeof(HLCameraStream2MatHelper))] + public class HLCameraStream2MatHelperExample : MonoBehaviour { /// /// The rotate 90 degree toggle. @@ -73,7 +73,7 @@ public class HLCameraStreamToMatHelperExample : MonoBehaviour /// /// The web cam texture to mat helper. /// - HLCameraStreamToMatHelper webCamTextureToMatHelper; + HLCameraStream2MatHelper webCamTextureToMatHelper; readonly static Queue ExecuteOnMainThread = new Queue(); @@ -89,11 +89,11 @@ public class HLCameraStreamToMatHelperExample : MonoBehaviour // Use this for initialization protected void Start() { - webCamTextureToMatHelper = gameObject.GetComponent(); + webCamTextureToMatHelper = gameObject.GetComponent(); #if WINDOWS_UWP && !DISABLE_HOLOLENSCAMSTREAM_API webCamTextureToMatHelper.frameMatAcquired += OnFrameMatAcquired; #endif - webCamTextureToMatHelper.outputColorFormat = WebCamTextureToMatHelper.ColorFormat.BGRA; + webCamTextureToMatHelper.outputColorFormat = Source2MatHelperColorFormat.BGRA; webCamTextureToMatHelper.Initialize(); // Update GUI state @@ -184,12 +184,13 @@ public void OnWebCamTextureToMatHelperDisposed() } /// - /// Raises the web cam texture to mat helper error occurred event. + /// Raises the webcam texture to mat helper error occurred event. /// /// Error code. - public void OnWebCamTextureToMatHelperErrorOccurred(WebCamTextureToMatHelper.ErrorCode errorCode) + /// Message. + public void OnWebCamTextureToMatHelperErrorOccurred(Source2MatHelperErrorCode errorCode, string message) { - Debug.Log("OnWebCamTextureToMatHelperErrorOccurred " + errorCode); + Debug.Log("OnWebCamTextureToMatHelperErrorOccurred " + errorCode + ":" + message); } #if WINDOWS_UWP && !DISABLE_HOLOLENSCAMSTREAM_API @@ -214,8 +215,8 @@ public void OnFrameMatAcquired(Mat bgraMat, Matrix4x4 projectionMatrix, Matrix4x if (!webCamTextureToMatHelper.IsPlaying()) return; - // For BGRA or BGR format, use the fastMatToTexture2D method. - Utils.fastMatToTexture2D(bgraMat, texture); + // For BGRA or BGR format, use the matToTexture2DRaw method. + Utils.matToTexture2DRaw(bgraMat, texture); bgraMat.Dispose(); Matrix4x4 worldToCameraMatrix = cameraToWorldMatrix.inverse; @@ -278,8 +279,8 @@ void Update() DebugUtils.TrackTick(); - // For BGRA or BGR format, use the fastMatToTexture2D method. - Utils.fastMatToTexture2D(bgraMat, texture); + // For BGRA or BGR format, use the matToTexture2DRaw method. + Utils.matToTexture2DRaw(bgraMat, texture); } if (webCamTextureToMatHelper.IsPlaying()) diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/HLCameraStreamToMatHelperExample.cs.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/HLCameraStream2MatHelperExample.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/HLCameraStreamToMatHelperExample.cs.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/HLCameraStream2MatHelperExample.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/HLCameraStreamToMatHelperExample.unity b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/HLCameraStream2MatHelperExample.unity similarity index 99% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/HLCameraStreamToMatHelperExample.unity rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/HLCameraStream2MatHelperExample.unity index f43a3dd..d337cbe 100644 --- a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/HLCameraStreamToMatHelperExample.unity +++ b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/HLCameraStream2MatHelperExample.unity @@ -2715,8 +2715,8 @@ MonoBehaviour: _flipVertical: 0 _flipHorizontal: 0 _outputColorFormat: 4 - _timeoutFrameCount: 300 - onInitialized: + _timeoutFrameCount: 1500 + _onInitialized: m_PersistentCalls: m_Calls: - m_Target: {fileID: 1076083695} @@ -2731,7 +2731,7 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 - onDisposed: + _onDisposed: m_PersistentCalls: m_Calls: - m_Target: {fileID: 1076083695} @@ -2746,7 +2746,7 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 - onErrorOccurred: + _onErrorOccurred: m_PersistentCalls: m_Calls: - m_Target: {fileID: 1076083695} @@ -2761,7 +2761,6 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 - avoidAndroidFrontCameraLowLightIssue: 0 --- !u!1 &1083164659 GameObject: m_ObjectHideFlags: 0 diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/HLCameraStreamToMatHelperExample.unity.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/HLCameraStream2MatHelperExample.unity.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStreamToMatHelperExample/HLCameraStreamToMatHelperExample.unity.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLCameraStream2MatHelperExample/HLCameraStream2MatHelperExample.unity.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.cs b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.cs similarity index 94% rename from HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.cs rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.cs index 21d0dd0..b42c2c9 100644 --- a/HoloLensWithOpenCVForUnityExampleMRTK2/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.cs +++ b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.cs @@ -21,7 +21,7 @@ namespace HoloLensWithOpenCVForUnityExample /// An example of detecting face using OpenCVForUnity on Hololens. /// Referring to https://github.com/Itseez/opencv/blob/master/modules/objdetect/src/detection_based_tracker.cpp. /// - [RequireComponent(typeof(HLCameraStreamToMatHelper), typeof(ImageOptimizationHelper))] + [RequireComponent(typeof(HLCameraStream2MatHelper), typeof(ImageOptimizationHelper))] public class HLFaceDetectionExample : MonoBehaviour { /// @@ -67,7 +67,7 @@ public class HLFaceDetectionExample : MonoBehaviour /// /// The webcam texture to mat helper. /// - HLCameraStreamToMatHelper webCamTextureToMatHelper; + HLCameraStream2MatHelper webCamTextureToMatHelper; /// /// The image optimization helper. @@ -177,22 +177,72 @@ bool isDetectingInFrameArrivedThread public Text debugStr; + string cascade_filepath; + string cascade4Thread_filepath; + + /// + /// The CancellationTokenSource. + /// + CancellationTokenSource cts = new CancellationTokenSource(); + // Use this for initialization - protected void Start() + async void Start() { enableDownScaleToggle.isOn = enableDownScale; useSeparateDetectionToggle.isOn = useSeparateDetection; displayCameraImageToggle.isOn = displayCameraImage; imageOptimizationHelper = gameObject.GetComponent(); - webCamTextureToMatHelper = gameObject.GetComponent(); + webCamTextureToMatHelper = gameObject.GetComponent(); #if WINDOWS_UWP && !DISABLE_HOLOLENSCAMSTREAM_API webCamTextureToMatHelper.frameMatAcquired += OnFrameMatAcquired; #endif - webCamTextureToMatHelper.outputColorFormat = WebCamTextureToMatHelper.ColorFormat.GRAY; - webCamTextureToMatHelper.Initialize(); rectangleTracker = new RectangleTracker(); + + // Asynchronously retrieves the readable file path from the StreamingAssets directory. + if (debugStr != null) + { + debugStr.text = "Preparing file access..."; + } + + cascade_filepath = await Utils.getFilePathAsyncTask("OpenCVForUnity/objdetect/lbpcascade_frontalface.xml", cancellationToken: cts.Token); + //cascade4Thread_filepath = await Utils.getFilePathAsyncTask("OpenCVForUnity/objdetect/haarcascade_frontalface_alt.xml", cancellationToken: cts.Token); + cascade4Thread_filepath = await Utils.getFilePathAsyncTask("OpenCVForUnity/objdetect/lbpcascade_frontalface.xml", cancellationToken: cts.Token); + + if (debugStr != null) + { + debugStr.text = ""; + } + + Run(); + } + + // Use this for initialization + void Run() + { + cascade = new CascadeClassifier(); + cascade.load(cascade_filepath); +#if !WINDOWS_UWP || UNITY_EDITOR + // "empty" method is not working on the UWP platform. + if (cascade.empty()) + { + Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/OpenCVForUnity/objdetect/” to “Assets/StreamingAssets/OpenCVForUnity/objdetect/” folder. "); + } +#endif + + cascade4Thread = new CascadeClassifier(); + cascade4Thread.load(cascade4Thread_filepath); +#if !WINDOWS_UWP || UNITY_EDITOR + // "empty" method is not working on the UWP platform. + if (cascade4Thread.empty()) + { + Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/OpenCVForUnity/objdetect/” to “Assets/StreamingAssets/OpenCVForUnity/objdetect/” folder. "); + } +#endif + + webCamTextureToMatHelper.outputColorFormat = Source2MatHelperColorFormat.GRAY; + webCamTextureToMatHelper.Initialize(); } /// @@ -248,28 +298,7 @@ public void OnWebCamTextureToMatHelperInitialized() quad_renderer.sharedMaterial.SetFloat("_VignetteScale", 0.0f); - - cascade = new CascadeClassifier(); - cascade.load(Utils.getFilePath("OpenCVForUnity/objdetect/lbpcascade_frontalface.xml")); -#if !WINDOWS_UWP || UNITY_EDITOR - // "empty" method is not working on the UWP platform. - if (cascade.empty()) - { - Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/OpenCVForUnity/objdetect/” to “Assets/StreamingAssets/OpenCVForUnity/objdetect/” folder. "); - } -#endif - grayMat4Thread = new Mat(); - cascade4Thread = new CascadeClassifier(); - //cascade4Thread.load(Utils.getFilePath("OpenCVForUnity/objdetect/haarcascade_frontalface_alt.xml")); - cascade4Thread.load(Utils.getFilePath("OpenCVForUnity/objdetect/lbpcascade_frontalface.xml")); -#if !WINDOWS_UWP || UNITY_EDITOR - // "empty" method is not working on the UWP platform. - if (cascade4Thread.empty()) - { - Debug.LogError("cascade file is not loaded. Please copy from “OpenCVForUnity/StreamingAssets/OpenCVForUnity/objdetect/” to “Assets/StreamingAssets/OpenCVForUnity/objdetect/” folder. "); - } -#endif } /// @@ -295,15 +324,9 @@ public void OnWebCamTextureToMatHelperDisposed() hasUpdatedDetectionResult = false; isDetecting = false; - if (cascade != null) - cascade.Dispose(); - if (grayMat4Thread != null) grayMat4Thread.Dispose(); - if (cascade4Thread != null) - cascade4Thread.Dispose(); - rectangleTracker.Reset(); if (debugStr != null) @@ -314,12 +337,13 @@ public void OnWebCamTextureToMatHelperDisposed() } /// - /// Raises the web cam texture to mat helper error occurred event. + /// Raises the webcam texture to mat helper error occurred event. /// /// Error code. - public void OnWebCamTextureToMatHelperErrorOccurred(WebCamTextureToMatHelper.ErrorCode errorCode) + /// Message. + public void OnWebCamTextureToMatHelperErrorOccurred(Source2MatHelperErrorCode errorCode, string message) { - Debug.Log("OnWebCamTextureToMatHelperErrorOccurred " + errorCode); + Debug.Log("OnWebCamTextureToMatHelperErrorOccurred " + errorCode + ":" + message); } #if WINDOWS_UWP && !DISABLE_HOLOLENSCAMSTREAM_API @@ -795,6 +819,15 @@ void OnDestroy() if (rectangleTracker != null) rectangleTracker.Dispose(); + + if (cascade != null) + cascade.Dispose(); + + if (cascade4Thread != null) + cascade4Thread.Dispose(); + + if (cts != null) + cts.Dispose(); } /// diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.cs.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.cs.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.unity b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.unity similarity index 99% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.unity rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.unity index d7bb4f1..194a5b5 100644 --- a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.unity +++ b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.unity @@ -2131,8 +2131,8 @@ MonoBehaviour: _flipVertical: 0 _flipHorizontal: 0 _outputColorFormat: 0 - _timeoutFrameCount: 300 - onInitialized: + _timeoutFrameCount: 1500 + _onInitialized: m_PersistentCalls: m_Calls: - m_Target: {fileID: 1076083695} @@ -2147,7 +2147,7 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 - onDisposed: + _onDisposed: m_PersistentCalls: m_Calls: - m_Target: {fileID: 1076083695} @@ -2162,7 +2162,7 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 - onErrorOccurred: + _onErrorOccurred: m_PersistentCalls: m_Calls: - m_Target: {fileID: 1076083695} @@ -2177,7 +2177,6 @@ MonoBehaviour: m_StringArgument: m_BoolArgument: 0 m_CallState: 2 - avoidAndroidFrontCameraLowLightIssue: 0 --- !u!114 &1076083701 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.unity.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.unity.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.unity.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLFaceDetectionExample/HLFaceDetectionExample.unity.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.cs b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.cs similarity index 89% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.cs rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.cs index 23c99de..7d21c93 100644 --- a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.cs +++ b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.cs @@ -8,6 +8,7 @@ using OpenCVForUnity.ImgprocModule; using System.Collections; using System.Linq; +using System.Threading; #if UNITY_2018_2_OR_NEWER using UnityEngine.Windows.WebCam; @@ -40,12 +41,31 @@ public class HLPhotoCaptureExample : MonoBehaviour private CascadeClassifier cascade; private MatOfRect faces; - private IEnumerator Start() + /// + /// The CancellationTokenSource. + /// + CancellationTokenSource cts = new CancellationTokenSource(); + + // Use this for initialization + async void Start() { faces = new MatOfRect(); + // Asynchronously retrieves the readable file path from the StreamingAssets directory. + if (text != null) + { + text.text = "Preparing file access..."; + } + + string cascade_filepath = await Utils.getFilePathAsyncTask("OpenCVForUnity/objdetect/haarcascade_frontalface_alt.xml", cancellationToken: cts.Token); + + if (text != null) + { + text.text = ""; + } + cascade = new CascadeClassifier(); - cascade.load(Utils.getFilePath("OpenCVForUnity/objdetect/haarcascade_frontalface_alt.xml")); + cascade.load(cascade_filepath); var resolutions = PhotoCapture.SupportedResolutions; @@ -55,7 +75,7 @@ private IEnumerator Start() { text.text = "Resolutions not available. Did you provide web cam access?"; } - yield return null; + return; } cameraResolution = resolutions.OrderByDescending((res) => res.width * res.height).First(); @@ -83,6 +103,9 @@ private void OnDestroy() if (cascade != null) cascade.Dispose(); + + if (cts != null) + cts.Dispose(); } private void OnPhotoCaptureCreated(PhotoCapture captureObject) @@ -173,8 +196,8 @@ private void OnPhotoCaptured(PhotoCapture.PhotoCaptureResult result, PhotoCaptur Mat bgraMat = new Mat(targetTexture.height, targetTexture.width, CvType.CV_8UC4); Mat grayMat = new Mat(bgraMat.rows(), bgraMat.cols(), CvType.CV_8UC1); - // For BGRA or BGR format, use the fastTexture2DToMat method. - Utils.fastTexture2DToMat(targetTexture, bgraMat); + // For BGRA or BGR format, use the texture2DToMatRaw method. + Utils.texture2DToMatRaw(targetTexture, bgraMat); Imgproc.cvtColor(bgraMat, grayMat, Imgproc.COLOR_BGRA2GRAY); Imgproc.equalizeHist(grayMat, grayMat); @@ -195,8 +218,8 @@ private void OnPhotoCaptured(PhotoCapture.PhotoCaptureResult result, PhotoCaptur Imgproc.putText(bgraMat, targetTexture.format + " W:" + bgraMat.width() + " H:" + bgraMat.height(), new Point(5, bgraMat.rows() - 10), Imgproc.FONT_HERSHEY_SIMPLEX, 1.5, new Scalar(255, 0, 0, 255), 2, Imgproc.LINE_AA, false); - // For BGRA or BGR format, use the fastMatToTexture2D method. - Utils.fastMatToTexture2D(bgraMat, targetTexture); + // For BGRA or BGR format, use the matToTexture2DRaw method. + Utils.matToTexture2DRaw(bgraMat, targetTexture); bgraMat.Dispose(); grayMat.Dispose(); diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.cs.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.cs.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.unity b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.unity similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.unity rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.unity diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.unity.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.unity.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.unity.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HLPhotoCaptureExample/HLPhotoCaptureExample.unity.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.cs b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.cs similarity index 95% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.cs rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.cs index 0387003..9067247 100644 --- a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.cs +++ b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.cs @@ -88,9 +88,9 @@ public void OnHLPhotoCaptureExampleButtonClick() SceneManager.LoadScene("HLPhotoCaptureExample"); } - public void OnHLCameraStreamToMatHelperExampleButtonClick() + public void OnHLCameraStream2MatHelperExampleButtonClick() { - SceneManager.LoadScene("HLCameraStreamToMatHelperExample"); + SceneManager.LoadScene("HLCameraStream2MatHelperExample"); } public void OnHLFaceDetectionExampleButtonClick() diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.cs.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.cs.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.unity b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.unity similarity index 99% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.unity rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.unity index 202efc3..72b2747 100644 --- a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.unity +++ b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.unity @@ -2210,7 +2210,7 @@ GameObject: - component: {fileID: 1867454789} - component: {fileID: 1867454788} m_Layer: 5 - m_Name: HLCameraStreamToMatHelperExample + m_Name: HLCameraStream2MatHelperExample m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -2302,8 +2302,9 @@ MonoBehaviour: m_PersistentCalls: m_Calls: - m_Target: {fileID: 2004915444} - m_TargetAssemblyTypeName: - m_MethodName: OnHLCameraStreamToMatHelperExampleButtonClick + m_TargetAssemblyTypeName: HoloLensWithOpenCVForUnityExample.HoloLensWithOpenCVForUnityExample, + Assembly-CSharp + m_MethodName: OnHLCameraStream2MatHelperExampleButtonClick m_Mode: 1 m_Arguments: m_ObjectArgument: {fileID: 0} @@ -2422,7 +2423,7 @@ MonoBehaviour: m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 - m_Text: HLCameraStreamToMatHelper Example + m_Text: HLCameraStream2MatHelper Example --- !u!222 &1869573385 CanvasRenderer: m_ObjectHideFlags: 0 diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.unity.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.unity.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.unity.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/HoloLensWithOpenCVForUnityExample.unity.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlend.mat b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlend.mat similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlend.mat rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlend.mat diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlend.mat.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlend.mat.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlend.mat.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlend.mat.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlendGrayscale.mat b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlendGrayscale.mat similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlendGrayscale.mat rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlendGrayscale.mat diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlendGrayscale.mat.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlendGrayscale.mat.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlendGrayscale.mat.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/HolographicImageBlendGrayscale.mat.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePass.mat b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePass.mat similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePass.mat rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePass.mat diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePass.mat.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePass.mat.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePass.mat.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePass.mat.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePassGrayscale.mat b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePassGrayscale.mat similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePassGrayscale.mat rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePassGrayscale.mat diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePassGrayscale.mat.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePassGrayscale.mat.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePassGrayscale.mat.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Materials/TextureSinglePassGrayscale.mat.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/RectangleTracker.cs b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/RectangleTracker.cs similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/RectangleTracker.cs rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/RectangleTracker.cs diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/RectangleTracker.cs.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/RectangleTracker.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/RectangleTracker.cs.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/RectangleTracker.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedObject.cs b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedObject.cs similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedObject.cs rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedObject.cs diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedObject.cs.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedObject.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedObject.cs.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedObject.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedRect.cs b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedRect.cs similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedRect.cs rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedRect.cs diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedRect.cs.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedRect.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedRect.cs.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackedRect.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackerParameters.cs b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackerParameters.cs similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackerParameters.cs rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackerParameters.cs diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackerParameters.cs.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackerParameters.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackerParameters.cs.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/RectangleTracker/Scripts/TrackerParameters.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/ARGameObject.cs b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/ARGameObject.cs similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/ARGameObject.cs rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/ARGameObject.cs diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/ARGameObject.cs.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/ARGameObject.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/ARGameObject.cs.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/ARGameObject.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/DebugUtils.cs b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/DebugUtils.cs similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/DebugUtils.cs rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/DebugUtils.cs diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/DebugUtils.cs.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/DebugUtils.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/DebugUtils.cs.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/DebugUtils.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStreamToMatHelper.cs b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStream2MatHelper.cs similarity index 81% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStreamToMatHelper.cs rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStream2MatHelper.cs index 4436838..ce58b32 100644 --- a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStreamToMatHelper.cs +++ b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStream2MatHelper.cs @@ -25,30 +25,70 @@ namespace HoloLensWithOpenCVForUnity.UnityUtils.Helper /// This is called every time there is a new frame image mat available. /// The Mat object's type is 'CV_8UC4' or 'CV_8UC3' or 'CV_8UC1' (ColorFormat is determined by the outputColorFormat setting). /// - /// The recently captured frame image mat. + /// The recently captured frame image mat. /// The projection matrices. /// The camera to world matrices. /// The camera intrinsics. public delegate void FrameMatAcquiredCallback(Mat mat, Matrix4x4 projectionMatrix, Matrix4x4 cameraToWorldMatrix, CameraIntrinsics cameraIntrinsics); /// - /// Hololens camera stream to mat helper. - /// v 1.0.7 - /// Depends on EnoxSoftware/HoloLensCameraStream (https://github.com/EnoxSoftware/HoloLensCameraStream). - /// Depends on OpenCVForUnity version 2.4.1 (WebCamTextureToMatHelper v 1.1.2) or later. + /// A helper component class for obtaining camera frames from HoloLensCameraStream and converting them to OpenCV Mat format in real-time. + /// + /// + /// The HLCameraStream2MatHelper class captures video frames from a device's camera using HoloLensCameraStream + /// and converts each frame to an OpenCV Mat object every frame. + /// + /// This component is particularly useful for image processing tasks in Unity, such as computer vision applications, + /// where real-time camera input in Mat format is required. It enables seamless integration of OpenCV-based + /// image processing algorithms with HoloLens camera input. + /// + /// + /// FrameMatAcquiredCallback: + /// The FrameMatAcquiredCallback delegate is invoked each time a new frame is captured and converted to a Mat object. + /// This delegate wraps the HoloLensCameraStream.VideoCapture.FrameSampleAcquired callback to provide the frame data + /// in Mat format, along with the projection matrix, camera-to-world matrix, and camera intrinsics for the captured frame. + /// + /// + /// Usage Notes: + /// + /// + /// The callback is executed outside of the Unity application's main thread. To safely use Unity API functions or + /// update Unity objects within the callback, use UnityEngine.WSA.Application.InvokeOnAppThread(() => { ... }) + /// to dispatch operations to the application thread. + /// + /// + /// The Mat object passed to the callback is managed by the helper class and should not be stored for long-term use. + /// Copy the data if further processing is required beyond the callback's scope. + /// + /// + /// /// - /// By setting outputColorFormat to BGRA or GRAY, processing that does not include extra color conversion is performed. + /// Note: By setting outputColorFormat to BGRA or GRAY, processing that does not include extra color conversion is performed. + /// Note: Depends on EnoxSoftware/HoloLensCameraStream. + /// Note: Depends on OpenCVForUnity version 2.6.4 or later. + /// + /// + /// Attach this component to a GameObject and call GetMat() to retrieve the latest camera frame in Mat format. + /// The helper class manages camera start/stop operations and frame updates internally. + /// /// + /// /// Usage: /// Add Define Symbols: "Open File > Build Settings > Player Settings > Other Settings" and add the following to Scripting Define Symbols depending on the XR system used in your project. - /// This is the setup needed to get the correct values from the TryGetCameraToWorldMatrix method. - /// Legacy built-in XR ; "BUILTIN_XR" + /// + /// { + /// Legacy built-in XR : "BUILTIN_XR" /// XR Plugin Management(Windows Mixed Reality) : "XR_PLUGIN_WINDOWSMR" /// XR Plugin Management(OpenXR) : "XR_PLUGIN_OPENXR" + /// } + /// + /// /// - /// + /// /// Combination of camera frame size and frame rate that can be acquired on Hololens. (width x height : framerate) - /// (See https://learn.microsoft.com/en-us/windows/mixed-reality/develop/advanced-concepts/locatable-camera-overview) + /// https://learn.microsoft.com/en-us/windows/mixed-reality/develop/advanced-concepts/locatable-camera-overview + /// + /// { /// /// Hololens1 /// @@ -126,8 +166,10 @@ namespace HoloLensWithOpenCVForUnity.UnityUtils.Helper /// 424x240 : 30 /// 424x240 : 15 /// - /// - public class HLCameraStreamToMatHelper : WebCamTextureToMatHelper + /// } + /// + /// + public class HLCameraStream2MatHelper : WebCamTexture2MatHelper { /// /// This will be called whenever a new camera frame image available is converted to Mat. @@ -140,7 +182,7 @@ public class HLCameraStreamToMatHelper : WebCamTextureToMatHelper protected CameraIntrinsics cameraIntrinsics; /// - /// Returns the camera intrinsics. + /// Return the camera intrinsics. /// /// The camera intrinsics. public virtual CameraIntrinsics GetCameraIntrinsics() @@ -160,6 +202,8 @@ public override string requestedDeviceName _requestedDeviceName = value; if (hasInitDone) Initialize(); + else if (isInitWaiting) + Initialize(autoPlayAfterInitialize); } } } @@ -175,6 +219,8 @@ public override int requestedWidth _requestedWidth = _value; if (hasInitDone) Initialize(); + else if (isInitWaiting) + Initialize(autoPlayAfterInitialize); } } } @@ -190,6 +236,8 @@ public override int requestedHeight _requestedHeight = _value; if (hasInitDone) Initialize(); + else if (isInitWaiting) + Initialize(autoPlayAfterInitialize); } } } @@ -203,7 +251,9 @@ public override bool requestedIsFrontFacing { _requestedIsFrontFacing = value; if (hasInitDone) - Initialize(_requestedIsFrontFacing, requestedFPS, rotate90Degree); + Initialize(_requestedIsFrontFacing, requestedFPS, rotate90Degree, IsPlaying()); + else if (isInitWaiting) + Initialize(_requestedIsFrontFacing, requestedFPS, rotate90Degree, autoPlayAfterInitialize); } } } @@ -218,11 +268,13 @@ public override bool rotate90Degree _rotate90Degree = value; if (hasInitDone) Initialize(); + else if (isInitWaiting) + Initialize(autoPlayAfterInitialize); } } } - public override ColorFormat outputColorFormat + public override Source2MatHelperColorFormat outputColorFormat { get { return _outputColorFormat; } set @@ -232,6 +284,8 @@ public override ColorFormat outputColorFormat _outputColorFormat = value; if (hasInitDone) Initialize(); + else if (isInitWaiting) + Initialize(autoPlayAfterInitialize); } } } @@ -243,13 +297,13 @@ public override float requestedFPS { _requestedFPS = Mathf.Clamp(value, -1f, float.MaxValue); if (hasInitDone) - { Initialize(); - } + else if (isInitWaiting) + Initialize(autoPlayAfterInitialize); } } - new protected ColorFormat baseColorFormat = ColorFormat.BGRA; + new protected Source2MatHelperColorFormat baseColorFormat = Source2MatHelperColorFormat.BGRA; protected System.Object lockObject = new System.Object(); protected System.Object matrixLockObject = new System.Object(); @@ -426,7 +480,7 @@ protected virtual void OnFrameSampleAcquired(VideoCaptureSample sample) if (hasInitEventCompleted && frameMatAcquired != null) { - Mat mat = new Mat(frameSampleHeight, frameSampleWidth, CvType.CV_8UC(Channels(outputColorFormat))); + Mat mat = new Mat(frameSampleHeight, frameSampleWidth, CvType.CV_8UC(Source2MatHelperUtils.Channels(outputColorFormat))); if (baseColorFormat == outputColorFormat) { @@ -434,14 +488,14 @@ protected virtual void OnFrameSampleAcquired(VideoCaptureSample sample) } else { - Mat baseMat = new Mat(frameSampleHeight, frameSampleWidth, CvType.CV_8UC(Channels(baseColorFormat))); + Mat baseMat = new Mat(frameSampleHeight, frameSampleWidth, CvType.CV_8UC(Source2MatHelperUtils.Channels(baseColorFormat))); MatUtils.copyToMat(latestImageBytes, baseMat); - Imgproc.cvtColor(baseMat, mat, ColorConversionCodes(baseColorFormat, outputColorFormat)); + Imgproc.cvtColor(baseMat, mat, Source2MatHelperUtils.ColorConversionCodes(baseColorFormat, outputColorFormat)); } if (_rotate90Degree) { - Mat rotatedFrameMat = new Mat(frameSampleWidth, frameSampleHeight, CvType.CV_8UC(Channels(outputColorFormat))); + Mat rotatedFrameMat = new Mat(frameSampleWidth, frameSampleHeight, CvType.CV_8UC(Source2MatHelperUtils.Channels(outputColorFormat))); Core.rotate(mat, rotatedFrameMat, Core.ROTATE_90_CLOCKWISE); mat.Dispose(); @@ -470,7 +524,7 @@ protected virtual HoloLensCameraStream.CameraParameters CreateCameraParams(HoloL cameraParams.cameraResolutionHeight = resolution.height; cameraParams.cameraResolutionWidth = resolution.width; cameraParams.frameRate = Mathf.RoundToInt(frameRate); - cameraParams.pixelFormat = (outputColorFormat == ColorFormat.GRAY) ? CapturePixelFormat.NV12 : CapturePixelFormat.BGRA32; + cameraParams.pixelFormat = (outputColorFormat == Source2MatHelperColorFormat.GRAY) ? CapturePixelFormat.NV12 : CapturePixelFormat.BGRA32; cameraParams.rotateImage180Degrees = false; cameraParams.enableHolograms = false; cameraParams.enableVideoStabilization = false; @@ -481,7 +535,7 @@ protected virtual HoloLensCameraStream.CameraParameters CreateCameraParams(HoloL #endif /// - /// Returns the video capture. + /// Return the video capture. /// /// The video capture. public virtual HoloLensCameraStream.VideoCapture GetVideoCapture() @@ -574,7 +628,7 @@ protected override void OnDestroy() } /// - /// Initializes this instance by coroutine. + /// Initialize this instance by coroutine. /// protected override IEnumerator _Initialize() { @@ -595,6 +649,10 @@ protected override IEnumerator _Initialize() isInitWaiting = true; + // Wait one frame before starting initialization process + yield return null; + + while (isChangeVideoModeWaiting) { yield return null; @@ -615,7 +673,7 @@ protected override IEnumerator _Initialize() CancelInitCoroutine(); if (onErrorOccurred != null) - onErrorOccurred.Invoke(ErrorCode.UNKNOWN); + onErrorOccurred.Invoke(Source2MatHelperErrorCode.UNKNOWN, "!result2.success"); } else { @@ -660,7 +718,7 @@ protected override IEnumerator _Initialize() CancelInitCoroutine(); if (onErrorOccurred != null) - onErrorOccurred.Invoke(ErrorCode.CAMERA_DEVICE_NOT_EXIST); + onErrorOccurred.Invoke(Source2MatHelperErrorCode.CAMERA_DEVICE_NOT_EXIST, "Did not find a video capture object. You may not be using the HoloLens."); return; } @@ -687,7 +745,7 @@ protected override IEnumerator _Initialize() CancelInitCoroutine(); if (onErrorOccurred != null) - onErrorOccurred.Invoke(ErrorCode.UNKNOWN); + onErrorOccurred.Invoke(Source2MatHelperErrorCode.UNKNOWN, "!result.success"); } else { @@ -709,11 +767,11 @@ protected override IEnumerator _Initialize() } else if (didUpdateThisFrame) { - Debug.Log("HololensCameraStreamToMatHelper:: " + "name:" + "" + " width:" + frameSampleWidth + " height:" + frameSampleHeight + " fps:" + cameraParams.frameRate); + Debug.Log("HLCameraStream2MatHelper:: " + "name:" + "" + " width:" + frameSampleWidth + " height:" + frameSampleHeight + " fps:" + cameraParams.frameRate); - baseColorFormat = (outputColorFormat == ColorFormat.GRAY) ? ColorFormat.GRAY : ColorFormat.BGRA; + baseColorFormat = (outputColorFormat == Source2MatHelperColorFormat.GRAY) ? Source2MatHelperColorFormat.GRAY : Source2MatHelperColorFormat.BGRA; - baseMat = new Mat(frameSampleHeight, frameSampleWidth, CvType.CV_8UC(Channels(baseColorFormat))); + baseMat = new Mat(frameSampleHeight, frameSampleWidth, CvType.CV_8UC(Source2MatHelperUtils.Channels(baseColorFormat))); if (baseColorFormat == outputColorFormat) { @@ -721,11 +779,11 @@ protected override IEnumerator _Initialize() } else { - frameMat = new Mat(baseMat.rows(), baseMat.cols(), CvType.CV_8UC(Channels(outputColorFormat))); + frameMat = new Mat(baseMat.rows(), baseMat.cols(), CvType.CV_8UC(Source2MatHelperUtils.Channels(outputColorFormat))); } if (_rotate90Degree) - rotatedFrameMat = new Mat(frameMat.cols(), frameMat.rows(), CvType.CV_8UC(Channels(outputColorFormat))); + rotatedFrameMat = new Mat(frameMat.cols(), frameMat.rows(), CvType.CV_8UC(Source2MatHelperUtils.Channels(outputColorFormat))); isInitWaiting = false; hasInitDone = true; @@ -763,7 +821,7 @@ protected override IEnumerator _Initialize() initCoroutine = null; if (onErrorOccurred != null) - onErrorOccurred.Invoke(ErrorCode.TIMEOUT); + onErrorOccurred.Invoke(Source2MatHelperErrorCode.TIMEOUT, string.Empty); } else { @@ -771,13 +829,13 @@ protected override IEnumerator _Initialize() initCoroutine = null; if (onErrorOccurred != null) - onErrorOccurred.Invoke(ErrorCode.TIMEOUT); + onErrorOccurred.Invoke(Source2MatHelperErrorCode.TIMEOUT, string.Empty); } } } /// - /// Indicates whether this instance has been initialized. + /// Indicate whether this instance has been initialized. /// /// true, if this instance has been initialized, false otherwise. public override bool IsInitialized() @@ -786,7 +844,7 @@ public override bool IsInitialized() } /// - /// Starts the camera. + /// Start the active camera. /// public override void Play() { @@ -811,7 +869,7 @@ protected virtual IEnumerator _Play() } /// - /// Pauses the active camera. + /// Pause the active camera. /// public override void Pause() { @@ -820,7 +878,7 @@ public override void Pause() } /// - /// Stops the active camera. + /// Stop the active camera. /// public override void Stop() { @@ -845,7 +903,7 @@ protected virtual IEnumerator _Stop() } /// - /// Indicates whether the active camera is currently playing. + /// Indicate whether the active camera is currently playing. /// /// true, if the active camera is playing, false otherwise. public override bool IsPlaying() @@ -857,7 +915,7 @@ public override bool IsPlaying() } /// - /// Indicates whether the active camera device is currently front facng. + /// Indicate whether the active camera device is currently front facng. /// /// true, if the active camera device is front facng, false otherwise. public override bool IsFrontFacing() @@ -866,7 +924,7 @@ public override bool IsFrontFacing() } /// - /// Returns the active camera device name. + /// Return the active camera device name. /// /// The active camera device name. public override string GetDeviceName() @@ -875,7 +933,7 @@ public override string GetDeviceName() } /// - /// Returns the active camera width. + /// Return the active camera width. /// /// The active camera width. public override int GetWidth() @@ -886,7 +944,7 @@ public override int GetWidth() } /// - /// Returns the active camera height. + /// Return the active camera height. /// /// The active camera height. public override int GetHeight() @@ -897,7 +955,7 @@ public override int GetHeight() } /// - /// Returns the active camera framerate. + /// Return the active camera framerate. /// /// The active camera framerate. public override float GetFPS() @@ -906,16 +964,16 @@ public override float GetFPS() } /// - /// Returns the webcam texture. + /// Return the active WebcamTexture. /// - /// The webcam texture. + /// The active WebcamTexture. public override WebCamTexture GetWebCamTexture() { return null; } /// - /// Returns the camera to world matrix. + /// Return the camera to world matrix. /// /// The camera to world matrix. public override Matrix4x4 GetCameraToWorldMatrix() @@ -924,7 +982,7 @@ public override Matrix4x4 GetCameraToWorldMatrix() } /// - /// Returns the projection matrix matrix. + /// Return the projection matrix matrix. /// /// The projection matrix. public override Matrix4x4 GetProjectionMatrix() @@ -933,7 +991,7 @@ public override Matrix4x4 GetProjectionMatrix() } /// - /// Indicates whether the video buffer of the frame has been updated. + /// Indicate whether the video buffer of the frame has been updated. /// /// true, if the video buffer has been updated false otherwise. public override bool DidUpdateThisFrame() @@ -945,10 +1003,12 @@ public override bool DidUpdateThisFrame() } /// - /// Gets the mat of the current frame. + /// Get the mat of the current frame. + /// + /// /// The Mat object's type is 'CV_8UC4' or 'CV_8UC3' or 'CV_8UC1' (ColorFormat is determined by the outputColorFormat setting). /// Please do not dispose of the returned mat as it will be reused. - /// + /// /// The mat of the current frame. public override Mat GetMat() { @@ -964,7 +1024,7 @@ public override Mat GetMat() else { MatUtils.copyToMat(latestImageBytes, baseMat); - Imgproc.cvtColor(baseMat, frameMat, ColorConversionCodes(baseColorFormat, outputColorFormat)); + Imgproc.cvtColor(baseMat, frameMat, Source2MatHelperUtils.ColorConversionCodes(baseColorFormat, outputColorFormat)); } if (rotatedFrameMat != null) @@ -983,7 +1043,7 @@ public override Mat GetMat() } /// - /// Flips the mat. + /// Flip the mat. /// /// Mat. protected override void FlipMat(Mat mat, bool flipVertical, bool flipHorizontal) @@ -1067,12 +1127,12 @@ protected override void ReleaseResources() } /// - /// Releases all resource used by the object. + /// Releases all resource used by the object. /// - /// Call when you are finished using the . The - /// method leaves the in an unusable state. After - /// calling , you must release all references to the so - /// the garbage collector can reclaim the memory that the was occupying. + /// Call when you are finished using the . The + /// method leaves the in an unusable state. After + /// calling , you must release all references to the so + /// the garbage collector can reclaim the memory that the was occupying. public override void Dispose() { if (colors != null) diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStreamToMatHelper.cs.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStream2MatHelper.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStreamToMatHelper.cs.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/Scripts/Utils/HLCameraStream2MatHelper.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.cs b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.cs similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.cs rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.cs diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.cs.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.cs.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.cs.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.cs.meta diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.unity b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.unity similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.unity rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.unity diff --git a/HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.unity.meta b/HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.unity.meta similarity index 100% rename from HoloLensWithOpenCVForUnityExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.unity.meta rename to HLWithOpenCVExampleMRTK3/Assets/HoloLensWithOpenCVForUnityExample/ShowLicense.unity.meta diff --git a/README.md b/README.md index dba975e..412cada 100644 --- a/README.md +++ b/README.md @@ -8,11 +8,10 @@ ## Environment * HoloLens1 10.0.17763.316 / HoloLens2 22621.1399 * Windows 10 SDK 10.0.19041.0 / 10.0.22621.0 -* Unity 2019.4.40f1 (Built-in Render Pipeline / LegacyXR / MRTK 2.8.3 / DirectX 11 / Visual Studio 2019 MSVC v142) * Unity 2021.3.35f1 (Built-in Render Pipeline / OpenXR 1.11.1 / MRTK 2.8.3 / DirectX 11 / Visual Studio 2022 MSVC v143) * Unity 2021.3.35f1 (Built-in Render Pipeline / OpenXR 1.11.1 / MRTK 3.2.2 / DirectX 11 / Visual Studio 2022 MSVC v143) * [Mixed Reality Feature Tool](https://learn.microsoft.com/en-us/windows/mixed-reality/develop/unity/welcome-to-mr-feature-tool) -* [OpenCV for Unity](https://assetstore.unity.com/packages/tools/integration/opencv-for-unity-21088?aid=1011l4ehR) 2.6.3+ +* [OpenCV for Unity](https://assetstore.unity.com/packages/tools/integration/opencv-for-unity-21088?aid=1011l4ehR) 2.6.4+ * [EnoxSoftware/HoloLensCameraStream](https://github.com/EnoxSoftware/HoloLensCameraStream) @@ -43,22 +42,6 @@ * [Known issues in Unity versions and packages](https://learn.microsoft.com/en-us/windows/mixed-reality/develop/unity/known-issues) -## Setup (HoloLens1 / Unity 2019 (Built-in Render Pipeline / LegacyXR / MRTK 2 / DirectX 11 / Visual Studio 2019)) -1. Download the latest release unitypackage. -1. Create a new project. (`HoloLensWithOpenCVForUnityExample`) -1. Import the Microsoft Mixed Reality Toolkit. - * Add MRTK2 (Mixed Reality Toolkit - Mixed Reality Toolkit Foundation) to the project using "Mixed Reality Feature Tool". - * Follow the MRTK2 configuration dialog to set up the project. (XR System: Legacy Built-in XR) -1. Import the OpenCVForUnity. -1. Import the HoloLensCameraStream. -1. Import the HoloLensWithOpenCVForUnityExampleMRTK2.unitypackage. -1. Add the "Assets/HoloLensWithOpenCVForUnityExample/*.unity" files to the "Scenes In Build" list in the "Build Settings" window. -1. Configure settings in the "Project Settings" window. - * Add `BUILTIN_XR` to the list of Define Symbols. - * Enable `WebCam` Capabilties in Publishing settings tab. -1. Build the project; open it in VS2019, set the deployment target to `x86` and deploy it to the Hololens1 actual device. - - ## Setup (Unity 2021 (Built-in Render Pipeline / OpenXR / MRTK 2 / DirectX 11 / Visual Studio 2022)) 1. Download the latest release unitypackage. 1. Create a new project. (`HoloLensWithOpenCVForUnityExample`)