├── Assets ├── ARFoundationWithOpenCVForUnityExample │ ├── Resources │ │ ├── ARFoundationVersion.txt │ │ └── ARFoundationVersion.txt.meta │ ├── Editor │ │ ├── ARFoundationVersionRecorder.cs.meta │ │ └── ARFoundationVersionRecorder.cs │ ├── ShowLicense.unity.meta │ ├── ShowSystemInfo.unity.meta │ ├── Editor.meta │ ├── Resources.meta │ ├── Scripts.meta │ ├── Scripts │ │ ├── Utils.meta │ │ ├── ARGameObject.cs.meta │ │ ├── Utils │ │ │ ├── FpsMonitor.cs.meta │ │ │ ├── RuntimePermissionHelper.cs.meta │ │ │ ├── ARFoundationCamera2MatHelper.cs.meta │ │ │ ├── RuntimePermissionHelper.cs │ │ │ └── FpsMonitor.cs │ │ └── ARGameObject.cs │ ├── ARFoundationWithOpenCVForUnityExample.unity.meta │ ├── ARFoundationCameraArUcoExample.meta │ ├── ARFoundationCameraToMatExample.meta │ ├── ARFoundationCamera2MatHelperExample.meta │ ├── ARFoundationCameraArUcoExample │ │ ├── Materials.meta │ │ ├── ARFoundationCameraArUcoExample.unity.meta │ │ ├── Materials │ │ │ ├── ArUcoMaterial.mat.meta │ │ │ └── ArUcoMaterial.mat │ │ ├── LightEstimationManager.cs.meta │ │ ├── ARFoundationCameraArUcoExample.cs.meta │ │ ├── LightEstimationManager.cs │ │ └── ARFoundationCameraArUcoExample.cs │ ├── ARFoundationCameraToMatExample │ │ ├── ARFoundationCameraToMatExample.unity.meta │ │ ├── ConvertAsyncARFoundationCameraToMatExample.unity.meta │ │ ├── ARFoundationCameraToMatExample.cs.meta │ │ ├── ConvertAsyncARFoundationCameraToMatExample.cs.meta │ │ ├── ARFoundationCameraToMatExample.cs │ │ └── ConvertAsyncARFoundationCameraToMatExample.cs │ ├── ARFoundationCamera2MatHelperExample │ │ ├── ARFoundationCamera2MatHelperExample.unity.meta │ │ ├── ARFoundationCamera2MatHelperExample.cs.meta │ │ └── ARFoundationCamera2MatHelperExample.cs │ ├── ShowLicense.cs.meta │ ├── ShowSystemInfo.cs.meta │ ├── ARFoundationWithOpenCVForUnityExample.cs.meta │ ├── ShowLicense.cs │ ├── ARFoundationWithOpenCVForUnityExample.cs │ ├── ShowSystemInfo.cs │ └── ShowLicense.unity └── ARFoundationWithOpenCVForUnityExample.meta ├── screenshot01.jpg ├── screenshot02.jpg ├── CanonicalMarker-d10-i1-sp500-bb1.pdf ├── LICENSE └── README.md /Assets/ARFoundationWithOpenCVForUnityExample/Resources/ARFoundationVersion.txt: -------------------------------------------------------------------------------- 1 | 6.0.5 -------------------------------------------------------------------------------- /screenshot01.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/ARFoundationWithOpenCVForUnityExample/HEAD/screenshot01.jpg -------------------------------------------------------------------------------- /screenshot02.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/ARFoundationWithOpenCVForUnityExample/HEAD/screenshot02.jpg -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/Editor/ARFoundationVersionRecorder.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cdde02350f375ce42bbca463f89bb7d6 -------------------------------------------------------------------------------- /CanonicalMarker-d10-i1-sp500-bb1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EnoxSoftware/ARFoundationWithOpenCVForUnityExample/HEAD/CanonicalMarker-d10-i1-sp500-bb1.pdf -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: f7827ab9e65516d4186cfa915c022746 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ShowLicense.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 35efe0ba7a6b4134b9a704856ad77b3f 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ShowSystemInfo.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: c5b65cc0da033ec44af72f92b87f83a8 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/Editor.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: ab7f0fc9849f3ab48b9ed7f7ced4df5c 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/Resources.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 906a42cf939d6044cab0f1b933898dc7 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/Scripts.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 47f9ad1fe49625246982c6bc9d688d43 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/Scripts/Utils.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: a41ccd9c07503be4aac1bac118c37923 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/Resources/ARFoundationVersion.txt.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d800b664b8ad9e0409edfc1914339bde 3 | TextScriptImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ARFoundationWithOpenCVForUnityExample.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d1cd0680bb4945d4b8b989b98614cfd0 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ARFoundationCameraArUcoExample.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d4dccf9253a651f4e983f73d34af0ba5 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ARFoundationCameraToMatExample.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 27db608e05bfea94d941aae83d51ac50 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ARFoundationCamera2MatHelperExample.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 89729f062f8be4d4da8ec549f80b2b13 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ARFoundationCameraArUcoExample/Materials.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 4cd6a9349ad02fc4aa62064ae07d1d7e 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ARFoundationCameraArUcoExample/ARFoundationCameraArUcoExample.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e1798fc853e57934b837abf4836eaaef 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ARFoundationCameraToMatExample/ARFoundationCameraToMatExample.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: cc2014559c4ce654b90d0f5680039a99 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ARFoundationCamera2MatHelperExample/ARFoundationCamera2MatHelperExample.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 70ac0585ad0aac04580a3c59002f8246 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ARFoundationCameraToMatExample/ConvertAsyncARFoundationCameraToMatExample.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: fa8818b969fd792498eb425720d09412 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ARFoundationCameraArUcoExample/Materials/ArUcoMaterial.mat.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 0f32c8b81b28fbe438324d430a7f5fc8 3 | NativeFormatImporter: 4 | externalObjects: {} 5 | mainObjectFileID: 0 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ShowLicense.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d74622c03c0139244a807aa90a085ba4 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ShowSystemInfo.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: bc2da9132983daa47b3117c076eb6ee3 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/Scripts/ARGameObject.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 96d1f1ba465135148a5486a49cef1e3d 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/Scripts/Utils/FpsMonitor.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 745c797ec046df94aa423a66665a249c 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ARFoundationWithOpenCVForUnityExample.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5c50b93c0f9e1044c9e15c85dd244189 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/Scripts/Utils/RuntimePermissionHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: d561f63e222234f46bf39529a5407841 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/Scripts/Utils/ARFoundationCamera2MatHelper.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 035e8d345af099946bac2db2f77665ff 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ARFoundationCameraArUcoExample/LightEstimationManager.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 153ce291bc7b2e1499be0ca867c6525e 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ARFoundationCameraArUcoExample/ARFoundationCameraArUcoExample.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: e9dbb35b32a8a1e4f9de7c50e9ef806f 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ARFoundationCameraToMatExample/ARFoundationCameraToMatExample.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: b76b14898a0cfc246bb115e926532923 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ARFoundationCamera2MatHelperExample/ARFoundationCamera2MatHelperExample.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 14f633b00f058c04494e8e6de7d1b072 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ARFoundationCameraToMatExample/ConvertAsyncARFoundationCameraToMatExample.cs.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 3387c20bb422168428a7b0d075d78475 3 | MonoImporter: 4 | externalObjects: {} 5 | serializedVersion: 2 6 | defaultReferences: [] 7 | executionOrder: 0 8 | icon: {instanceID: 0} 9 | userData: 10 | assetBundleName: 11 | assetBundleVariant: 12 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ShowLicense.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.SceneManagement; 3 | 4 | namespace ARFoundationWithOpenCVForUnityExample 5 | { 6 | 7 | public class ShowLicense : MonoBehaviour 8 | { 9 | 10 | public void OnBackButtonClick() 11 | { 12 | SceneManager.LoadScene("ARFoundationWithOpenCVForUnityExample"); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Enox Software 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/Editor/ARFoundationVersionRecorder.cs: -------------------------------------------------------------------------------- 1 | #if UNITY_EDITOR 2 | using UnityEditor; 3 | using UnityEditor.PackageManager; 4 | using UnityEditor.PackageManager.Requests; 5 | using UnityEngine; 6 | using UnityEngine.Scripting; 7 | using System.IO; 8 | 9 | [InitializeOnLoad] 10 | public static class ARFoundationVersionRecorder 11 | { 12 | static ListRequest _request; 13 | 14 | static ARFoundationVersionRecorder() 15 | { 16 | EditorApplication.delayCall += StartVersionCheck; 17 | } 18 | 19 | static void StartVersionCheck() 20 | { 21 | _request = Client.List(true); // true = include indirect dependencies 22 | EditorApplication.update += CheckRequest; 23 | } 24 | 25 | static void CheckRequest() 26 | { 27 | if (!_request.IsCompleted) 28 | return; 29 | 30 | if (_request.Status == StatusCode.Success) 31 | { 32 | foreach (var package in _request.Result) 33 | { 34 | if (package.name == "com.unity.xr.arfoundation") 35 | { 36 | string version = package.version; 37 | string path = "Assets/ARFoundationWithOpenCVForUnityExample/Resources/ARFoundationVersion.txt"; 38 | 39 | Directory.CreateDirectory(Path.GetDirectoryName(path)); 40 | File.WriteAllText(path, version); 41 | 42 | //Debug.Log($"[ARFoundationVersionRecorder] ARFoundation version: {version} written to: {path}"); 43 | break; 44 | } 45 | } 46 | } 47 | else if (_request.Status >= StatusCode.Failure) 48 | { 49 | Debug.LogError($"[ARFoundationVersionRecorder] Failed to get ARFoundation version: {_request.Error.message}"); 50 | } 51 | 52 | EditorApplication.update -= CheckRequest; 53 | } 54 | } 55 | #endif 56 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ARFoundationCameraArUcoExample/Materials/ArUcoMaterial.mat: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!21 &2100000 4 | Material: 5 | serializedVersion: 6 6 | m_ObjectHideFlags: 0 7 | m_CorrespondingSourceObject: {fileID: 0} 8 | m_PrefabInstance: {fileID: 0} 9 | m_PrefabAsset: {fileID: 0} 10 | m_Name: ArUcoMaterial 11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} 12 | m_ShaderKeywords: _ALPHABLEND_ON _EMISSION 13 | m_LightmapFlags: 1 14 | m_EnableInstancingVariants: 0 15 | m_DoubleSidedGI: 0 16 | m_CustomRenderQueue: 3000 17 | stringTagMap: 18 | RenderType: Transparent 19 | disabledShaderPasses: [] 20 | m_SavedProperties: 21 | serializedVersion: 3 22 | m_TexEnvs: 23 | - _BumpMap: 24 | m_Texture: {fileID: 0} 25 | m_Scale: {x: 1, y: 1} 26 | m_Offset: {x: 0, y: 0} 27 | - _DetailAlbedoMap: 28 | m_Texture: {fileID: 0} 29 | m_Scale: {x: 1, y: 1} 30 | m_Offset: {x: 0, y: 0} 31 | - _DetailMask: 32 | m_Texture: {fileID: 0} 33 | m_Scale: {x: 1, y: 1} 34 | m_Offset: {x: 0, y: 0} 35 | - _DetailNormalMap: 36 | m_Texture: {fileID: 0} 37 | m_Scale: {x: 1, y: 1} 38 | m_Offset: {x: 0, y: 0} 39 | - _EmissionMap: 40 | m_Texture: {fileID: 0} 41 | m_Scale: {x: 1, y: 1} 42 | m_Offset: {x: 0, y: 0} 43 | - _MainTex: 44 | m_Texture: {fileID: 0} 45 | m_Scale: {x: 1, y: 1} 46 | m_Offset: {x: 0, y: 0} 47 | - _MetallicGlossMap: 48 | m_Texture: {fileID: 0} 49 | m_Scale: {x: 1, y: 1} 50 | m_Offset: {x: 0, y: 0} 51 | - _OcclusionMap: 52 | m_Texture: {fileID: 0} 53 | m_Scale: {x: 1, y: 1} 54 | m_Offset: {x: 0, y: 0} 55 | - _ParallaxMap: 56 | m_Texture: {fileID: 0} 57 | m_Scale: {x: 1, y: 1} 58 | m_Offset: {x: 0, y: 0} 59 | m_Floats: 60 | - _BumpScale: 1 61 | - _Cutoff: 0.5 62 | - _DetailNormalMapScale: 1 63 | - _DstBlend: 10 64 | - _EmissionScaleUI: 0 65 | - _GlossMapScale: 1 66 | - _Glossiness: 0.5 67 | - _GlossyReflections: 1 68 | - _Metallic: 0 69 | - _Mode: 2 70 | - _OcclusionStrength: 1 71 | - _Parallax: 0.02 72 | - _SmoothnessTextureChannel: 0 73 | - _SpecularHighlights: 1 74 | - _SrcBlend: 5 75 | - _UVSec: 0 76 | - _ZWrite: 0 77 | m_Colors: 78 | - _Color: {r: 1, g: 0, b: 0, a: 1} 79 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} 80 | - _EmissionColorUI: {r: 1, g: 1, b: 1, a: 1} 81 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ARFoundation With OpenCVForUnity Example 2 | - An example of integrating ARFoundation with OpenCVForUnity. 3 | - An example of replacing WebCamTextureToMatHelper with ARFoundationCameraToMatHelper. 4 | - An example of ArUco marker detection from an ARFoundation camera image and overlaying AR object." 5 | 6 | 7 | ## Environment 8 | - Android (Pixel, Galaxy S10+) / iOS (iPhoneSE2) 9 | - Unity >= 6000.0.51f1+ 10 | - Scripting backend MONO / IL2CPP 11 | - [AR Foundation] 6.0.5+ (To use ARFoundation 5.xx, add 'USE_ARFOUNDATION_5' to the 'Scripting Define Symbols' in the Project Settings) 12 | - [ARCore XR Plugin] 6.0.5+ 13 | - [ARKit XR Plugin] 6.0.5+ 14 | - [OpenCV for Unity](https://assetstore.unity.com/packages/tools/integration/opencv-for-unity-21088?aid=1011l4ehR) 3.0.0+ 15 | 16 | 17 | ## Demo 18 | - Android [ARFoundationWithOpenCVForUnityExample.apk](https://github.com/EnoxSoftware/ARFoundationWithOpenCVForUnityExample/releases) 19 | 20 | 21 | ## Setup 22 | 1. Download the latest release unitypackage. [ARFoundationWithOpenCVForUnityExample.unitypackage](https://github.com/EnoxSoftware/ARFoundationWithOpenCVForUnityExample/releases) 23 | 1. Create a new project. (ARFoundationWithOpenCVForUnityExample) 24 | 1. Install AR Foundation from Package Manager. 25 | 1. Install ARCore XR Plugin from Package Manager. 26 | 1. Install ARKit XR Plugin from Package Manager. 27 | 1. Import OpenCVForUnity. 28 | * Setup the OpenCVForUnity. (Tools > OpenCV for Unity > Set Plugin Import Settings) 29 | 1. Import the ARFoundationWithOpenCVForUnityExample.unitypackage. 30 | 1. Change the "Player Settings (Androd)" Inspector as follows. 31 | * Graphics APIs : OpenGLES 3 (Remove "Vulkan" from the Graphics APIs list) 32 | * Minimum API Level : Android 7.0 (API Level 24) 33 | 1. Open the menu "Edit => Project Settings => XR Plug-in Management (Android)" and check "ARCore". 34 | 1. Change the "Player Settings (iOS)" Inspector as follows. 35 | * Camera Usage Description : "Required for augmented reality support." 36 | * Target minimum iOS Version : 12.0 37 | * Architecture : ARM64 38 | 1. Open the menu "Edit => Project Settings => XR Plug-in Management (iOS)" and check "ARKit". 39 | * (It seems that the camera cannot switch to the inner camera unless the Face tracking subsystem is enabled here.) 40 | 1. Add the "Assets/ARFoundationWithOpenCVForUnityExample/*.unity" files to the "Scenes In Build" list in the "Build Settings" window. 41 | 1. Build and Deploy to Android and iOS. 42 | * (Print the AR marker "CanonicalMarker-d10-i1-sp500-bb1.pdf" on an A4 size paper) 43 | 44 | 45 | ## ScreenShot 46 | ![screenshot01.jpg](screenshot01.jpg) 47 | ![screenshot02.jpg](screenshot02.jpg) 48 | -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ARFoundationCameraArUcoExample/LightEstimationManager.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Rendering; 3 | using UnityEngine.XR.ARFoundation; 4 | 5 | namespace ARFoundationWithOpenCVForUnityExample 6 | { 7 | public class LightEstimationManager : MonoBehaviour 8 | { 9 | public ARCameraManager cameraManager; 10 | private Light _light; 11 | 12 | void Awake() 13 | { 14 | _light = GetComponent(); 15 | } 16 | 17 | void OnEnable() 18 | { 19 | if (cameraManager != null) 20 | { 21 | cameraManager.frameReceived += FrameChanged; 22 | } 23 | } 24 | 25 | void OnDisable() 26 | { 27 | if (cameraManager != null) 28 | { 29 | cameraManager.frameReceived -= FrameChanged; 30 | } 31 | } 32 | 33 | void FrameChanged(ARCameraFrameEventArgs args) 34 | { 35 | if (args.lightEstimation.averageBrightness.HasValue) 36 | { 37 | float? averageBrightness = args.lightEstimation.averageBrightness.Value; 38 | _light.intensity = averageBrightness.Value; 39 | } 40 | 41 | if (args.lightEstimation.averageColorTemperature.HasValue) 42 | { 43 | float? averageColorTemperature = args.lightEstimation.averageColorTemperature.Value; 44 | _light.colorTemperature = averageColorTemperature.Value; 45 | } 46 | 47 | if (args.lightEstimation.colorCorrection.HasValue) 48 | { 49 | Color? colorCorrection = args.lightEstimation.colorCorrection.Value; 50 | _light.color = colorCorrection.Value; 51 | } 52 | 53 | if (args.lightEstimation.ambientSphericalHarmonics.HasValue) 54 | { 55 | SphericalHarmonicsL2? sphericalHarmonics = args.lightEstimation.ambientSphericalHarmonics; 56 | RenderSettings.ambientMode = AmbientMode.Skybox; 57 | RenderSettings.ambientProbe = sphericalHarmonics.Value; 58 | } 59 | 60 | if (args.lightEstimation.mainLightDirection.HasValue) 61 | { 62 | Vector3? mainLightDirection = args.lightEstimation.mainLightDirection; 63 | _light.transform.rotation = Quaternion.LookRotation(mainLightDirection.Value); 64 | } 65 | 66 | if (args.lightEstimation.mainLightColor.HasValue) 67 | { 68 | Color? mainLightColor = args.lightEstimation.mainLightColor; 69 | _light.color = mainLightColor.Value; 70 | } 71 | 72 | if (args.lightEstimation.averageMainLightBrightness.HasValue) 73 | { 74 | float? averageMainLightBrightness = args.lightEstimation.averageMainLightBrightness; 75 | _light.intensity = averageMainLightBrightness.Value; 76 | } 77 | } 78 | } 79 | } -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ARFoundationWithOpenCVForUnityExample.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using OpenCVForUnity.UnityIntegration; 3 | using UnityEngine; 4 | using UnityEngine.SceneManagement; 5 | using UnityEngine.UI; 6 | 7 | namespace ARFoundationWithOpenCVForUnityExample 8 | { 9 | 10 | public class ARFoundationWithOpenCVForUnityExample : MonoBehaviour 11 | { 12 | 13 | public static string GetARFoundationVersion() 14 | { 15 | return Resources.Load("ARFoundationVersion").text; 16 | } 17 | 18 | [Header("UI")] 19 | public Text exampleTitle; 20 | public Text versionInfo; 21 | public ScrollRect scrollRect; 22 | private static float verticalNormalizedPosition = 1f; 23 | 24 | void Awake() 25 | { 26 | //QualitySettings.vSyncCount = 0; 27 | //Application.targetFrameRate = 60; 28 | } 29 | 30 | IEnumerator Start() 31 | { 32 | 33 | exampleTitle.text = "ARFoundationWithOpenCVForUnity Example " + Application.version; 34 | 35 | versionInfo.text = "ARFoundation " + GetARFoundationVersion(); 36 | versionInfo.text += " / " + OpenCVForUnity.CoreModule.Core.NATIVE_LIBRARY_NAME + " " + OpenCVEnv.GetVersion() + " (" + OpenCVForUnity.CoreModule.Core.VERSION + ")"; 37 | versionInfo.text += " / UnityEditor " + Application.unityVersion; 38 | versionInfo.text += " / "; 39 | #if UNITY_EDITOR 40 | versionInfo.text += "Editor"; 41 | #elif UNITY_STANDALONE_WIN 42 | versionInfo.text += "Windows"; 43 | #elif UNITY_STANDALONE_OSX 44 | versionInfo.text += "Mac OSX"; 45 | #elif UNITY_STANDALONE_LINUX 46 | versionInfo.text += "Linux"; 47 | #elif UNITY_ANDROID 48 | versionInfo.text += "Android"; 49 | #elif UNITY_IOS 50 | versionInfo.text += "iOS"; 51 | #elif UNITY_WSA 52 | versionInfo.text += "WSA"; 53 | #elif UNITY_WEBGL 54 | versionInfo.text += "WebGL"; 55 | #endif 56 | versionInfo.text += " "; 57 | #if ENABLE_MONO 58 | versionInfo.text += "Mono"; 59 | #elif ENABLE_IL2CPP 60 | versionInfo.text += "IL2CPP"; 61 | #elif ENABLE_DOTNET 62 | versionInfo.text += ".NET"; 63 | #endif 64 | 65 | scrollRect.verticalNormalizedPosition = verticalNormalizedPosition; 66 | 67 | 68 | #if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR 69 | RuntimePermissionHelper runtimePermissionHelper = GetComponent(); 70 | yield return runtimePermissionHelper.hasUserAuthorizedCameraPermission(); 71 | #endif 72 | 73 | yield break; 74 | } 75 | 76 | public void OnScrollRectValueChanged() 77 | { 78 | verticalNormalizedPosition = scrollRect.verticalNormalizedPosition; 79 | } 80 | 81 | public void OnShowSystemInfoButtonClick() 82 | { 83 | SceneManager.LoadScene("ShowSystemInfo"); 84 | } 85 | 86 | public void OnShowLicenseButtonClick() 87 | { 88 | SceneManager.LoadScene("ShowLicense"); 89 | } 90 | 91 | public void OnARFoundationCameraToMatExampleButtonClick() 92 | { 93 | SceneManager.LoadScene("ARFoundationCameraToMatExample"); 94 | } 95 | 96 | public void OnConvertAsyncARFoundationCameraToMatExampleButtonClick() 97 | { 98 | SceneManager.LoadScene("ConvertAsyncARFoundationCameraToMatExample"); 99 | } 100 | 101 | public void OnARFoundationCamera2MatHelperExampleButtonClick() 102 | { 103 | SceneManager.LoadScene("ARFoundationCamera2MatHelperExample"); 104 | } 105 | public void OnARFoundationCameraArUcoExampleButtonClick() 106 | { 107 | SceneManager.LoadScene("ARFoundationCameraArUcoExample"); 108 | } 109 | } 110 | } -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/Scripts/ARGameObject.cs: -------------------------------------------------------------------------------- 1 | using OpenCVForUnity.UnityIntegration; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | 5 | namespace ARFoundationWithOpenCVForUnityExample 6 | { 7 | /// 8 | /// AR Game Object 9 | /// Referring to https://github.com/qian256/HoloLensARToolKit/blob/master/HoloLensARToolKit/Assets/ARToolKitUWP/Scripts/ARUWPTarget.cs. 10 | /// 11 | public class ARGameObject : MonoBehaviour 12 | { 13 | public bool smoothing = true; 14 | public float lerp = 0.15f; 15 | 16 | private static float positionJumpThreshold = 0.08f; 17 | private static float rotationJumpThreshold = 24f; 18 | private static float positionRecoverThreshold = 0.04f; 19 | private static float rotationRecoverThreshold = 12f; 20 | private static int maxPendingList = 15; 21 | private List pendingPositionList = new List(); 22 | private List pendingRotationList = new List(); 23 | 24 | /// 25 | /// When smoothing is enabled, the new pose will be filtered with current pose using lerp. Big sudden change of 6-DOF pose will be prohibited. 26 | /// 27 | /// The localToWorldMatrix. 28 | public void SetMatrix4x4(Matrix4x4 localToWorldMatrix) 29 | { 30 | Vector3 previousPosition = transform.localPosition; 31 | Quaternion previousRotation = transform.localRotation; 32 | 33 | Vector3 targetPosition = OpenCVARUtils.ExtractTranslationFromMatrix(ref localToWorldMatrix); 34 | Quaternion targetRotation = OpenCVARUtils.ExtractRotationFromMatrix(ref localToWorldMatrix); 35 | 36 | if (!smoothing) 37 | { 38 | transform.localRotation = targetRotation; 39 | transform.localPosition = targetPosition; 40 | } 41 | else 42 | { 43 | float positionDiff = Vector3.Distance(targetPosition, previousPosition); 44 | float rotationDiff = Quaternion.Angle(targetRotation, previousRotation); 45 | 46 | if (Mathf.Abs(positionDiff) < positionJumpThreshold && Mathf.Abs(rotationDiff) < rotationJumpThreshold) 47 | { 48 | transform.localRotation = Quaternion.Slerp(previousRotation, targetRotation, lerp); 49 | transform.localPosition = Vector3.Lerp(previousPosition, targetPosition, lerp); 50 | pendingPositionList.Clear(); 51 | pendingRotationList.Clear(); 52 | } 53 | else 54 | { 55 | // maybe there is a jump 56 | pendingPositionList.Add(targetPosition); 57 | pendingRotationList.Add(targetRotation); 58 | bool confirmJump = true; 59 | if (pendingPositionList.Count > maxPendingList) 60 | { 61 | for (int i = 0; i < maxPendingList - 1; i++) 62 | { 63 | float tempPositionDiff = Vector3.Distance(pendingPositionList[pendingPositionList.Count - i - 1], pendingPositionList[pendingPositionList.Count - i - 2]); 64 | float tempRotationDiff = Quaternion.Angle(pendingRotationList[pendingRotationList.Count - i - 1], pendingRotationList[pendingRotationList.Count - i - 2]); 65 | if (Mathf.Abs(tempPositionDiff) > positionRecoverThreshold || Mathf.Abs(tempRotationDiff) > rotationRecoverThreshold) 66 | { 67 | confirmJump = false; 68 | break; 69 | } 70 | } 71 | if (confirmJump) 72 | { 73 | transform.localRotation = targetRotation; 74 | transform.localPosition = targetPosition; 75 | pendingPositionList.Clear(); 76 | pendingRotationList.Clear(); 77 | } 78 | } 79 | } 80 | } 81 | } 82 | } 83 | } -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/Scripts/Utils/RuntimePermissionHelper.cs: -------------------------------------------------------------------------------- 1 | using System.Collections; 2 | using UnityEngine; 3 | 4 | namespace ARFoundationWithOpenCVForUnityExample 5 | { 6 | public class RuntimePermissionHelper : MonoBehaviour 7 | { 8 | 9 | public virtual IEnumerator hasUserAuthorizedCameraPermission() 10 | { 11 | #if UNITY_IOS && UNITY_2018_1_OR_NEWER 12 | UserAuthorization mode = UserAuthorization.WebCam; 13 | if (!Application.HasUserAuthorization(mode)) 14 | { 15 | yield return RequestUserAuthorization(mode); 16 | } 17 | yield return Application.HasUserAuthorization(mode); 18 | #elif UNITY_ANDROID && UNITY_2018_3_OR_NEWER 19 | string permission = UnityEngine.Android.Permission.Camera; 20 | if (!UnityEngine.Android.Permission.HasUserAuthorizedPermission(permission)) 21 | { 22 | yield return RequestUserPermission(permission); 23 | } 24 | yield return UnityEngine.Android.Permission.HasUserAuthorizedPermission(permission); 25 | #else 26 | yield return true; 27 | #endif 28 | } 29 | 30 | public virtual IEnumerator hasUserAuthorizedMicrophonePermission() 31 | { 32 | #if UNITY_IOS && UNITY_2018_1_OR_NEWER 33 | UserAuthorization mode = UserAuthorization.Microphone; 34 | if (!Application.HasUserAuthorization(mode)) 35 | { 36 | yield return RequestUserAuthorization(mode); 37 | } 38 | yield return Application.HasUserAuthorization(mode); 39 | #elif UNITY_ANDROID && UNITY_2018_3_OR_NEWER 40 | string permission = UnityEngine.Android.Permission.Microphone; 41 | if (!UnityEngine.Android.Permission.HasUserAuthorizedPermission(permission)) 42 | { 43 | yield return RequestUserPermission(permission); 44 | } 45 | yield return UnityEngine.Android.Permission.HasUserAuthorizedPermission(permission); 46 | #else 47 | yield return true; 48 | #endif 49 | } 50 | 51 | public virtual IEnumerator hasUserAuthorizedExternalStorageWritePermission() 52 | { 53 | #if UNITY_ANDROID && UNITY_2018_3_OR_NEWER 54 | string permission = UnityEngine.Android.Permission.ExternalStorageWrite; 55 | if (!UnityEngine.Android.Permission.HasUserAuthorizedPermission(permission)) 56 | { 57 | yield return RequestUserPermission(permission); 58 | } 59 | yield return UnityEngine.Android.Permission.HasUserAuthorizedPermission(permission); 60 | #else 61 | yield return true; 62 | #endif 63 | } 64 | 65 | #if (UNITY_IOS && UNITY_2018_1_OR_NEWER) || (UNITY_ANDROID && UNITY_2018_3_OR_NEWER) 66 | protected bool isUserRequestingPermission; 67 | 68 | protected virtual IEnumerator OnApplicationFocus(bool hasFocus) 69 | { 70 | yield return null; 71 | 72 | if (isUserRequestingPermission && hasFocus) 73 | isUserRequestingPermission = false; 74 | } 75 | 76 | #if UNITY_IOS 77 | protected virtual IEnumerator RequestUserAuthorization(UserAuthorization mode) 78 | { 79 | isUserRequestingPermission = true; 80 | yield return Application.RequestUserAuthorization(mode); 81 | 82 | float timeElapsed = 0; 83 | while (isUserRequestingPermission) 84 | { 85 | if (timeElapsed > 0.25f) 86 | { 87 | isUserRequestingPermission = false; 88 | yield break; 89 | } 90 | timeElapsed += Time.deltaTime; 91 | 92 | yield return null; 93 | } 94 | yield break; 95 | } 96 | #elif UNITY_ANDROID 97 | protected virtual IEnumerator RequestUserPermission(string permission) 98 | { 99 | isUserRequestingPermission = true; 100 | UnityEngine.Android.Permission.RequestUserPermission(permission); 101 | 102 | float timeElapsed = 0; 103 | while (isUserRequestingPermission) 104 | { 105 | if (timeElapsed > 0.25f) 106 | { 107 | isUserRequestingPermission = false; 108 | yield break; 109 | } 110 | timeElapsed += Time.deltaTime; 111 | 112 | yield return null; 113 | } 114 | yield break; 115 | } 116 | #endif 117 | #endif 118 | } 119 | } -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/Scripts/Utils/FpsMonitor.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | namespace ARFoundationWithOpenCVForUnityExample 5 | { 6 | // v1.0.2 7 | public class FpsMonitor : MonoBehaviour 8 | { 9 | int tick = 0; 10 | float elapsed = 0; 11 | float fps = 0; 12 | 13 | public enum Alignment 14 | { 15 | LeftTop, 16 | RightTop, 17 | LeftBottom, 18 | RightBottom, 19 | } 20 | 21 | public Alignment alignment = Alignment.RightTop; 22 | 23 | const float GUI_WIDTH = 75f; 24 | const float GUI_HEIGHT = 30f; 25 | const float MARGIN_X = 10f; 26 | const float MARGIN_Y = 10f; 27 | const float INNER_X = 8f; 28 | const float INNER_Y = 5f; 29 | const float GUI_CONSOLE_HEIGHT = 100f; 30 | 31 | public Vector2 offset = new Vector2(MARGIN_X, MARGIN_Y); 32 | public bool boxVisible = true; 33 | public float boxWidth = GUI_WIDTH; 34 | public float boxHeight = GUI_HEIGHT; 35 | public Vector2 padding = new Vector2(INNER_X, INNER_Y); 36 | public float consoleHeight = GUI_CONSOLE_HEIGHT; 37 | 38 | GUIStyle console_labelStyle; 39 | 40 | float x, y; 41 | Rect outer; 42 | Rect inner; 43 | 44 | float console_x, console_y; 45 | Rect console_outer; 46 | Rect console_inner; 47 | 48 | int oldScrWidth; 49 | int oldScrHeight; 50 | 51 | Dictionary outputDict = new Dictionary(); 52 | 53 | protected string _consoleText = null; 54 | public virtual string consoleText 55 | { 56 | get { return _consoleText; } 57 | set 58 | { 59 | _consoleText = value; 60 | toast_time = -1; 61 | } 62 | } 63 | 64 | int toast_time = -1; 65 | 66 | // Use this for initialization 67 | void Start() 68 | { 69 | console_labelStyle = new GUIStyle(); 70 | console_labelStyle.fontSize = 32; 71 | console_labelStyle.fontStyle = FontStyle.Normal; 72 | console_labelStyle.wordWrap = true; 73 | console_labelStyle.normal.textColor = Color.white; 74 | 75 | oldScrWidth = Screen.width; 76 | oldScrHeight = Screen.height; 77 | LocateGUI(); 78 | } 79 | 80 | // Update is called once per frame 81 | void Update() 82 | { 83 | tick++; 84 | elapsed += Time.deltaTime; 85 | if (elapsed >= 1f) 86 | { 87 | fps = tick / elapsed; 88 | tick = 0; 89 | elapsed = 0; 90 | } 91 | 92 | if (toast_time > 0) 93 | { 94 | toast_time = toast_time - 1; 95 | } 96 | } 97 | 98 | void OnGUI() 99 | { 100 | if (oldScrWidth != Screen.width || oldScrHeight != Screen.height) 101 | { 102 | LocateGUI(); 103 | } 104 | oldScrWidth = Screen.width; 105 | oldScrHeight = Screen.height; 106 | 107 | if (boxVisible) 108 | { 109 | GUI.Box(outer, ""); 110 | } 111 | 112 | GUILayout.BeginArea(inner); 113 | { 114 | GUILayout.BeginVertical(); 115 | GUILayout.Label("fps : " + fps.ToString("F1")); 116 | foreach (KeyValuePair pair in outputDict) 117 | { 118 | GUILayout.Label(pair.Key + " : " + pair.Value); 119 | } 120 | GUILayout.EndVertical(); 121 | } 122 | GUILayout.EndArea(); 123 | 124 | if (!string.IsNullOrEmpty(consoleText)) 125 | { 126 | if (toast_time != 0) 127 | { 128 | if (boxVisible) 129 | { 130 | GUI.Box(console_outer, ""); 131 | } 132 | 133 | GUILayout.BeginArea(console_inner); 134 | { 135 | GUILayout.BeginVertical(); 136 | GUILayout.Label(consoleText, console_labelStyle); 137 | GUILayout.EndVertical(); 138 | } 139 | GUILayout.EndArea(); 140 | } 141 | } 142 | } 143 | 144 | public void Add(string key, string value) 145 | { 146 | if (outputDict.ContainsKey(key)) 147 | { 148 | outputDict[key] = value; 149 | } 150 | else 151 | { 152 | outputDict.Add(key, value); 153 | } 154 | } 155 | 156 | public void Remove(string key) 157 | { 158 | outputDict.Remove(key); 159 | } 160 | 161 | public void Clear() 162 | { 163 | outputDict.Clear(); 164 | } 165 | 166 | public void LocateGUI() 167 | { 168 | x = GetAlignedX(alignment, boxWidth); 169 | y = GetAlignedY(alignment, boxHeight); 170 | outer = new Rect(x, y, boxWidth, boxHeight); 171 | inner = new Rect(x + padding.x, y + padding.y, boxWidth, boxHeight); 172 | 173 | console_x = GetAlignedX(Alignment.LeftBottom, Screen.width); 174 | console_y = GetAlignedY(Alignment.LeftBottom, consoleHeight); 175 | console_outer = new Rect(console_x, console_y, Screen.width - offset.x * 2, consoleHeight); 176 | console_inner = new Rect(console_x + padding.x, console_y + padding.y, Screen.width - offset.x * 2 - padding.x, consoleHeight); 177 | } 178 | 179 | public void Toast(string message, int time = 120) 180 | { 181 | _consoleText = message; 182 | toast_time = (time < 60) ? 60 : time; 183 | } 184 | 185 | float GetAlignedX(Alignment anchor, float w) 186 | { 187 | switch (anchor) 188 | { 189 | default: 190 | case Alignment.LeftTop: 191 | case Alignment.LeftBottom: 192 | return offset.x; 193 | 194 | case Alignment.RightTop: 195 | case Alignment.RightBottom: 196 | return Screen.width - w - offset.x; 197 | } 198 | } 199 | 200 | float GetAlignedY(Alignment anchor, float h) 201 | { 202 | switch (anchor) 203 | { 204 | default: 205 | case Alignment.LeftTop: 206 | case Alignment.RightTop: 207 | return offset.y; 208 | 209 | case Alignment.LeftBottom: 210 | case Alignment.RightBottom: 211 | return Screen.height - h - offset.y; 212 | } 213 | } 214 | } 215 | } -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ShowSystemInfo.cs: -------------------------------------------------------------------------------- 1 | using OpenCVForUnity.CoreModule; 2 | using OpenCVForUnity.UnityIntegration; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Reflection; 6 | using System.Text; 7 | using UnityEngine; 8 | using UnityEngine.SceneManagement; 9 | using UnityEngine.UI; 10 | 11 | namespace ARFoundationWithOpenCVForUnityExample 12 | { 13 | public class ShowSystemInfo : MonoBehaviour 14 | { 15 | public Text systemInfoText; 16 | public InputField systemInfoInputField; 17 | 18 | private const string ASSET_NAME = "OpenCVForUnity"; 19 | 20 | // Use this for initialization 21 | void Start() 22 | { 23 | 24 | StringBuilder sb = new StringBuilder(); 25 | sb.Append("###### Build Info ######\n"); 26 | IDictionary buildInfo = GetBuildInfo(); 27 | foreach (string key in buildInfo.Keys) 28 | { 29 | sb.Append(key).Append(" = ").Append(buildInfo[key]).Append("\n"); 30 | } 31 | sb.Append("\n"); 32 | 33 | #if UNITY_IOS || (UNITY_ANDROID && UNITY_2018_3_OR_NEWER) 34 | sb.Append("###### Device Info ######\n"); 35 | IDictionary deviceInfo = GetDeviceInfo(); 36 | foreach (string key in deviceInfo.Keys) 37 | { 38 | sb.Append(key).Append(" = ").Append(deviceInfo[key]).Append("\n"); 39 | } 40 | sb.Append("\n"); 41 | #endif 42 | 43 | sb.Append("###### System Info ######\n"); 44 | IDictionary systemInfo = GetSystemInfo(); 45 | foreach (string key in systemInfo.Keys) 46 | { 47 | sb.Append(key).Append(" = ").Append(systemInfo[key]).Append("\n"); 48 | } 49 | sb.Append("#########################\n"); 50 | 51 | systemInfoText.text = systemInfoInputField.text = sb.ToString(); 52 | Debug.Log(sb.ToString()); 53 | } 54 | 55 | // Update is called once per frame 56 | void Update() 57 | { 58 | 59 | } 60 | 61 | public Dictionary GetBuildInfo() 62 | { 63 | Dictionary dict = new Dictionary(); 64 | 65 | dict.Add(ASSET_NAME + " version", Core.NATIVE_LIBRARY_NAME + " " + OpenCVEnv.GetVersion() + " (" + Core.VERSION + ")"); 66 | dict.Add("Build Unity version", Application.unityVersion); 67 | 68 | #if UNITY_EDITOR 69 | dict.Add("Build target", "Editor"); 70 | #elif UNITY_STANDALONE_WIN 71 | dict.Add("Build target", "Windows"); 72 | #elif UNITY_STANDALONE_OSX 73 | dict.Add("Build target", "Mac OSX"); 74 | #elif UNITY_STANDALONE_LINUX 75 | dict.Add("Build target", "Linux"); 76 | #elif UNITY_ANDROID 77 | dict.Add("Build target", "Android"); 78 | #elif UNITY_IOS 79 | dict.Add("Build target", "iOS"); 80 | #elif UNITY_WSA 81 | dict.Add("Build target", "WSA"); 82 | #elif UNITY_WEBGL 83 | dict.Add("Build target", "WebGL"); 84 | #elif PLATFORM_LUMIN 85 | dict.Add("Build target", "LUMIN"); 86 | #else 87 | dict.Add("Build target", ""); 88 | #endif 89 | 90 | #if ENABLE_MONO 91 | dict.Add("Scripting backend", "Mono"); 92 | #elif ENABLE_IL2CPP 93 | dict.Add("Scripting backend", "IL2CPP"); 94 | #elif ENABLE_DOTNET 95 | dict.Add("Scripting backend", ".NET"); 96 | #else 97 | dict.Add("Scripting backend", ""); 98 | #endif 99 | 100 | #if OPENCV_USE_UNSAFE_CODE 101 | dict.Add("Allow 'unsafe' Code", "Enabled"); 102 | #else 103 | dict.Add("Allow 'unsafe' Code", "Disabled"); 104 | #endif 105 | 106 | return dict; 107 | } 108 | 109 | public Dictionary GetDeviceInfo() 110 | { 111 | Dictionary dict = new Dictionary(); 112 | 113 | #if UNITY_IOS 114 | dict.Add("iOS.Device.generation", UnityEngine.iOS.Device.generation.ToString()); 115 | dict.Add("iOS.Device.systemVersion", UnityEngine.iOS.Device.systemVersion.ToString()); 116 | #endif 117 | #if UNITY_IOS && UNITY_2018_1_OR_NEWER 118 | dict.Add("UserAuthorization.WebCam", Application.HasUserAuthorization(UserAuthorization.WebCam).ToString()); 119 | dict.Add("UserAuthorization.Microphone", Application.HasUserAuthorization(UserAuthorization.Microphone).ToString()); 120 | #endif 121 | #if UNITY_ANDROID && UNITY_2018_3_OR_NEWER 122 | dict.Add("Android.Permission.Camera", UnityEngine.Android.Permission.HasUserAuthorizedPermission(UnityEngine.Android.Permission.Camera).ToString()); 123 | dict.Add("Android.Permission.CoarseLocation", UnityEngine.Android.Permission.HasUserAuthorizedPermission(UnityEngine.Android.Permission.CoarseLocation).ToString()); 124 | dict.Add("Android.Permission.ExternalStorageRead", UnityEngine.Android.Permission.HasUserAuthorizedPermission(UnityEngine.Android.Permission.ExternalStorageRead).ToString()); 125 | dict.Add("Android.Permission.ExternalStorageWrite", UnityEngine.Android.Permission.HasUserAuthorizedPermission(UnityEngine.Android.Permission.ExternalStorageWrite).ToString()); 126 | dict.Add("Android.Permission.FineLocation", UnityEngine.Android.Permission.HasUserAuthorizedPermission(UnityEngine.Android.Permission.FineLocation).ToString()); 127 | dict.Add("Android.Permission.Microphone", UnityEngine.Android.Permission.HasUserAuthorizedPermission(UnityEngine.Android.Permission.Microphone).ToString()); 128 | #endif 129 | 130 | return dict; 131 | } 132 | 133 | /// SystemInfo Class Propertys 134 | public SortedDictionary GetSystemInfo() 135 | { 136 | SortedDictionary dict = new SortedDictionary(); 137 | 138 | Type type = typeof(SystemInfo); 139 | MemberInfo[] members = type.GetMembers( 140 | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static); 141 | 142 | foreach (MemberInfo mb in members) 143 | { 144 | try 145 | { 146 | if (mb.MemberType == MemberTypes.Property) 147 | { 148 | if (mb.Name == "deviceUniqueIdentifier") 149 | { 150 | dict.Add(mb.Name, "xxxxxxxxxxxxxxxxxxxxxxxx"); 151 | continue; 152 | } 153 | 154 | PropertyInfo pr = type.GetProperty(mb.Name); 155 | 156 | if (pr != null) 157 | { 158 | object resobj = pr.GetValue(type, null); 159 | dict.Add(mb.Name, resobj.ToString()); 160 | } 161 | else 162 | { 163 | dict.Add(mb.Name, ""); 164 | } 165 | } 166 | } 167 | catch (Exception e) 168 | { 169 | Debug.Log("Exception: " + e); 170 | } 171 | } 172 | 173 | return dict; 174 | } 175 | 176 | public void OnBackButtonClick() 177 | { 178 | SceneManager.LoadScene("ARFoundationWithOpenCVForUnityExample"); 179 | } 180 | } 181 | } -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ARFoundationCamera2MatHelperExample/ARFoundationCamera2MatHelperExample.cs: -------------------------------------------------------------------------------- 1 | #if !(PLATFORM_LUMIN && !UNITY_EDITOR) 2 | 3 | using ARFoundationWithOpenCVForUnity.UnityIntegration.Helper.Source2Mat; 4 | using OpenCVForUnity.CoreModule; 5 | using OpenCVForUnity.ImgprocModule; 6 | using OpenCVForUnity.UnityIntegration; 7 | using OpenCVForUnity.UnityIntegration.Helper.Source2Mat; 8 | using System; 9 | using UnityEngine; 10 | using UnityEngine.SceneManagement; 11 | using UnityEngine.UI; 12 | 13 | namespace ARFoundationWithOpenCVForUnityExample 14 | { 15 | /// 16 | /// ARFoundationCamera2MatHelper Example 17 | /// 18 | [RequireComponent(typeof(ARFoundationCamera2MatHelper))] 19 | public class ARFoundationCamera2MatHelperExample : MonoBehaviour 20 | { 21 | [Header("Output")] 22 | /// 23 | /// The RawImage for previewing the result. 24 | /// 25 | public RawImage resultPreview; 26 | 27 | [Space(10)] 28 | 29 | /// 30 | /// The requested resolution dropdown. 31 | /// 32 | public Dropdown requestedResolutionDropdown; 33 | 34 | /// 35 | /// The requested resolution. 36 | /// 37 | public ResolutionPreset requestedResolution = ResolutionPreset._640x480; 38 | 39 | /// 40 | /// The requestedFPS dropdown. 41 | /// 42 | public Dropdown requestedFPSDropdown; 43 | 44 | /// 45 | /// The requestedFPS. 46 | /// 47 | public FPSPreset requestedFPS = FPSPreset._30; 48 | 49 | /// 50 | /// The rotate 90 degree toggle. 51 | /// 52 | public Toggle rotate90DegreeToggle; 53 | 54 | /// 55 | /// The flip vertical toggle. 56 | /// 57 | public Toggle flipVerticalToggle; 58 | 59 | /// 60 | /// The flip horizontal toggle. 61 | /// 62 | public Toggle flipHorizontalToggle; 63 | 64 | /// 65 | /// The texture. 66 | /// 67 | Texture2D texture; 68 | 69 | /// 70 | /// The webcam texture to mat helper. 71 | /// 72 | ARFoundationCamera2MatHelper webCamTextureToMatHelper; 73 | 74 | /// 75 | /// The FPS monitor. 76 | /// 77 | FpsMonitor fpsMonitor; 78 | 79 | // Use this for initialization 80 | void Start() 81 | { 82 | fpsMonitor = GetComponent(); 83 | 84 | webCamTextureToMatHelper = gameObject.GetComponent(); 85 | webCamTextureToMatHelper.OutputColorFormat = Source2MatHelperColorFormat.RGBA; 86 | int width, height; 87 | Dimensions(requestedResolution, out width, out height); 88 | webCamTextureToMatHelper.RequestedWidth = width; 89 | webCamTextureToMatHelper.RequestedHeight = height; 90 | webCamTextureToMatHelper.RequestedFPS = (int)requestedFPS; 91 | webCamTextureToMatHelper.Initialize(); 92 | 93 | // Update GUI state 94 | requestedResolutionDropdown.value = (int)requestedResolution; 95 | string[] enumNames = System.Enum.GetNames(typeof(FPSPreset)); 96 | int index = Array.IndexOf(enumNames, requestedFPS.ToString()); 97 | requestedFPSDropdown.value = index; 98 | rotate90DegreeToggle.isOn = webCamTextureToMatHelper.Rotate90Degree; 99 | flipVerticalToggle.isOn = webCamTextureToMatHelper.FlipVertical; 100 | flipHorizontalToggle.isOn = webCamTextureToMatHelper.FlipHorizontal; 101 | } 102 | 103 | /// 104 | /// Raises the webcam texture to mat helper initialized event. 105 | /// 106 | public void OnWebCamTextureToMatHelperInitialized() 107 | { 108 | Debug.Log("OnWebCamTextureToMatHelperInitialized"); 109 | 110 | Mat rgbaMat = webCamTextureToMatHelper.GetMat(); 111 | 112 | texture = new Texture2D(rgbaMat.cols(), rgbaMat.rows(), TextureFormat.RGBA32, false); 113 | OpenCVMatUtils.MatToTexture2D(rgbaMat, texture); 114 | 115 | resultPreview.texture = texture; 116 | resultPreview.GetComponent().aspectRatio = (float)texture.width / texture.height; 117 | 118 | 119 | if (fpsMonitor != null) 120 | { 121 | fpsMonitor.Add("deviceName", webCamTextureToMatHelper.GetDeviceName().ToString()); 122 | fpsMonitor.Add("width", webCamTextureToMatHelper.GetWidth().ToString()); 123 | fpsMonitor.Add("height", webCamTextureToMatHelper.GetHeight().ToString()); 124 | fpsMonitor.Add("camera fps", webCamTextureToMatHelper.GetFPS().ToString()); 125 | fpsMonitor.Add("IsFrontFacing", webCamTextureToMatHelper.IsFrontFacing().ToString()); 126 | fpsMonitor.Add("Rotate90Degree", webCamTextureToMatHelper.Rotate90Degree.ToString()); 127 | fpsMonitor.Add("FlipVertical", webCamTextureToMatHelper.FlipVertical.ToString()); 128 | fpsMonitor.Add("FlipHorizontal", webCamTextureToMatHelper.FlipHorizontal.ToString()); 129 | fpsMonitor.Add("orientation", Screen.orientation.ToString()); 130 | fpsMonitor.Add("AutoFocusRequested", webCamTextureToMatHelper.AutoFocusRequested.ToString()); 131 | fpsMonitor.Add("AutoFocusEnabled", webCamTextureToMatHelper.AutoFocusEnabled.ToString()); 132 | fpsMonitor.Add("RequestedFacingDirection", webCamTextureToMatHelper.RequestedFacingDirection.ToString()); 133 | fpsMonitor.Add("CurrentFacingDirection", webCamTextureToMatHelper.CurrentFacingDirection.ToString()); 134 | fpsMonitor.Add("RequestedLightEstimation", webCamTextureToMatHelper.RequestedLightEstimation.ToString()); 135 | fpsMonitor.Add("CurrentLightEstimation", webCamTextureToMatHelper.CurrentLightEstimation.ToString()); 136 | 137 | fpsMonitor.Add("GetDisplayRotationAngle", webCamTextureToMatHelper.GetDisplayRotationAngle().ToString()); 138 | fpsMonitor.Add("GetDisplayFlipVertical", webCamTextureToMatHelper.GetDisplayFlipVertical().ToString()); 139 | fpsMonitor.Add("GetDisplayFlipHorizontal", webCamTextureToMatHelper.GetDisplayFlipHorizontal().ToString()); 140 | } 141 | 142 | double fx; 143 | double fy; 144 | double cx; 145 | double cy; 146 | 147 | Mat camMatrix; 148 | 149 | #if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR && !DISABLE_ARFOUNDATION_API 150 | 151 | UnityEngine.XR.ARSubsystems.XRCameraIntrinsics cameraIntrinsics = webCamTextureToMatHelper.GetCameraIntrinsics(); 152 | 153 | // Apply the rotate and flip properties of camera helper to the camera intrinsics. 154 | Vector2 fl = cameraIntrinsics.focalLength; 155 | Vector2 pp = cameraIntrinsics.principalPoint; 156 | Vector2Int r = cameraIntrinsics.resolution; 157 | 158 | Matrix4x4 tM = Matrix4x4.Translate(new Vector3(-r.x / 2, -r.y / 2, 0)); 159 | pp = tM.MultiplyPoint3x4(pp); 160 | 161 | Matrix4x4 rotationAndFlipM = Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(0, 0, webCamTextureToMatHelper.Rotate90Degree ? 90 : 0), 162 | new Vector3(webCamTextureToMatHelper.FlipHorizontal ? -1 : 1, webCamTextureToMatHelper.FlipVertical ? -1 : 1, 1)); 163 | pp = rotationAndFlipM.MultiplyPoint3x4(pp); 164 | 165 | if (webCamTextureToMatHelper.Rotate90Degree) 166 | { 167 | fl = new Vector2(fl.y, fl.x); 168 | r = new Vector2Int(r.y, r.x); 169 | } 170 | 171 | Matrix4x4 _tM = Matrix4x4.Translate(new Vector3(r.x / 2, r.y / 2, 0)); 172 | pp = _tM.MultiplyPoint3x4(pp); 173 | 174 | cameraIntrinsics = new UnityEngine.XR.ARSubsystems.XRCameraIntrinsics(fl, pp, r); 175 | 176 | 177 | fx = cameraIntrinsics.focalLength.x; 178 | fy = cameraIntrinsics.focalLength.y; 179 | cx = cameraIntrinsics.principalPoint.x; 180 | cy = cameraIntrinsics.principalPoint.y; 181 | 182 | camMatrix = new Mat(3, 3, CvType.CV_64FC1); 183 | camMatrix.put(0, 0, fx); 184 | camMatrix.put(0, 1, 0); 185 | camMatrix.put(0, 2, cx); 186 | camMatrix.put(1, 0, 0); 187 | camMatrix.put(1, 1, fy); 188 | camMatrix.put(1, 2, cy); 189 | camMatrix.put(2, 0, 0); 190 | camMatrix.put(2, 1, 0); 191 | camMatrix.put(2, 2, 1.0f); 192 | 193 | Debug.Log("Created CameraParameters from the camera intrinsics to be populated if the camera supports intrinsics. \n" + camMatrix.dump() + "\n " + cameraIntrinsics.resolution); 194 | 195 | #else // (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR && !DISABLE_ARFOUNDATION_API 196 | 197 | float width = rgbaMat.width(); 198 | float height = rgbaMat.height(); 199 | int max_d = (int)Mathf.Max(width, height); 200 | fx = max_d; 201 | fy = max_d; 202 | cx = width / 2.0f; 203 | cy = height / 2.0f; 204 | 205 | camMatrix = new Mat(3, 3, CvType.CV_64FC1); 206 | camMatrix.put(0, 0, fx); 207 | camMatrix.put(0, 1, 0); 208 | camMatrix.put(0, 2, cx); 209 | camMatrix.put(1, 0, 0); 210 | camMatrix.put(1, 1, fy); 211 | camMatrix.put(1, 2, cy); 212 | camMatrix.put(2, 0, 0); 213 | camMatrix.put(2, 1, 0); 214 | camMatrix.put(2, 2, 1.0f); 215 | 216 | Debug.Log("Created a dummy CameraParameters. \n" + camMatrix.dump() + "\n " + width + " " + height); 217 | 218 | #endif // (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR && !DISABLE_ARFOUNDATION_API 219 | 220 | } 221 | 222 | /// 223 | /// Raises the webcam texture to mat helper disposed event. 224 | /// 225 | public void OnWebCamTextureToMatHelperDisposed() 226 | { 227 | Debug.Log("OnWebCamTextureToMatHelperDisposed"); 228 | 229 | if (texture != null) 230 | { 231 | Texture2D.Destroy(texture); 232 | texture = null; 233 | } 234 | } 235 | 236 | /// 237 | /// Raises the webcam texture to mat helper error occurred event. 238 | /// 239 | /// Error code. 240 | /// Message. 241 | public void OnWebCamTextureToMatHelperErrorOccurred(Source2MatHelperErrorCode errorCode, string message) 242 | { 243 | Debug.Log("OnWebCamTextureToMatHelperErrorOccurred " + errorCode + ":" + message); 244 | 245 | if (fpsMonitor != null) 246 | { 247 | fpsMonitor.consoleText = "ErrorCode: " + errorCode + ":" + message; 248 | } 249 | } 250 | 251 | // Update is called once per frame 252 | void Update() 253 | { 254 | if (webCamTextureToMatHelper.IsPlaying() && webCamTextureToMatHelper.DidUpdateThisFrame()) 255 | { 256 | 257 | Mat rgbaMat = webCamTextureToMatHelper.GetMat(); 258 | 259 | //Imgproc.putText (rgbaMat, "W:" + rgbaMat.width () + " H:" + rgbaMat.height () + " SO:" + Screen.orientation, new Point (5, rgbaMat.rows () - 10), Imgproc.FONT_HERSHEY_SIMPLEX, 1.0, new Scalar (255, 255, 255, 255), 2, Imgproc.LINE_AA, false); 260 | 261 | OpenCVMatUtils.MatToTexture2D(rgbaMat, texture); 262 | 263 | if (fpsMonitor != null) 264 | { 265 | var focalLength = webCamTextureToMatHelper.GetCameraIntrinsics().focalLength; 266 | var principalPoint = webCamTextureToMatHelper.GetCameraIntrinsics().principalPoint; 267 | var resolution = webCamTextureToMatHelper.GetCameraIntrinsics().resolution; 268 | fpsMonitor.Add("GetCameraIntrinsics", "\n" + "FL: " + focalLength.x + "x" + focalLength.y + "\n" + "PP: " + principalPoint.x + "x" + principalPoint.y + "\n" + "R: " + resolution.x + "x" + resolution.y); 269 | 270 | fpsMonitor.Add("GetProjectionMatrix", "\n" + webCamTextureToMatHelper.GetProjectionMatrix().ToString()); 271 | } 272 | } 273 | } 274 | 275 | /// 276 | /// Raises the destroy event. 277 | /// 278 | void OnDestroy() 279 | { 280 | webCamTextureToMatHelper.Dispose(); 281 | } 282 | 283 | /// 284 | /// Raises the back button click event. 285 | /// 286 | public void OnBackButtonClick() 287 | { 288 | SceneManager.LoadScene("ARFoundationWithOpenCVForUnityExample"); 289 | } 290 | 291 | /// 292 | /// Raises the play button click event. 293 | /// 294 | public void OnPlayButtonClick() 295 | { 296 | webCamTextureToMatHelper.Play(); 297 | } 298 | 299 | /// 300 | /// Raises the pause button click event. 301 | /// 302 | public void OnPauseButtonClick() 303 | { 304 | webCamTextureToMatHelper.Pause(); 305 | } 306 | 307 | /// 308 | /// Raises the stop button click event. 309 | /// 310 | public void OnStopButtonClick() 311 | { 312 | webCamTextureToMatHelper.Stop(); 313 | } 314 | 315 | /// 316 | /// Raises the change camera button click event. 317 | /// 318 | public void OnChangeCameraButtonClick() 319 | { 320 | webCamTextureToMatHelper.RequestedIsFrontFacing = !webCamTextureToMatHelper.RequestedIsFrontFacing; 321 | } 322 | 323 | /// 324 | /// Raises the requested resolution dropdown value changed event. 325 | /// 326 | public void OnRequestedResolutionDropdownValueChanged(int result) 327 | { 328 | if ((int)requestedResolution != result) 329 | { 330 | requestedResolution = (ResolutionPreset)result; 331 | 332 | int width, height; 333 | Dimensions(requestedResolution, out width, out height); 334 | 335 | webCamTextureToMatHelper.Initialize(width, height); 336 | } 337 | } 338 | 339 | /// 340 | /// Raises the requestedFPS dropdown value changed event. 341 | /// 342 | public void OnRequestedFPSDropdownValueChanged(int result) 343 | { 344 | string[] enumNames = Enum.GetNames(typeof(FPSPreset)); 345 | int value = (int)System.Enum.Parse(typeof(FPSPreset), enumNames[result], true); 346 | 347 | if ((int)requestedFPS != value) 348 | { 349 | requestedFPS = (FPSPreset)value; 350 | 351 | webCamTextureToMatHelper.RequestedFPS = (int)requestedFPS; 352 | } 353 | } 354 | 355 | /// 356 | /// Raises the rotate 90 degree toggle value changed event. 357 | /// 358 | public void OnRotate90DegreeToggleValueChanged() 359 | { 360 | if (rotate90DegreeToggle.isOn != webCamTextureToMatHelper.Rotate90Degree) 361 | { 362 | webCamTextureToMatHelper.Rotate90Degree = rotate90DegreeToggle.isOn; 363 | 364 | if (fpsMonitor != null) 365 | fpsMonitor.Add("Rotate90Degree", webCamTextureToMatHelper.Rotate90Degree.ToString()); 366 | } 367 | } 368 | 369 | /// 370 | /// Raises the flip vertical toggle value changed event. 371 | /// 372 | public void OnFlipVerticalToggleValueChanged() 373 | { 374 | if (flipVerticalToggle.isOn != webCamTextureToMatHelper.FlipVertical) 375 | { 376 | webCamTextureToMatHelper.FlipVertical = flipVerticalToggle.isOn; 377 | 378 | if (fpsMonitor != null) 379 | fpsMonitor.Add("FlipVertical", webCamTextureToMatHelper.FlipVertical.ToString()); 380 | } 381 | } 382 | 383 | /// 384 | /// Raises the flip horizontal toggle value changed event. 385 | /// 386 | public void OnFlipHorizontalToggleValueChanged() 387 | { 388 | if (flipHorizontalToggle.isOn != webCamTextureToMatHelper.FlipHorizontal) 389 | { 390 | webCamTextureToMatHelper.FlipHorizontal = flipHorizontalToggle.isOn; 391 | 392 | if (fpsMonitor != null) 393 | fpsMonitor.Add("FlipHorizontal", webCamTextureToMatHelper.FlipHorizontal.ToString()); 394 | } 395 | } 396 | 397 | /// 398 | /// Raises the change autoFocus button click event. 399 | /// 400 | public void OnChangeAutoFocusButtonClick() 401 | { 402 | webCamTextureToMatHelper.AutoFocusRequested = !webCamTextureToMatHelper.AutoFocusRequested; 403 | 404 | if (fpsMonitor != null) 405 | { 406 | fpsMonitor.Add("AutoFocusRequested", webCamTextureToMatHelper.AutoFocusRequested.ToString()); 407 | fpsMonitor.Add("AutoFocusEnabled", webCamTextureToMatHelper.AutoFocusEnabled.ToString()); 408 | } 409 | } 410 | 411 | public enum FPSPreset : int 412 | { 413 | _0 = 0, 414 | _1 = 1, 415 | _5 = 5, 416 | _10 = 10, 417 | _15 = 15, 418 | _30 = 30, 419 | _60 = 60, 420 | } 421 | 422 | public enum ResolutionPreset : byte 423 | { 424 | _50x50 = 0, 425 | _640x480, 426 | _1280x720, 427 | _1920x1080, 428 | _9999x9999, 429 | } 430 | 431 | private void Dimensions(ResolutionPreset preset, out int width, out int height) 432 | { 433 | switch (preset) 434 | { 435 | case ResolutionPreset._50x50: 436 | width = 50; 437 | height = 50; 438 | break; 439 | case ResolutionPreset._640x480: 440 | width = 640; 441 | height = 480; 442 | break; 443 | case ResolutionPreset._1280x720: 444 | width = 1280; 445 | height = 720; 446 | break; 447 | case ResolutionPreset._1920x1080: 448 | width = 1920; 449 | height = 1080; 450 | break; 451 | case ResolutionPreset._9999x9999: 452 | width = 9999; 453 | height = 9999; 454 | break; 455 | default: 456 | width = height = 0; 457 | break; 458 | } 459 | } 460 | } 461 | } 462 | 463 | #endif -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ARFoundationCameraToMatExample/ARFoundationCameraToMatExample.cs: -------------------------------------------------------------------------------- 1 | #if !(PLATFORM_LUMIN && !UNITY_EDITOR) 2 | 3 | using OpenCVForUnity.CoreModule; 4 | using OpenCVForUnity.ImgprocModule; 5 | using OpenCVForUnity.UnityIntegration; 6 | using System; 7 | using UnityEngine; 8 | using UnityEngine.SceneManagement; 9 | using UnityEngine.UI; 10 | using UnityEngine.XR.ARFoundation; 11 | using UnityEngine.XR.ARSubsystems; 12 | 13 | namespace ARFoundationWithOpenCVForUnityExample 14 | { 15 | /// 16 | /// ARFoundationCameraToMat Example 17 | /// An example of converting an ARFoundation camera image to OpenCV's Mat format. 18 | /// 19 | public class ARFoundationCameraToMatExample : MonoBehaviour 20 | { 21 | [Header("Output")] 22 | /// 23 | /// The RawImage for previewing the result. 24 | /// 25 | public RawImage resultPreview; 26 | 27 | [Space(10)] 28 | 29 | [SerializeField, TooltipAttribute("The ARCameraManager which will produce frame events.")] 30 | public ARCameraManager cameraManager = default; 31 | 32 | [SerializeField, TooltipAttribute("The ARCamera.")] 33 | public Camera arCamera; 34 | 35 | [Header("Processing")] 36 | public ImageProcessingType imageProcessingType = ImageProcessingType.None; 37 | public Dropdown imageProcessingTypeDropdown; 38 | 39 | Mat rgbaMat; 40 | 41 | Mat rotatedFrameMat; 42 | 43 | Mat grayMat; 44 | 45 | Texture2D texture; 46 | 47 | bool hasInitDone = false; 48 | 49 | bool isPlaying = true; 50 | 51 | ScreenOrientation screenOrientation; 52 | 53 | int displayRotationAngle = 0; 54 | bool displayFlipVertical = false; 55 | bool displayFlipHorizontal = false; 56 | 57 | FpsMonitor fpsMonitor; 58 | 59 | // Use this for initialization 60 | void Start() 61 | { 62 | Debug.Assert(cameraManager != null, "camera manager cannot be null"); 63 | 64 | fpsMonitor = GetComponent(); 65 | 66 | 67 | // Checks camera permission state. 68 | if (fpsMonitor != null && !cameraManager.permissionGranted) 69 | { 70 | fpsMonitor.consoleText = "Camera permission has not been granted."; 71 | } 72 | 73 | // Update UI 74 | if (imageProcessingTypeDropdown != null) 75 | imageProcessingTypeDropdown.value = (int)imageProcessingType; 76 | } 77 | 78 | void OnEnable() 79 | { 80 | if (cameraManager != null) 81 | { 82 | cameraManager.frameReceived += OnCameraFrameReceived; 83 | } 84 | } 85 | 86 | void OnDisable() 87 | { 88 | if (cameraManager != null) 89 | { 90 | cameraManager.frameReceived -= OnCameraFrameReceived; 91 | } 92 | } 93 | 94 | protected void OnCameraFrameReceived(ARCameraFrameEventArgs eventArgs) 95 | { 96 | if ((cameraManager == null) || (cameraManager.subsystem == null) || !cameraManager.subsystem.running) 97 | return; 98 | 99 | // Attempt to get the latest camera image. If this method succeeds, 100 | // it acquires a native resource that must be disposed (see below). 101 | if (!cameraManager.TryAcquireLatestCpuImage(out XRCpuImage image)) 102 | { 103 | return; 104 | } 105 | 106 | int width = image.width; 107 | int height = image.height; 108 | 109 | if (!hasInitDone || rgbaMat == null || rgbaMat.cols() != width || rgbaMat.rows() != height || screenOrientation != Screen.orientation) 110 | { 111 | Dispose(); 112 | 113 | screenOrientation = Screen.orientation; 114 | 115 | XRCameraConfiguration config = (XRCameraConfiguration)cameraManager.currentConfiguration; 116 | int framerate = config.framerate.HasValue ? config.framerate.Value : -1; 117 | 118 | Debug.Log("name:" + cameraManager.name + " width:" + width + " height:" + height + " fps:" + framerate); 119 | Debug.Log(" format:" + image.format + " isFrongFacing:" + (cameraManager.currentFacingDirection == CameraFacingDirection.User)); 120 | 121 | 122 | #if USE_ARFOUNDATION_5 123 | // Remove scaling and offset factors from the camera display matrix while maintaining orientation. 124 | // Decompose that matrix to extract the rotation and flipping factors. 125 | // https://github.com/Unity-Technologies/arfoundation-samples/blob/88179bab2b180dd90229d9ec995204be47da1cc1/Assets/Scripts/DisplayDepthImage.cs#L333 126 | if (eventArgs.displayMatrix.HasValue) 127 | { 128 | // Copy the display rotation matrix from the camera. 129 | Matrix4x4 cameraMatrix = eventArgs.displayMatrix ?? Matrix4x4.identity; 130 | 131 | Vector2 affineBasisX = new Vector2(1.0f, 0.0f); 132 | Vector2 affineBasisY = new Vector2(0.0f, 1.0f); 133 | Vector2 affineTranslation = new Vector2(0.0f, 0.0f); 134 | 135 | #if UNITY_IOS 136 | affineBasisX = new Vector2(cameraMatrix[0, 0], cameraMatrix[1, 0]); 137 | affineBasisY = new Vector2(cameraMatrix[0, 1], cameraMatrix[1, 1]); 138 | affineTranslation = new Vector2(cameraMatrix[2, 0], cameraMatrix[2, 1]); 139 | #endif // UNITY_IOS 140 | #if UNITY_ANDROID 141 | affineBasisX = new Vector2(cameraMatrix[0, 0], cameraMatrix[0, 1]); 142 | affineBasisY = new Vector2(cameraMatrix[1, 0], cameraMatrix[1, 1]); 143 | affineTranslation = new Vector2(cameraMatrix[0, 2], cameraMatrix[1, 2]); 144 | #endif // UNITY_ANDROID 145 | 146 | affineBasisX = affineBasisX.normalized; 147 | affineBasisY = affineBasisY.normalized; 148 | Matrix4x4 m_DisplayRotationMatrix = Matrix4x4.identity; 149 | m_DisplayRotationMatrix = Matrix4x4.identity; 150 | m_DisplayRotationMatrix[0, 0] = affineBasisX.x; 151 | m_DisplayRotationMatrix[0, 1] = affineBasisY.x; 152 | m_DisplayRotationMatrix[1, 0] = affineBasisX.y; 153 | m_DisplayRotationMatrix[1, 1] = affineBasisY.y; 154 | 155 | #if UNITY_IOS 156 | Matrix4x4 FlipYMatrix = Matrix4x4.Scale(new Vector3(1, -1, 1)); 157 | m_DisplayRotationMatrix = FlipYMatrix.inverse * m_DisplayRotationMatrix; 158 | #endif // UNITY_IOS 159 | 160 | displayRotationAngle = (int)OpenCVARUtils.ExtractRotationFromMatrix(ref m_DisplayRotationMatrix).eulerAngles.z; 161 | Vector3 localScale = OpenCVARUtils.ExtractScaleFromMatrix(ref m_DisplayRotationMatrix); 162 | displayFlipVertical = Mathf.Sign(localScale.y) == -1; 163 | displayFlipHorizontal = Mathf.Sign(localScale.x) == -1; 164 | 165 | 166 | if (fpsMonitor != null) 167 | { 168 | fpsMonitor.Add("displayMatrix", "\n" + eventArgs.displayMatrix.ToString()); 169 | fpsMonitor.Add("displayRotationAngle", displayRotationAngle.ToString()); 170 | fpsMonitor.Add("displayFlipVertical", displayFlipVertical.ToString()); 171 | fpsMonitor.Add("displayFlipHorizontal", displayFlipHorizontal.ToString()); 172 | } 173 | 174 | } 175 | #else 176 | // Remove scaling and offset factors from the camera display matrix while maintaining orientation. 177 | // Decompose that matrix to extract the rotation and flipping factors. 178 | // https://github.com/Unity-Technologies/arfoundation-samples/blob/362a2596f35b9e45cb73920a9f8fffb1777e7d36/Assets/Scripts/Runtime/Occlusion/DisplayDepthImage.cs#L358 179 | if (eventArgs.displayMatrix.HasValue) 180 | { 181 | // Copy the display rotation matrix from the camera. 182 | Matrix4x4 cameraMatrix = eventArgs.displayMatrix ?? Matrix4x4.identity; 183 | 184 | Vector2 affineBasisX = new Vector2(cameraMatrix[0, 0], cameraMatrix[1, 0]); 185 | Vector2 affineBasisY = new Vector2(cameraMatrix[0, 1], cameraMatrix[1, 1]); 186 | Vector2 affineTranslation = new Vector2(cameraMatrix[2, 0], cameraMatrix[2, 1]); 187 | affineBasisX = affineBasisX.normalized; 188 | affineBasisY = affineBasisY.normalized; 189 | Matrix4x4 m_DisplayRotationMatrix = Matrix4x4.identity; 190 | m_DisplayRotationMatrix[0, 0] = affineBasisX.x; 191 | m_DisplayRotationMatrix[0, 1] = affineBasisY.x; 192 | m_DisplayRotationMatrix[1, 0] = affineBasisX.y; 193 | m_DisplayRotationMatrix[1, 1] = affineBasisY.y; 194 | 195 | Matrix4x4 FlipYMatrix = Matrix4x4.Scale(new Vector3(1, -1, 1)); 196 | m_DisplayRotationMatrix = FlipYMatrix.inverse * m_DisplayRotationMatrix; 197 | 198 | displayRotationAngle = (int)OpenCVARUtils.ExtractRotationFromMatrix(ref m_DisplayRotationMatrix).eulerAngles.z; 199 | Vector3 localScale = OpenCVARUtils.ExtractScaleFromMatrix(ref m_DisplayRotationMatrix); 200 | displayFlipVertical = Mathf.Sign(localScale.y) == -1; 201 | displayFlipHorizontal = Mathf.Sign(localScale.x) == -1; 202 | 203 | 204 | if (fpsMonitor != null) 205 | { 206 | fpsMonitor.Add("displayMatrix", "\n" + eventArgs.displayMatrix.ToString()); 207 | fpsMonitor.Add("displayRotationAngle", displayRotationAngle.ToString()); 208 | fpsMonitor.Add("displayFlipVertical", displayFlipVertical.ToString()); 209 | fpsMonitor.Add("displayFlipHorizontal", displayFlipHorizontal.ToString()); 210 | } 211 | 212 | } 213 | #endif // USE_ARFOUNDATION_5 214 | 215 | /* 216 | // Generate a camera matrix from cameraIntrinsics values. 217 | if (cameraManager.TryGetIntrinsics(out var cameraIntrinsics)) 218 | { 219 | var focalLength = cameraIntrinsics.focalLength; 220 | var principalPoint = cameraIntrinsics.principalPoint; 221 | 222 | Mat cameraMatrix = new Mat(3, 3, CvType.CV_64FC1); 223 | cameraMatrix.put(0, 0, new double[] { focalLength.x, 0, principalPoint.x, 0, focalLength.y, principalPoint.y, 0, 0, 1.0f }); 224 | 225 | if (fpsMonitor != null) 226 | { 227 | fpsMonitor.Add("cameraMatrix", "\n" + cameraMatrix.dump()); 228 | } 229 | } 230 | */ 231 | 232 | rgbaMat = new Mat(height, width, CvType.CV_8UC4); 233 | 234 | if (displayRotationAngle == 90 || displayRotationAngle == 270) 235 | { 236 | width = image.height; 237 | height = image.width; 238 | 239 | rotatedFrameMat = new Mat(height, width, CvType.CV_8UC4); 240 | } 241 | 242 | grayMat = new Mat(height, width, CvType.CV_8UC1); 243 | texture = new Texture2D(width, height, TextureFormat.RGBA32, false); 244 | 245 | resultPreview.texture = texture; 246 | resultPreview.GetComponent().aspectRatio = (float)texture.width / texture.height; 247 | 248 | hasInitDone = true; 249 | 250 | 251 | if (fpsMonitor != null) 252 | { 253 | fpsMonitor.Add("width", image.width.ToString()); 254 | fpsMonitor.Add("height", image.height.ToString()); 255 | fpsMonitor.Add("framerate", framerate.ToString()); 256 | fpsMonitor.Add("format", image.format.ToString()); 257 | fpsMonitor.Add("orientation", Screen.orientation.ToString()); 258 | 259 | //fpsMonitor.Add("FormatSupported", image.FormatSupported(TextureFormat.RGBA32).ToString()); 260 | //XRCpuImage.ConversionParams conversionParams = new XRCpuImage.ConversionParams(image, TextureFormat.RGBA32); 261 | //fpsMonitor.Add("GetConvertedDataSize", image.GetConvertedDataSize(conversionParams).ToString()); 262 | } 263 | 264 | } 265 | 266 | if (hasInitDone && isPlaying) 267 | { 268 | XRCpuImage.ConversionParams conversionParams = new XRCpuImage.ConversionParams(image, TextureFormat.RGBA32, XRCpuImage.Transformation.None); 269 | image.Convert(conversionParams, (IntPtr)rgbaMat.dataAddr(), (int)rgbaMat.total() * (int)rgbaMat.elemSize()); 270 | 271 | DisplayImage(); 272 | 273 | if (fpsMonitor != null) 274 | { 275 | fpsMonitor.Add("currentFacingDirection", cameraManager.currentFacingDirection.ToString()); 276 | fpsMonitor.Add("autoFocusEnabled", cameraManager.autoFocusEnabled.ToString()); 277 | fpsMonitor.Add("currentLightEstimation", cameraManager.currentLightEstimation.ToString()); 278 | } 279 | 280 | if (cameraManager.TryGetIntrinsics(out var cameraIntrinsics)) 281 | { 282 | var focalLength = cameraIntrinsics.focalLength; 283 | var principalPoint = cameraIntrinsics.principalPoint; 284 | 285 | if (fpsMonitor != null) 286 | { 287 | fpsMonitor.Add("cameraIntrinsics", "\n" + "FL: " + focalLength.x + "x" + focalLength.y + "\n" + "PP: " + principalPoint.x + "x" + principalPoint.y); 288 | } 289 | } 290 | 291 | if (eventArgs.projectionMatrix.HasValue) 292 | { 293 | if (fpsMonitor != null) 294 | { 295 | fpsMonitor.Add("projectionMatrix", "\n" + eventArgs.projectionMatrix.ToString()); 296 | } 297 | } 298 | 299 | if (eventArgs.timestampNs.HasValue) 300 | { 301 | if (fpsMonitor != null) 302 | { 303 | fpsMonitor.Add("timestampNs", eventArgs.timestampNs.ToString()); 304 | } 305 | } 306 | 307 | /* 308 | if (arCamera != null) 309 | { 310 | if (fpsMonitor != null) 311 | { 312 | fpsMonitor.Add("ARCamera_projectionMatrix", "\n" + arCamera.projectionMatrix.ToString()); 313 | fpsMonitor.Add("ARCamera_worldToCameraMatrix", "\n" + arCamera.worldToCameraMatrix.ToString()); 314 | } 315 | } 316 | */ 317 | } 318 | 319 | image.Dispose(); 320 | } 321 | 322 | protected void DisplayImage() 323 | { 324 | if (displayFlipVertical && displayFlipHorizontal) 325 | { 326 | Core.flip(rgbaMat, rgbaMat, -1); 327 | } 328 | else if (displayFlipVertical) 329 | { 330 | Core.flip(rgbaMat, rgbaMat, 0); 331 | } 332 | else if (displayFlipHorizontal) 333 | { 334 | Core.flip(rgbaMat, rgbaMat, 1); 335 | } 336 | 337 | if (rotatedFrameMat != null) 338 | { 339 | if (displayRotationAngle == 90) 340 | { 341 | Core.rotate(rgbaMat, rotatedFrameMat, Core.ROTATE_90_CLOCKWISE); 342 | } 343 | else if (displayRotationAngle == 270) 344 | { 345 | Core.rotate(rgbaMat, rotatedFrameMat, Core.ROTATE_90_COUNTERCLOCKWISE); 346 | } 347 | 348 | ProcessImage(rotatedFrameMat, grayMat, imageProcessingType); 349 | OpenCVMatUtils.MatToTexture2D(rotatedFrameMat, texture); 350 | } 351 | else 352 | { 353 | if (displayRotationAngle == 180) 354 | { 355 | Core.rotate(rgbaMat, rgbaMat, Core.ROTATE_180); 356 | } 357 | 358 | ProcessImage(rgbaMat, grayMat, imageProcessingType); 359 | OpenCVMatUtils.MatToTexture2D(rgbaMat, texture); 360 | } 361 | } 362 | 363 | /// 364 | /// Releases all resource. 365 | /// 366 | private void Dispose() 367 | { 368 | hasInitDone = false; 369 | 370 | if (rgbaMat != null) 371 | { 372 | rgbaMat.Dispose(); 373 | rgbaMat = null; 374 | } 375 | if (rotatedFrameMat != null) 376 | { 377 | rotatedFrameMat.Dispose(); 378 | rotatedFrameMat = null; 379 | } 380 | if (grayMat != null) 381 | { 382 | grayMat.Dispose(); 383 | grayMat = null; 384 | } 385 | if (texture != null) 386 | { 387 | Texture2D.Destroy(texture); 388 | texture = null; 389 | } 390 | } 391 | 392 | // Update is called once per frame 393 | void Update() 394 | { 395 | 396 | } 397 | 398 | /// 399 | /// Raises the destroy event. 400 | /// 401 | void OnDestroy() 402 | { 403 | Dispose(); 404 | } 405 | 406 | /// 407 | /// Raises the back button click event. 408 | /// 409 | public void OnBackButtonClick() 410 | { 411 | SceneManager.LoadScene("ARFoundationWithOpenCVForUnityExample"); 412 | } 413 | 414 | /// 415 | /// Raises the play button click event. 416 | /// 417 | public void OnPlayButtonClick() 418 | { 419 | if (hasInitDone) 420 | isPlaying = true; 421 | } 422 | 423 | /// 424 | /// Raises the pause button click event. 425 | /// 426 | public void OnPauseButtonClick() 427 | { 428 | if (hasInitDone) 429 | isPlaying = false; 430 | } 431 | 432 | /// 433 | /// Raises the stop button click event. 434 | /// 435 | public void OnStopButtonClick() 436 | { 437 | if (hasInitDone) 438 | isPlaying = false; 439 | } 440 | 441 | /// 442 | /// Raises the change camera button click event. 443 | /// 444 | public void OnChangeCameraButtonClick() 445 | { 446 | if (hasInitDone) 447 | { 448 | // https://github.com/Unity-Technologies/arfoundation-samples/blob/main/Assets/Scripts/CameraSwapper.cs 449 | CameraFacingDirection newFacingDirection; 450 | switch (cameraManager.requestedFacingDirection) 451 | { 452 | case CameraFacingDirection.World: 453 | newFacingDirection = CameraFacingDirection.User; 454 | break; 455 | case CameraFacingDirection.User: 456 | default: 457 | newFacingDirection = CameraFacingDirection.World; 458 | break; 459 | } 460 | 461 | Debug.Log($"Switching ARCameraManager.requestedFacingDirection from {cameraManager.requestedFacingDirection} to {newFacingDirection}"); 462 | cameraManager.requestedFacingDirection = newFacingDirection; 463 | 464 | hasInitDone = false; 465 | } 466 | } 467 | 468 | public void OnImageProcessingTypeDropdownValueChanged(int result) 469 | { 470 | imageProcessingType = (ImageProcessingType)result; 471 | } 472 | 473 | protected void ProcessImage(Mat frameMatrix, Mat grayMatrix, ImageProcessingType imageProcessingType) 474 | { 475 | switch (imageProcessingType) 476 | { 477 | case ImageProcessingType.DrawLine: 478 | Imgproc.line( 479 | frameMatrix, 480 | new Point(0, 0), 481 | new Point(frameMatrix.cols(), frameMatrix.rows()), 482 | new Scalar(255, 0, 0, 255), 483 | 4 484 | ); 485 | break; 486 | case ImageProcessingType.ConvertToGray: 487 | Imgproc.cvtColor(frameMatrix, grayMatrix, Imgproc.COLOR_RGBA2GRAY); 488 | Imgproc.cvtColor(grayMatrix, frameMatrix, Imgproc.COLOR_GRAY2RGBA); 489 | break; 490 | } 491 | } 492 | 493 | public enum ImageProcessingType 494 | { 495 | None, 496 | DrawLine, 497 | ConvertToGray, 498 | } 499 | } 500 | } 501 | 502 | #endif -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ARFoundationCameraToMatExample/ConvertAsyncARFoundationCameraToMatExample.cs: -------------------------------------------------------------------------------- 1 | #if !(PLATFORM_LUMIN && !UNITY_EDITOR) 2 | 3 | using OpenCVForUnity.CoreModule; 4 | using OpenCVForUnity.ImgprocModule; 5 | using OpenCVForUnity.UnityIntegration; 6 | using System; 7 | using Unity.Collections; 8 | using UnityEngine; 9 | using UnityEngine.SceneManagement; 10 | using UnityEngine.UI; 11 | using UnityEngine.XR.ARFoundation; 12 | using UnityEngine.XR.ARSubsystems; 13 | 14 | namespace ARFoundationWithOpenCVForUnityExample 15 | { 16 | /// 17 | /// ConvertAsync ARFoundationCameraToMat Example 18 | /// An example of converting an ARFoundation camera image to OpenCV's Mat format. 19 | /// 20 | public class ConvertAsyncARFoundationCameraToMatExample : MonoBehaviour 21 | { 22 | [Header("Output")] 23 | /// 24 | /// The RawImage for previewing the result. 25 | /// 26 | public RawImage resultPreview; 27 | 28 | [Space(10)] 29 | 30 | [SerializeField, TooltipAttribute("The ARCameraManager which will produce frame events.")] 31 | public ARCameraManager cameraManager = default; 32 | 33 | [SerializeField, TooltipAttribute("The ARCamera.")] 34 | public Camera arCamera; 35 | 36 | [Header("Processing")] 37 | public ImageProcessingType imageProcessingType = ImageProcessingType.None; 38 | public Dropdown imageProcessingTypeDropdown; 39 | 40 | Mat rgbaMat; 41 | 42 | Mat rotatedFrameMat; 43 | 44 | Mat grayMat; 45 | 46 | Texture2D texture; 47 | 48 | bool hasInitDone = false; 49 | 50 | bool isPlaying = true; 51 | 52 | ScreenOrientation screenOrientation; 53 | 54 | int displayRotationAngle = 0; 55 | bool displayFlipVertical = false; 56 | bool displayFlipHorizontal = false; 57 | 58 | FpsMonitor fpsMonitor; 59 | 60 | // Use this for initialization 61 | void Start() 62 | { 63 | Debug.Assert(cameraManager != null, "camera manager cannot be null"); 64 | 65 | fpsMonitor = GetComponent(); 66 | 67 | 68 | // Checks camera permission state. 69 | if (fpsMonitor != null && !cameraManager.permissionGranted) 70 | { 71 | fpsMonitor.consoleText = "Camera permission has not been granted."; 72 | } 73 | 74 | // Update UI 75 | if (imageProcessingTypeDropdown != null) 76 | imageProcessingTypeDropdown.value = (int)imageProcessingType; 77 | } 78 | 79 | void OnEnable() 80 | { 81 | if (cameraManager != null) 82 | { 83 | cameraManager.frameReceived += OnCameraFrameReceived; 84 | } 85 | } 86 | 87 | void OnDisable() 88 | { 89 | if (cameraManager != null) 90 | { 91 | cameraManager.frameReceived -= OnCameraFrameReceived; 92 | } 93 | } 94 | 95 | protected void OnCameraFrameReceived(ARCameraFrameEventArgs eventArgs) 96 | { 97 | if ((cameraManager == null) || (cameraManager.subsystem == null) || !cameraManager.subsystem.running) 98 | return; 99 | 100 | // Attempt to get the latest camera image. If this method succeeds, 101 | // it acquires a native resource that must be disposed (see below). 102 | if (!cameraManager.TryAcquireLatestCpuImage(out XRCpuImage image)) 103 | { 104 | return; 105 | } 106 | 107 | int width = image.width; 108 | int height = image.height; 109 | 110 | if (!hasInitDone || rgbaMat == null || rgbaMat.cols() != width || rgbaMat.rows() != height || screenOrientation != Screen.orientation) 111 | { 112 | Dispose(); 113 | 114 | screenOrientation = Screen.orientation; 115 | 116 | XRCameraConfiguration config = (XRCameraConfiguration)cameraManager.currentConfiguration; 117 | int framerate = config.framerate.HasValue ? config.framerate.Value : -1; 118 | 119 | Debug.Log("name:" + cameraManager.name + " width:" + width + " height:" + height + " fps:" + framerate); 120 | Debug.Log(" format:" + image.format + " isFrongFacing:" + (cameraManager.currentFacingDirection == CameraFacingDirection.User)); 121 | 122 | 123 | #if USE_ARFOUNDATION_5 124 | // Remove scaling and offset factors from the camera display matrix while maintaining orientation. 125 | // Decompose that matrix to extract the rotation and flipping factors. 126 | // https://github.com/Unity-Technologies/arfoundation-samples/blob/88179bab2b180dd90229d9ec995204be47da1cc1/Assets/Scripts/DisplayDepthImage.cs#L333 127 | if (eventArgs.displayMatrix.HasValue) 128 | { 129 | // Copy the display rotation matrix from the camera. 130 | Matrix4x4 cameraMatrix = eventArgs.displayMatrix ?? Matrix4x4.identity; 131 | 132 | Vector2 affineBasisX = new Vector2(1.0f, 0.0f); 133 | Vector2 affineBasisY = new Vector2(0.0f, 1.0f); 134 | Vector2 affineTranslation = new Vector2(0.0f, 0.0f); 135 | 136 | #if UNITY_IOS 137 | affineBasisX = new Vector2(cameraMatrix[0, 0], cameraMatrix[1, 0]); 138 | affineBasisY = new Vector2(cameraMatrix[0, 1], cameraMatrix[1, 1]); 139 | affineTranslation = new Vector2(cameraMatrix[2, 0], cameraMatrix[2, 1]); 140 | #endif // UNITY_IOS 141 | #if UNITY_ANDROID 142 | affineBasisX = new Vector2(cameraMatrix[0, 0], cameraMatrix[0, 1]); 143 | affineBasisY = new Vector2(cameraMatrix[1, 0], cameraMatrix[1, 1]); 144 | affineTranslation = new Vector2(cameraMatrix[0, 2], cameraMatrix[1, 2]); 145 | #endif // UNITY_ANDROID 146 | 147 | affineBasisX = affineBasisX.normalized; 148 | affineBasisY = affineBasisY.normalized; 149 | Matrix4x4 m_DisplayRotationMatrix = Matrix4x4.identity; 150 | m_DisplayRotationMatrix = Matrix4x4.identity; 151 | m_DisplayRotationMatrix[0, 0] = affineBasisX.x; 152 | m_DisplayRotationMatrix[0, 1] = affineBasisY.x; 153 | m_DisplayRotationMatrix[1, 0] = affineBasisX.y; 154 | m_DisplayRotationMatrix[1, 1] = affineBasisY.y; 155 | 156 | #if UNITY_IOS 157 | Matrix4x4 FlipYMatrix = Matrix4x4.Scale(new Vector3(1, -1, 1)); 158 | m_DisplayRotationMatrix = FlipYMatrix.inverse * m_DisplayRotationMatrix; 159 | #endif // UNITY_IOS 160 | 161 | displayRotationAngle = (int)OpenCVARUtils.ExtractRotationFromMatrix(ref m_DisplayRotationMatrix).eulerAngles.z; 162 | Vector3 localScale = OpenCVARUtils.ExtractScaleFromMatrix(ref m_DisplayRotationMatrix); 163 | displayFlipVertical = Mathf.Sign(localScale.y) == -1; 164 | displayFlipHorizontal = Mathf.Sign(localScale.x) == -1; 165 | 166 | 167 | if (fpsMonitor != null) 168 | { 169 | fpsMonitor.Add("displayMatrix", "\n" + eventArgs.displayMatrix.ToString()); 170 | fpsMonitor.Add("displayRotationAngle", displayRotationAngle.ToString()); 171 | fpsMonitor.Add("displayFlipVertical", displayFlipVertical.ToString()); 172 | fpsMonitor.Add("displayFlipHorizontal", displayFlipHorizontal.ToString()); 173 | } 174 | } 175 | #else 176 | // Remove scaling and offset factors from the camera display matrix while maintaining orientation. 177 | // Decompose that matrix to extract the rotation and flipping factors. 178 | // https://github.com/Unity-Technologies/arfoundation-samples/blob/362a2596f35b9e45cb73920a9f8fffb1777e7d36/Assets/Scripts/Runtime/Occlusion/DisplayDepthImage.cs#L358 179 | if (eventArgs.displayMatrix.HasValue) 180 | { 181 | // Copy the display rotation matrix from the camera. 182 | Matrix4x4 cameraMatrix = eventArgs.displayMatrix ?? Matrix4x4.identity; 183 | 184 | Vector2 affineBasisX = new Vector2(cameraMatrix[0, 0], cameraMatrix[1, 0]); 185 | Vector2 affineBasisY = new Vector2(cameraMatrix[0, 1], cameraMatrix[1, 1]); 186 | Vector2 affineTranslation = new Vector2(cameraMatrix[2, 0], cameraMatrix[2, 1]); 187 | affineBasisX = affineBasisX.normalized; 188 | affineBasisY = affineBasisY.normalized; 189 | Matrix4x4 m_DisplayRotationMatrix = Matrix4x4.identity; 190 | m_DisplayRotationMatrix[0, 0] = affineBasisX.x; 191 | m_DisplayRotationMatrix[0, 1] = affineBasisY.x; 192 | m_DisplayRotationMatrix[1, 0] = affineBasisX.y; 193 | m_DisplayRotationMatrix[1, 1] = affineBasisY.y; 194 | 195 | Matrix4x4 FlipYMatrix = Matrix4x4.Scale(new Vector3(1, -1, 1)); 196 | m_DisplayRotationMatrix = FlipYMatrix.inverse * m_DisplayRotationMatrix; 197 | 198 | displayRotationAngle = (int)OpenCVARUtils.ExtractRotationFromMatrix(ref m_DisplayRotationMatrix).eulerAngles.z; 199 | Vector3 localScale = OpenCVARUtils.ExtractScaleFromMatrix(ref m_DisplayRotationMatrix); 200 | displayFlipVertical = Mathf.Sign(localScale.y) == -1; 201 | displayFlipHorizontal = Mathf.Sign(localScale.x) == -1; 202 | 203 | 204 | if (fpsMonitor != null) 205 | { 206 | fpsMonitor.Add("displayMatrix", "\n" + eventArgs.displayMatrix.ToString()); 207 | fpsMonitor.Add("displayRotationAngle", displayRotationAngle.ToString()); 208 | fpsMonitor.Add("displayFlipVertical", displayFlipVertical.ToString()); 209 | fpsMonitor.Add("displayFlipHorizontal", displayFlipHorizontal.ToString()); 210 | } 211 | 212 | } 213 | #endif // USE_ARFOUNDATION_5 214 | 215 | /* 216 | // Generate a camera matrix from cameraIntrinsics values. 217 | if (cameraManager.TryGetIntrinsics(out var cameraIntrinsics)) 218 | { 219 | var focalLength = cameraIntrinsics.focalLength; 220 | var principalPoint = cameraIntrinsics.principalPoint; 221 | 222 | Mat cameraMatrix = new Mat(3, 3, CvType.CV_64FC1); 223 | cameraMatrix.put(0, 0, new double[] { focalLength.x, 0, principalPoint.x, 0, focalLength.y, principalPoint.y, 0, 0, 1.0f }); 224 | 225 | if (fpsMonitor != null) 226 | { 227 | fpsMonitor.Add("cameraMatrix", "\n" + cameraMatrix.dump()); 228 | } 229 | } 230 | */ 231 | 232 | rgbaMat = new Mat(height, width, CvType.CV_8UC4); 233 | 234 | if (displayRotationAngle == 90 || displayRotationAngle == 270) 235 | { 236 | width = image.height; 237 | height = image.width; 238 | 239 | rotatedFrameMat = new Mat(height, width, CvType.CV_8UC4); 240 | } 241 | 242 | grayMat = new Mat(height, width, CvType.CV_8UC1); 243 | texture = new Texture2D(width, height, TextureFormat.RGBA32, false); 244 | 245 | resultPreview.texture = texture; 246 | resultPreview.GetComponent().aspectRatio = (float)texture.width / texture.height; 247 | 248 | hasInitDone = true; 249 | 250 | 251 | if (fpsMonitor != null) 252 | { 253 | fpsMonitor.Add("width", image.width.ToString()); 254 | fpsMonitor.Add("height", image.height.ToString()); 255 | fpsMonitor.Add("framerate", framerate.ToString()); 256 | fpsMonitor.Add("format", image.format.ToString()); 257 | fpsMonitor.Add("orientation", Screen.orientation.ToString()); 258 | 259 | //fpsMonitor.Add("FormatSupported", image.FormatSupported(TextureFormat.RGBA32).ToString()); 260 | //XRCpuImage.ConversionParams conversionParams = new XRCpuImage.ConversionParams(image, TextureFormat.RGBA32); 261 | //fpsMonitor.Add("GetConvertedDataSize", image.GetConvertedDataSize(conversionParams).ToString()); 262 | } 263 | 264 | } 265 | 266 | if (hasInitDone && isPlaying) 267 | { 268 | XRCpuImage.ConversionParams conversionParams = new XRCpuImage.ConversionParams(image, TextureFormat.RGBA32, XRCpuImage.Transformation.None); 269 | image.ConvertAsync(conversionParams, ProcessImage); 270 | 271 | if (fpsMonitor != null) 272 | { 273 | fpsMonitor.Add("currentFacingDirection", cameraManager.currentFacingDirection.ToString()); 274 | fpsMonitor.Add("autoFocusEnabled", cameraManager.autoFocusEnabled.ToString()); 275 | fpsMonitor.Add("currentLightEstimation", cameraManager.currentLightEstimation.ToString()); 276 | } 277 | 278 | if (cameraManager.TryGetIntrinsics(out var cameraIntrinsics)) 279 | { 280 | var focalLength = cameraIntrinsics.focalLength; 281 | var principalPoint = cameraIntrinsics.principalPoint; 282 | 283 | if (fpsMonitor != null) 284 | { 285 | fpsMonitor.Add("cameraIntrinsics", "\n" + "FL: " + focalLength.x + "x" + focalLength.y + "\n" + "PP: " + principalPoint.x + "x" + principalPoint.y); 286 | } 287 | } 288 | 289 | if (eventArgs.projectionMatrix.HasValue) 290 | { 291 | if (fpsMonitor != null) 292 | { 293 | fpsMonitor.Add("projectionMatrix", "\n" + eventArgs.projectionMatrix.ToString()); 294 | } 295 | } 296 | 297 | if (eventArgs.timestampNs.HasValue) 298 | { 299 | if (fpsMonitor != null) 300 | { 301 | fpsMonitor.Add("timestampNs", eventArgs.timestampNs.ToString()); 302 | } 303 | } 304 | 305 | /* 306 | if (arCamera != null) 307 | { 308 | if (fpsMonitor != null) 309 | { 310 | fpsMonitor.Add("ARCamera_projectionMatrix", "\n" + arCamera.projectionMatrix.ToString()); 311 | fpsMonitor.Add("ARCamera_worldToCameraMatrix", "\n" + arCamera.worldToCameraMatrix.ToString()); 312 | } 313 | } 314 | */ 315 | } 316 | 317 | image.Dispose(); 318 | } 319 | 320 | private void ProcessImage(XRCpuImage.AsyncConversionStatus status, XRCpuImage.ConversionParams conversionParams, NativeArray data) 321 | { 322 | if (status != XRCpuImage.AsyncConversionStatus.Ready) 323 | { 324 | Debug.LogErrorFormat("Async request failed with status {0}", status); 325 | return; 326 | } 327 | 328 | if (hasInitDone) 329 | { 330 | OpenCVMatUtils.CopyToMat(data, rgbaMat); 331 | 332 | DisplayImage(); 333 | } 334 | } 335 | 336 | protected void DisplayImage() 337 | { 338 | if (displayFlipVertical && displayFlipHorizontal) 339 | { 340 | Core.flip(rgbaMat, rgbaMat, -1); 341 | } 342 | else if (displayFlipVertical) 343 | { 344 | Core.flip(rgbaMat, rgbaMat, 0); 345 | } 346 | else if (displayFlipHorizontal) 347 | { 348 | Core.flip(rgbaMat, rgbaMat, 1); 349 | } 350 | 351 | if (rotatedFrameMat != null) 352 | { 353 | if (displayRotationAngle == 90) 354 | { 355 | Core.rotate(rgbaMat, rotatedFrameMat, Core.ROTATE_90_CLOCKWISE); 356 | } 357 | else if (displayRotationAngle == 270) 358 | { 359 | Core.rotate(rgbaMat, rotatedFrameMat, Core.ROTATE_90_COUNTERCLOCKWISE); 360 | } 361 | 362 | ProcessImage(rotatedFrameMat, grayMat, imageProcessingType); 363 | OpenCVMatUtils.MatToTexture2D(rotatedFrameMat, texture); 364 | } 365 | else 366 | { 367 | if (displayRotationAngle == 180) 368 | { 369 | Core.rotate(rgbaMat, rgbaMat, Core.ROTATE_180); 370 | } 371 | 372 | ProcessImage(rgbaMat, grayMat, imageProcessingType); 373 | OpenCVMatUtils.MatToTexture2D(rgbaMat, texture); 374 | } 375 | } 376 | 377 | /// 378 | /// Releases all resource. 379 | /// 380 | private void Dispose() 381 | { 382 | hasInitDone = false; 383 | 384 | if (rgbaMat != null) 385 | { 386 | rgbaMat.Dispose(); 387 | rgbaMat = null; 388 | } 389 | if (rotatedFrameMat != null) 390 | { 391 | rotatedFrameMat.Dispose(); 392 | rotatedFrameMat = null; 393 | } 394 | if (grayMat != null) 395 | { 396 | grayMat.Dispose(); 397 | grayMat = null; 398 | } 399 | if (texture != null) 400 | { 401 | Texture2D.Destroy(texture); 402 | texture = null; 403 | } 404 | } 405 | 406 | // Update is called once per frame 407 | void Update() 408 | { 409 | 410 | } 411 | 412 | /// 413 | /// Raises the destroy event. 414 | /// 415 | void OnDestroy() 416 | { 417 | Dispose(); 418 | } 419 | 420 | /// 421 | /// Raises the back button click event. 422 | /// 423 | public void OnBackButtonClick() 424 | { 425 | SceneManager.LoadScene("ARFoundationWithOpenCVForUnityExample"); 426 | } 427 | 428 | /// 429 | /// Raises the play button click event. 430 | /// 431 | public void OnPlayButtonClick() 432 | { 433 | if (hasInitDone) 434 | isPlaying = true; 435 | } 436 | 437 | /// 438 | /// Raises the pause button click event. 439 | /// 440 | public void OnPauseButtonClick() 441 | { 442 | if (hasInitDone) 443 | isPlaying = false; 444 | } 445 | 446 | /// 447 | /// Raises the stop button click event. 448 | /// 449 | public void OnStopButtonClick() 450 | { 451 | if (hasInitDone) 452 | isPlaying = false; 453 | } 454 | 455 | /// 456 | /// Raises the change camera button click event. 457 | /// 458 | public void OnChangeCameraButtonClick() 459 | { 460 | if (hasInitDone) 461 | { 462 | // https://github.com/Unity-Technologies/arfoundation-samples/blob/main/Assets/Scripts/CameraSwapper.cs 463 | CameraFacingDirection newFacingDirection; 464 | switch (cameraManager.requestedFacingDirection) 465 | { 466 | case CameraFacingDirection.World: 467 | newFacingDirection = CameraFacingDirection.User; 468 | break; 469 | case CameraFacingDirection.User: 470 | default: 471 | newFacingDirection = CameraFacingDirection.World; 472 | break; 473 | } 474 | 475 | Debug.Log($"Switching ARCameraManager.requestedFacingDirection from {cameraManager.requestedFacingDirection} to {newFacingDirection}"); 476 | cameraManager.requestedFacingDirection = newFacingDirection; 477 | 478 | hasInitDone = false; 479 | } 480 | } 481 | 482 | public void OnImageProcessingTypeDropdownValueChanged(int result) 483 | { 484 | imageProcessingType = (ImageProcessingType)result; 485 | } 486 | 487 | protected void ProcessImage(Mat frameMatrix, Mat grayMatrix, ImageProcessingType imageProcessingType) 488 | { 489 | switch (imageProcessingType) 490 | { 491 | case ImageProcessingType.DrawLine: 492 | Imgproc.line( 493 | frameMatrix, 494 | new Point(0, 0), 495 | new Point(frameMatrix.cols(), frameMatrix.rows()), 496 | new Scalar(255, 0, 0, 255), 497 | 4 498 | ); 499 | break; 500 | case ImageProcessingType.ConvertToGray: 501 | Imgproc.cvtColor(frameMatrix, grayMatrix, Imgproc.COLOR_RGBA2GRAY); 502 | Imgproc.cvtColor(grayMatrix, frameMatrix, Imgproc.COLOR_GRAY2RGBA); 503 | break; 504 | } 505 | } 506 | 507 | public enum ImageProcessingType 508 | { 509 | None, 510 | DrawLine, 511 | ConvertToGray, 512 | } 513 | } 514 | } 515 | 516 | #endif -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ARFoundationCameraArUcoExample/ARFoundationCameraArUcoExample.cs: -------------------------------------------------------------------------------- 1 | #if !(PLATFORM_LUMIN && !UNITY_EDITOR) 2 | 3 | using ARFoundationWithOpenCVForUnity.UnityIntegration.Helper.Source2Mat; 4 | using OpenCVForUnity.ObjdetectModule; 5 | using OpenCVForUnity.Calib3dModule; 6 | using OpenCVForUnity.CoreModule; 7 | using OpenCVForUnity.ImgprocModule; 8 | using OpenCVForUnity.UnityIntegration; 9 | using OpenCVForUnity.UnityIntegration.Helper.Source2Mat; 10 | using System.Collections.Generic; 11 | using UnityEngine; 12 | using UnityEngine.SceneManagement; 13 | using UnityEngine.UI; 14 | using UnityEngine.XR.ARFoundation; 15 | using UnityEngine.XR.ARSubsystems; 16 | using Unity.XR.CoreUtils; 17 | using static OpenCVForUnity.UnityIntegration.OpenCVARUtils; 18 | 19 | namespace ARFoundationWithOpenCVForUnityExample 20 | { 21 | /// 22 | /// ARFoundationCamera ArUco Example 23 | /// An example of ArUco marker detection from an ARFoundation camera image. 24 | /// 25 | [RequireComponent(typeof(ARFoundationCamera2MatHelper))] 26 | public class ARFoundationCameraArUcoExample : MonoBehaviour 27 | { 28 | [Header("Output")] 29 | /// 30 | /// The raw camera image. 31 | /// 32 | public RawImage rawCameraImage; 33 | 34 | [Space(10)] 35 | 36 | /// 37 | /// The dictionary identifier. 38 | /// 39 | public ArUcoDictionary dictionaryId = ArUcoDictionary.DICT_6X6_250; 40 | 41 | /// 42 | /// The dictionary id dropdown. 43 | /// 44 | public Dropdown dictionaryIdDropdown; 45 | 46 | /// 47 | /// Determines if applied the pose estimation. 48 | /// 49 | public bool applyEstimationPose = true; 50 | 51 | /// 52 | /// The apply estimation pose toggle. 53 | /// 54 | public Toggle applyEstimationPoseToggle; 55 | 56 | [Space(10)] 57 | 58 | /// 59 | /// The length of the markers' side. Normally, unit is meters. 60 | /// 61 | public float markerLength = 0.188f; 62 | 63 | /// 64 | /// The AR game object. 65 | /// 66 | public ARGameObject arGameObject; 67 | 68 | /// 69 | /// The XR Origin. 70 | /// 71 | public XROrigin xROrigin; 72 | 73 | [Space(10)] 74 | 75 | /// 76 | /// Determines if enable leap filter. 77 | /// 78 | public bool enableLerpFilter; 79 | 80 | /// 81 | /// The enable leap filter toggle. 82 | /// 83 | public Toggle enableLerpFilterToggle; 84 | 85 | /// 86 | /// The texture. 87 | /// 88 | Texture2D texture; 89 | 90 | /// 91 | /// The webcam texture to mat helper. 92 | /// 93 | ARFoundationCamera2MatHelper webCamTextureToMatHelper; 94 | 95 | /// 96 | /// The rgb mat. 97 | /// 98 | Mat rgbMat; 99 | 100 | /// 101 | /// The cameraparam matrix. 102 | /// 103 | Mat camMatrix; 104 | 105 | /// 106 | /// The distortion coeffs. 107 | /// 108 | MatOfDouble distCoeffs; 109 | 110 | /// 111 | /// The transformation matrix for AR. 112 | /// 113 | Matrix4x4 ARM; 114 | 115 | /// 116 | /// The FPS monitor. 117 | /// 118 | FpsMonitor fpsMonitor; 119 | 120 | // for CanonicalMarker. 121 | Mat ids; 122 | List corners; 123 | List rejectedCorners; 124 | Dictionary dictionary; 125 | ArucoDetector arucoDetector; 126 | 127 | Mat rvecs; 128 | Mat tvecs; 129 | 130 | 131 | Matrix4x4 fitARFoundationBackgroundMatrix; 132 | Matrix4x4 fitHelpersFlipMatrix; 133 | 134 | 135 | // Use this for initialization 136 | void Start() 137 | { 138 | fpsMonitor = GetComponent(); 139 | 140 | webCamTextureToMatHelper = gameObject.GetComponent(); 141 | webCamTextureToMatHelper.OutputColorFormat = Source2MatHelperColorFormat.RGBA; 142 | #if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR && !DISABLE_ARFOUNDATION_API 143 | webCamTextureToMatHelper.FrameMatAcquired += OnFrameMatAcquired; 144 | #endif // (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR && !DISABLE_ARFOUNDATION_API 145 | webCamTextureToMatHelper.Initialize(); 146 | 147 | dictionaryIdDropdown.value = (int)dictionaryId; 148 | applyEstimationPoseToggle.isOn = applyEstimationPose; 149 | enableLerpFilterToggle.isOn = enableLerpFilter; 150 | } 151 | 152 | /// 153 | /// Raises the webcam texture to mat helper initialized event. 154 | /// 155 | public void OnWebCamTextureToMatHelperInitialized() 156 | { 157 | Debug.Log("OnWebCamTextureToMatHelperInitialized"); 158 | 159 | Mat rgbaMat = webCamTextureToMatHelper.GetMat(); 160 | 161 | texture = new Texture2D(rgbaMat.cols(), rgbaMat.rows(), TextureFormat.RGBA32, false); 162 | OpenCVMatUtils.MatToTexture2D(rgbaMat, texture); 163 | 164 | rawCameraImage.texture = texture; 165 | float heightScale = (float)rgbaMat.height() / rgbaMat.width(); 166 | rawCameraImage.rectTransform.sizeDelta = new Vector2(640, 640 * heightScale); 167 | 168 | Debug.Log("Screen.width " + Screen.width + " Screen.height " + Screen.height + " Screen.orientation " + Screen.orientation); 169 | 170 | 171 | if (fpsMonitor != null) 172 | { 173 | fpsMonitor.Add("width", rgbaMat.width().ToString()); 174 | fpsMonitor.Add("height", rgbaMat.height().ToString()); 175 | fpsMonitor.Add("orientation", Screen.orientation.ToString()); 176 | fpsMonitor.Add("IsFrontFacing", webCamTextureToMatHelper.IsFrontFacing().ToString()); 177 | fpsMonitor.Add("requestedFacingDirection", webCamTextureToMatHelper.RequestedFacingDirection.ToString()); 178 | fpsMonitor.Add("currentFacingDirection", webCamTextureToMatHelper.CurrentFacingDirection.ToString()); 179 | fpsMonitor.Add("requestedLightEstimation", webCamTextureToMatHelper.RequestedLightEstimation.ToString()); 180 | fpsMonitor.Add("currentLightEstimation", webCamTextureToMatHelper.CurrentLightEstimation.ToString()); 181 | } 182 | 183 | webCamTextureToMatHelper.FlipHorizontal = webCamTextureToMatHelper.IsFrontFacing(); 184 | 185 | // set camera parameters. 186 | double fx; 187 | double fy; 188 | double cx; 189 | double cy; 190 | 191 | #if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR && !DISABLE_ARFOUNDATION_API 192 | 193 | UnityEngine.XR.ARSubsystems.XRCameraIntrinsics cameraIntrinsics = webCamTextureToMatHelper.GetCameraIntrinsics(); 194 | 195 | // Apply the rotate and flip properties of camera helper to the camera intrinsics. 196 | Vector2 fl = cameraIntrinsics.focalLength; 197 | Vector2 pp = cameraIntrinsics.principalPoint; 198 | Vector2Int r = cameraIntrinsics.resolution; 199 | 200 | Matrix4x4 tM = Matrix4x4.Translate(new Vector3(-r.x / 2, -r.y / 2, 0)); 201 | pp = tM.MultiplyPoint3x4(pp); 202 | 203 | Matrix4x4 rotationAndFlipM = Matrix4x4.TRS(Vector3.zero, Quaternion.Euler(0, 0, webCamTextureToMatHelper.Rotate90Degree ? 90 : 0), 204 | new Vector3(webCamTextureToMatHelper.FlipHorizontal ? -1 : 1, webCamTextureToMatHelper.FlipVertical ? -1 : 1, 1)); 205 | pp = rotationAndFlipM.MultiplyPoint3x4(pp); 206 | 207 | if (webCamTextureToMatHelper.Rotate90Degree) 208 | { 209 | fl = new Vector2(fl.y, fl.x); 210 | r = new Vector2Int(r.y, r.x); 211 | } 212 | 213 | Matrix4x4 _tM = Matrix4x4.Translate(new Vector3(r.x / 2, r.y / 2, 0)); 214 | pp = _tM.MultiplyPoint3x4(pp); 215 | 216 | cameraIntrinsics = new UnityEngine.XR.ARSubsystems.XRCameraIntrinsics(fl, pp, r); 217 | 218 | fx = cameraIntrinsics.focalLength.x; 219 | fy = cameraIntrinsics.focalLength.y; 220 | cx = cameraIntrinsics.principalPoint.x; 221 | cy = cameraIntrinsics.principalPoint.y; 222 | 223 | camMatrix = new Mat(3, 3, CvType.CV_64FC1); 224 | camMatrix.put(0, 0, fx); 225 | camMatrix.put(0, 1, 0); 226 | camMatrix.put(0, 2, cx); 227 | camMatrix.put(1, 0, 0); 228 | camMatrix.put(1, 1, fy); 229 | camMatrix.put(1, 2, cy); 230 | camMatrix.put(2, 0, 0); 231 | camMatrix.put(2, 1, 0); 232 | camMatrix.put(2, 2, 1.0f); 233 | 234 | distCoeffs = new MatOfDouble(0, 0, 0, 0); 235 | 236 | Debug.Log("Created CameraParameters from the camera intrinsics to be populated if the camera supports intrinsics."); 237 | 238 | var focalLength = cameraIntrinsics.focalLength; 239 | var principalPoint = cameraIntrinsics.principalPoint; 240 | var resolution = cameraIntrinsics.resolution; 241 | 242 | if (fpsMonitor != null) 243 | { 244 | fpsMonitor.Add("cameraIntrinsics", "\n" + "FL: " + focalLength.x + "x" + focalLength.y + "\n" + "PP: " + principalPoint.x + "x" + principalPoint.y + "\n" + "R: " + resolution.x + "x" + resolution.y); 245 | } 246 | 247 | #else // (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR && !DISABLE_ARFOUNDATION_API 248 | 249 | float width = rgbaMat.width(); 250 | float height = rgbaMat.height(); 251 | 252 | int max_d = (int)Mathf.Max(width, height); 253 | fx = max_d; 254 | fy = max_d; 255 | cx = width / 2.0f; 256 | cy = height / 2.0f; 257 | 258 | camMatrix = new Mat(3, 3, CvType.CV_64FC1); 259 | camMatrix.put(0, 0, fx); 260 | camMatrix.put(0, 1, 0); 261 | camMatrix.put(0, 2, cx); 262 | camMatrix.put(1, 0, 0); 263 | camMatrix.put(1, 1, fy); 264 | camMatrix.put(1, 2, cy); 265 | camMatrix.put(2, 0, 0); 266 | camMatrix.put(2, 1, 0); 267 | camMatrix.put(2, 2, 1.0f); 268 | 269 | distCoeffs = new MatOfDouble(0, 0, 0, 0); 270 | 271 | Debug.Log("Created a dummy CameraParameters."); 272 | 273 | #endif // (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR && !DISABLE_ARFOUNDATION_API 274 | 275 | Debug.Log("camMatrix " + camMatrix.dump()); 276 | Debug.Log("distCoeffs " + distCoeffs.dump()); 277 | 278 | 279 | rgbMat = new Mat(rgbaMat.rows(), rgbaMat.cols(), CvType.CV_8UC3); 280 | 281 | 282 | ids = new Mat(); 283 | corners = new List(); 284 | rejectedCorners = new List(); 285 | rvecs = new Mat(1, 10, CvType.CV_64FC3); 286 | tvecs = new Mat(1, 10, CvType.CV_64FC3); 287 | dictionary = Objdetect.getPredefinedDictionary((int)dictionaryId); 288 | 289 | DetectorParameters detectorParams = new DetectorParameters(); 290 | detectorParams.set_useAruco3Detection(true); 291 | RefineParameters refineParameters = new RefineParameters(10f, 3f, true); 292 | arucoDetector = new ArucoDetector(dictionary, detectorParams, refineParameters); 293 | 294 | 295 | // Create the transform matrix to fit the ARM to the background display by ARFoundationBackground component. 296 | fitARFoundationBackgroundMatrix = Matrix4x4.Scale(new Vector3(webCamTextureToMatHelper.GetDisplayFlipHorizontal() ? -1 : 1, webCamTextureToMatHelper.GetDisplayFlipVertical() ? -1 : 1, 1)) * Matrix4x4.identity; 297 | 298 | // Create the transform matrix to fit the ARM to the flip properties of the camera helper. 299 | fitHelpersFlipMatrix = Matrix4x4.Scale(new Vector3(webCamTextureToMatHelper.FlipHorizontal ? -1 : 1, webCamTextureToMatHelper.FlipVertical ? -1 : 1, 1)) * Matrix4x4.identity; 300 | } 301 | 302 | /// 303 | /// Raises the webcam texture to mat helper disposed event. 304 | /// 305 | public void OnWebCamTextureToMatHelperDisposed() 306 | { 307 | Debug.Log("OnWebCamTextureToMatHelperDisposed"); 308 | 309 | if (rgbMat != null) 310 | rgbMat.Dispose(); 311 | 312 | if (texture != null) 313 | { 314 | Texture2D.Destroy(texture); 315 | texture = null; 316 | } 317 | 318 | if (ids != null) 319 | ids.Dispose(); 320 | foreach (var item in corners) 321 | { 322 | item.Dispose(); 323 | } 324 | corners.Clear(); 325 | foreach (var item in rejectedCorners) 326 | { 327 | item.Dispose(); 328 | } 329 | rejectedCorners.Clear(); 330 | if (rvecs != null) 331 | rvecs.Dispose(); 332 | if (tvecs != null) 333 | tvecs.Dispose(); 334 | } 335 | 336 | /// 337 | /// Raises the webcam texture to mat helper error occurred event. 338 | /// 339 | /// Error code. 340 | /// Message. 341 | public void OnWebCamTextureToMatHelperErrorOccurred(Source2MatHelperErrorCode errorCode, string message) 342 | { 343 | Debug.Log("OnWebCamTextureToMatHelperErrorOccurred " + errorCode + ":" + message); 344 | 345 | if (fpsMonitor != null) 346 | { 347 | fpsMonitor.consoleText = "ErrorCode: " + errorCode + ":" + message; 348 | } 349 | } 350 | 351 | #if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR && !DISABLE_ARFOUNDATION_API 352 | 353 | void OnFrameMatAcquired(Mat mat, Matrix4x4 projectionMatrix, Matrix4x4 cameraToWorldMatrix, XRCameraIntrinsics cameraIntrinsics, long timestamp) 354 | { 355 | Mat rgbaMat = mat; 356 | 357 | Imgproc.cvtColor(rgbaMat, rgbMat, Imgproc.COLOR_RGBA2RGB); 358 | 359 | // detect markers. 360 | Calib3d.undistort(rgbMat, rgbMat, camMatrix, distCoeffs); 361 | arucoDetector.detectMarkers(rgbMat, corners, ids, rejectedCorners); 362 | 363 | // if at least one marker detected 364 | if (ids.total() > 0) 365 | { 366 | // draw markers. 367 | Objdetect.drawDetectedMarkers(rgbMat, corners, ids, new Scalar(0, 255, 0)); 368 | 369 | // estimate pose. 370 | if (applyEstimationPose) 371 | { 372 | EstimatePoseCanonicalMarker(rgbMat); 373 | } 374 | } 375 | 376 | //Imgproc.putText (rgbMat, "W:" + rgbMat.width () + " H:" + rgbMat.height () + " SO:" + Screen.orientation, new Point (5, rgbMat.rows () - 10), Imgproc.FONT_HERSHEY_SIMPLEX, 1.0, new Scalar (255, 255, 255, 255), 2, Imgproc.LINE_AA, false); 377 | 378 | Imgproc.cvtColor(rgbMat, rgbaMat, Imgproc.COLOR_RGB2RGBA); 379 | 380 | OpenCVMatUtils.MatToTexture2D(rgbaMat, texture); 381 | } 382 | 383 | #else // (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR && !DISABLE_ARFOUNDATION_API 384 | 385 | // Update is called once per frame 386 | void Update() 387 | { 388 | if (webCamTextureToMatHelper.IsPlaying() && webCamTextureToMatHelper.DidUpdateThisFrame()) 389 | { 390 | 391 | Mat rgbaMat = webCamTextureToMatHelper.GetMat(); 392 | 393 | Imgproc.cvtColor(rgbaMat, rgbMat, Imgproc.COLOR_RGBA2RGB); 394 | 395 | // detect markers. 396 | Calib3d.undistort(rgbMat, rgbMat, camMatrix, distCoeffs); 397 | arucoDetector.detectMarkers(rgbMat, corners, ids, rejectedCorners); 398 | 399 | // if at least one marker detected 400 | if (ids.total() > 0) 401 | { 402 | // draw markers. 403 | Objdetect.drawDetectedMarkers(rgbMat, corners, ids, new Scalar(0, 255, 0)); 404 | 405 | // estimate pose. 406 | if (applyEstimationPose) 407 | { 408 | EstimatePoseCanonicalMarker(rgbMat); 409 | } 410 | } 411 | 412 | //Imgproc.putText (rgbMat, "W:" + rgbMat.width () + " H:" + rgbMat.height () + " SO:" + Screen.orientation, new Point (5, rgbMat.rows () - 10), Imgproc.FONT_HERSHEY_SIMPLEX, 1.0, new Scalar (255, 255, 255, 255), 2, Imgproc.LINE_AA, false); 413 | 414 | Imgproc.cvtColor(rgbMat, rgbaMat, Imgproc.COLOR_RGB2RGBA); 415 | 416 | OpenCVMatUtils.MatToTexture2D(rgbaMat, texture); 417 | } 418 | } 419 | 420 | #endif // (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR && !DISABLE_ARFOUNDATION_API 421 | 422 | private void EstimatePoseCanonicalMarker(Mat rgbMat) 423 | { 424 | using (MatOfPoint3f objPoints = new MatOfPoint3f( 425 | new Point3(-markerLength / 2f, markerLength / 2f, 0), 426 | new Point3(markerLength / 2f, markerLength / 2f, 0), 427 | new Point3(markerLength / 2f, -markerLength / 2f, 0), 428 | new Point3(-markerLength / 2f, -markerLength / 2f, 0) 429 | )) 430 | { 431 | for (int i = 0; i < ids.total(); i++) 432 | { 433 | using (Mat rvec = new Mat(1, 1, CvType.CV_64FC3)) 434 | using (Mat tvec = new Mat(1, 1, CvType.CV_64FC3)) 435 | using (Mat corner_4x1 = corners[i].reshape(2, 4)) // 1*4*CV_32FC2 => 4*1*CV_32FC2 436 | using (MatOfPoint2f imagePoints = new MatOfPoint2f(corner_4x1)) 437 | { 438 | // Calculate pose for each marker 439 | Calib3d.solvePnP(objPoints, imagePoints, camMatrix, distCoeffs, rvec, tvec); 440 | 441 | // In this example we are processing with RGB color image, so Axis-color correspondences are X: blue, Y: green, Z: red. (Usually X: red, Y: green, Z: blue) 442 | Calib3d.drawFrameAxes(rgbMat, camMatrix, distCoeffs, rvec, tvec, markerLength * 0.5f); 443 | 444 | // This example can display the ARObject on only first detected marker. 445 | if (i == 0) 446 | { 447 | UpdateARObjectTransform(rvec, tvec); 448 | } 449 | } 450 | } 451 | } 452 | } 453 | 454 | private void UpdateARObjectTransform(Mat rvec, Mat tvec) 455 | { 456 | // Convert to unity pose data. 457 | double[] rvecArr = new double[3]; 458 | rvec.get(0, 0, rvecArr); 459 | double[] tvecArr = new double[3]; 460 | tvec.get(0, 0, tvecArr); 461 | PoseData poseData = OpenCVARUtils.ConvertRvecTvecToPoseData(rvecArr, tvecArr); 462 | 463 | // Convert to transform matrix. 464 | ARM = OpenCVARUtils.ConvertPoseDataToMatrix(ref poseData, true); 465 | 466 | // Transform the matrix from camera space to world space using the ARFoundation camera's transform 467 | ARM = xROrigin.Camera.transform.localToWorldMatrix * ARM; 468 | 469 | if (enableLerpFilter) 470 | { 471 | arGameObject.SetMatrix4x4(ARM); 472 | } 473 | else 474 | { 475 | OpenCVARUtils.SetTransformFromMatrix(arGameObject.transform, ref ARM); 476 | } 477 | } 478 | 479 | private void ResetObjectTransform() 480 | { 481 | // reset AR object transform. 482 | Matrix4x4 i = Matrix4x4.identity; 483 | OpenCVARUtils.SetTransformFromMatrix(arGameObject.transform, ref i); 484 | } 485 | 486 | /// 487 | /// Raises the destroy event. 488 | /// 489 | void OnDestroy() 490 | { 491 | #if (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR && !DISABLE_ARFOUNDATION_API 492 | webCamTextureToMatHelper.FrameMatAcquired -= OnFrameMatAcquired; 493 | #endif // (UNITY_IOS || UNITY_ANDROID) && !UNITY_EDITOR && !DISABLE_ARFOUNDATION_API 494 | webCamTextureToMatHelper.Dispose(); 495 | } 496 | 497 | /// 498 | /// Raises the back button click event. 499 | /// 500 | public void OnBackButtonClick() 501 | { 502 | SceneManager.LoadScene("ARFoundationWithOpenCVForUnityExample"); 503 | } 504 | 505 | /// 506 | /// Raises the play button click event. 507 | /// 508 | public void OnPlayButtonClick() 509 | { 510 | webCamTextureToMatHelper.Play(); 511 | } 512 | 513 | /// 514 | /// Raises the pause button click event. 515 | /// 516 | public void OnPauseButtonClick() 517 | { 518 | webCamTextureToMatHelper.Pause(); 519 | } 520 | 521 | /// 522 | /// Raises the stop button click event. 523 | /// 524 | public void OnStopButtonClick() 525 | { 526 | webCamTextureToMatHelper.Stop(); 527 | } 528 | 529 | /// 530 | /// Raises the change camera button click event. 531 | /// 532 | public void OnChangeCameraButtonClick() 533 | { 534 | webCamTextureToMatHelper.RequestedIsFrontFacing = !webCamTextureToMatHelper.RequestedIsFrontFacing; 535 | 536 | // While you can request any of these simultaneously, support for each of these varies greatly among devices. 537 | // Some platforms may not be able to be simultaneously provide all options, or it may depend on other features (e.g., camera facing direction). 538 | if (fpsMonitor != null) 539 | { 540 | fpsMonitor.Toast("If LightEstimation is enabled, the camera facing direction may not be changed depending on the device's capabilities."); 541 | } 542 | } 543 | 544 | /// 545 | /// Raises the dictionary id dropdown value changed event. 546 | /// 547 | public void OnDictionaryIdDropdownValueChanged(int result) 548 | { 549 | if ((int)dictionaryId != result) 550 | { 551 | dictionaryId = (ArUcoDictionary)result; 552 | dictionary = Objdetect.getPredefinedDictionary((int)dictionaryId); 553 | 554 | ResetObjectTransform(); 555 | 556 | if (webCamTextureToMatHelper != null && webCamTextureToMatHelper.IsInitialized()) 557 | webCamTextureToMatHelper.Initialize(); 558 | } 559 | } 560 | 561 | /// 562 | /// Raises the apply estimation P\pose toggle value changed event. 563 | /// 564 | public void OnApplyEstimationPoseToggleValueChanged() 565 | { 566 | applyEstimationPose = applyEstimationPoseToggle.isOn; 567 | } 568 | 569 | /// 570 | /// Raises the enable leap filter toggle value changed event. 571 | /// 572 | public void OnEnableLeapFilterToggleValueChanged() 573 | { 574 | enableLerpFilter = enableLerpFilterToggle.isOn; 575 | } 576 | 577 | /// 578 | /// Raises the change LightEstimation button click event. 579 | /// 580 | public void OnChangeLightEstimationButtonClick() 581 | { 582 | if (webCamTextureToMatHelper != null && webCamTextureToMatHelper.IsInitialized()) 583 | { 584 | webCamTextureToMatHelper.RequestedLightEstimation = (webCamTextureToMatHelper.RequestedLightEstimation == LightEstimation.None) 585 | ? LightEstimation.AmbientColor | LightEstimation.AmbientIntensity 586 | : LightEstimation.None; 587 | } 588 | 589 | // While you can request any of these simultaneously, support for each of these varies greatly among devices. 590 | // Some platforms may not be able to be simultaneously provide all options, or it may depend on other features (e.g., camera facing direction). 591 | if (fpsMonitor != null) 592 | { 593 | fpsMonitor.Toast("If LightEstimation is enabled, the camera facing direction may not be changed depending on the device's capabilities."); 594 | } 595 | } 596 | 597 | public enum ArUcoDictionary 598 | { 599 | DICT_4X4_50 = Objdetect.DICT_4X4_50, 600 | DICT_4X4_100 = Objdetect.DICT_4X4_100, 601 | DICT_4X4_250 = Objdetect.DICT_4X4_250, 602 | DICT_4X4_1000 = Objdetect.DICT_4X4_1000, 603 | DICT_5X5_50 = Objdetect.DICT_5X5_50, 604 | DICT_5X5_100 = Objdetect.DICT_5X5_100, 605 | DICT_5X5_250 = Objdetect.DICT_5X5_250, 606 | DICT_5X5_1000 = Objdetect.DICT_5X5_1000, 607 | DICT_6X6_50 = Objdetect.DICT_6X6_50, 608 | DICT_6X6_100 = Objdetect.DICT_6X6_100, 609 | DICT_6X6_250 = Objdetect.DICT_6X6_250, 610 | DICT_6X6_1000 = Objdetect.DICT_6X6_1000, 611 | DICT_7X7_50 = Objdetect.DICT_7X7_50, 612 | DICT_7X7_100 = Objdetect.DICT_7X7_100, 613 | DICT_7X7_250 = Objdetect.DICT_7X7_250, 614 | DICT_7X7_1000 = Objdetect.DICT_7X7_1000, 615 | DICT_ARUCO_ORIGINAL = Objdetect.DICT_ARUCO_ORIGINAL, 616 | } 617 | } 618 | } 619 | 620 | #endif -------------------------------------------------------------------------------- /Assets/ARFoundationWithOpenCVForUnityExample/ShowLicense.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 10 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} 24 | m_AmbientEquatorColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} 25 | m_AmbientGroundColor: {r: 0.2, g: 0.2, b: 0.2, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 3 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 0} 41 | m_UseRadianceAmbientProbe: 0 42 | --- !u!157 &4 43 | LightmapSettings: 44 | m_ObjectHideFlags: 0 45 | serializedVersion: 13 46 | m_BakeOnSceneLoad: 0 47 | m_GISettings: 48 | serializedVersion: 2 49 | m_BounceScale: 1 50 | m_IndirectOutputScale: 1 51 | m_AlbedoBoost: 1 52 | m_EnvironmentLightingMode: 0 53 | m_EnableBakedLightmaps: 1 54 | m_EnableRealtimeLightmaps: 0 55 | m_LightmapEditorSettings: 56 | serializedVersion: 12 57 | m_Resolution: 1 58 | m_BakeResolution: 50 59 | m_AtlasSize: 1024 60 | m_AO: 0 61 | m_AOMaxDistance: 1 62 | m_CompAOExponent: 0 63 | m_CompAOExponentDirect: 0 64 | m_ExtractAmbientOcclusion: 0 65 | m_Padding: 2 66 | m_LightmapParameters: {fileID: 0} 67 | m_LightmapsBakeMode: 1 68 | m_TextureCompression: 0 69 | m_ReflectionCompression: 2 70 | m_MixedBakeMode: 1 71 | m_BakeBackend: 0 72 | m_PVRSampling: 1 73 | m_PVRDirectSampleCount: 32 74 | m_PVRSampleCount: 500 75 | m_PVRBounces: 2 76 | m_PVREnvironmentSampleCount: 500 77 | m_PVREnvironmentReferencePointCount: 2048 78 | m_PVRFilteringMode: 2 79 | m_PVRDenoiserTypeDirect: 0 80 | m_PVRDenoiserTypeIndirect: 0 81 | m_PVRDenoiserTypeAO: 0 82 | m_PVRFilterTypeDirect: 0 83 | m_PVRFilterTypeIndirect: 0 84 | m_PVRFilterTypeAO: 0 85 | m_PVREnvironmentMIS: 0 86 | m_PVRCulling: 1 87 | m_PVRFilteringGaussRadiusDirect: 1 88 | m_PVRFilteringGaussRadiusIndirect: 5 89 | m_PVRFilteringGaussRadiusAO: 2 90 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 91 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 92 | m_PVRFilteringAtrousPositionSigmaAO: 1 93 | m_ExportTrainingData: 0 94 | m_TrainingDataDestination: TrainingData 95 | m_LightProbeSampleCountMultiplier: 4 96 | m_LightingDataAsset: {fileID: 0} 97 | m_LightingSettings: {fileID: 4890085278179872738, guid: d745c26de9d7a2a47ab2d2e460dcbab9, 98 | type: 2} 99 | --- !u!196 &5 100 | NavMeshSettings: 101 | serializedVersion: 2 102 | m_ObjectHideFlags: 0 103 | m_BuildSettings: 104 | serializedVersion: 3 105 | agentTypeID: 0 106 | agentRadius: 0.5 107 | agentHeight: 2 108 | agentSlope: 45 109 | agentClimb: 0.4 110 | ledgeDropHeight: 0 111 | maxJumpAcrossDistance: 0 112 | minRegionArea: 2 113 | manualCellSize: 0 114 | cellSize: 0.16666666 115 | manualTileSize: 0 116 | tileSize: 256 117 | buildHeightMesh: 0 118 | maxJobWorkers: 0 119 | preserveTilesOutsideBounds: 0 120 | debug: 121 | m_Flags: 0 122 | m_NavMeshData: {fileID: 0} 123 | --- !u!1 &38156656 124 | GameObject: 125 | m_ObjectHideFlags: 0 126 | m_CorrespondingSourceObject: {fileID: 0} 127 | m_PrefabInstance: {fileID: 0} 128 | m_PrefabAsset: {fileID: 0} 129 | serializedVersion: 6 130 | m_Component: 131 | - component: {fileID: 38156657} 132 | - component: {fileID: 38156661} 133 | - component: {fileID: 38156660} 134 | - component: {fileID: 38156659} 135 | - component: {fileID: 38156658} 136 | m_Layer: 5 137 | m_Name: ScrollView 138 | m_TagString: Untagged 139 | m_Icon: {fileID: 0} 140 | m_NavMeshLayer: 0 141 | m_StaticEditorFlags: 0 142 | m_IsActive: 1 143 | --- !u!224 &38156657 144 | RectTransform: 145 | m_ObjectHideFlags: 0 146 | m_CorrespondingSourceObject: {fileID: 0} 147 | m_PrefabInstance: {fileID: 0} 148 | m_PrefabAsset: {fileID: 0} 149 | m_GameObject: {fileID: 38156656} 150 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 151 | m_LocalPosition: {x: 0, y: 0, z: 0} 152 | m_LocalScale: {x: 1, y: 1, z: 1} 153 | m_ConstrainProportionsScale: 0 154 | m_Children: 155 | - {fileID: 1086899404} 156 | m_Father: {fileID: 1646839690} 157 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 158 | m_AnchorMin: {x: 0, y: 0} 159 | m_AnchorMax: {x: 1, y: 1} 160 | m_AnchoredPosition: {x: -10, y: 0} 161 | m_SizeDelta: {x: -20, y: 0} 162 | m_Pivot: {x: 0.5, y: 1} 163 | --- !u!114 &38156658 164 | MonoBehaviour: 165 | m_ObjectHideFlags: 0 166 | m_CorrespondingSourceObject: {fileID: 0} 167 | m_PrefabInstance: {fileID: 0} 168 | m_PrefabAsset: {fileID: 0} 169 | m_GameObject: {fileID: 38156656} 170 | m_Enabled: 1 171 | m_EditorHideFlags: 0 172 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 173 | m_Name: 174 | m_EditorClassIdentifier: 175 | m_Material: {fileID: 0} 176 | m_Color: {r: 1, g: 1, b: 1, a: 1} 177 | m_RaycastTarget: 1 178 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 179 | m_Maskable: 1 180 | m_OnCullStateChanged: 181 | m_PersistentCalls: 182 | m_Calls: [] 183 | m_Sprite: {fileID: 0} 184 | m_Type: 0 185 | m_PreserveAspect: 0 186 | m_FillCenter: 1 187 | m_FillMethod: 4 188 | m_FillAmount: 1 189 | m_FillClockwise: 1 190 | m_FillOrigin: 0 191 | m_UseSpriteMesh: 0 192 | m_PixelsPerUnitMultiplier: 1 193 | --- !u!222 &38156659 194 | CanvasRenderer: 195 | m_ObjectHideFlags: 0 196 | m_CorrespondingSourceObject: {fileID: 0} 197 | m_PrefabInstance: {fileID: 0} 198 | m_PrefabAsset: {fileID: 0} 199 | m_GameObject: {fileID: 38156656} 200 | m_CullTransparentMesh: 0 201 | --- !u!114 &38156660 202 | MonoBehaviour: 203 | m_ObjectHideFlags: 0 204 | m_CorrespondingSourceObject: {fileID: 0} 205 | m_PrefabInstance: {fileID: 0} 206 | m_PrefabAsset: {fileID: 0} 207 | m_GameObject: {fileID: 38156656} 208 | m_Enabled: 1 209 | m_EditorHideFlags: 0 210 | m_Script: {fileID: 11500000, guid: 31a19414c41e5ae4aae2af33fee712f6, type: 3} 211 | m_Name: 212 | m_EditorClassIdentifier: 213 | m_ShowMaskGraphic: 0 214 | --- !u!114 &38156661 215 | MonoBehaviour: 216 | m_ObjectHideFlags: 0 217 | m_CorrespondingSourceObject: {fileID: 0} 218 | m_PrefabInstance: {fileID: 0} 219 | m_PrefabAsset: {fileID: 0} 220 | m_GameObject: {fileID: 38156656} 221 | m_Enabled: 1 222 | m_EditorHideFlags: 0 223 | m_Script: {fileID: 11500000, guid: 1aa08ab6e0800fa44ae55d278d1423e3, type: 3} 224 | m_Name: 225 | m_EditorClassIdentifier: 226 | m_Content: {fileID: 1086899404} 227 | m_Horizontal: 0 228 | m_Vertical: 1 229 | m_MovementType: 1 230 | m_Elasticity: 0.1 231 | m_Inertia: 1 232 | m_DecelerationRate: 0.135 233 | m_ScrollSensitivity: 1 234 | m_Viewport: {fileID: 0} 235 | m_HorizontalScrollbar: {fileID: 0} 236 | m_VerticalScrollbar: {fileID: 155392644} 237 | m_HorizontalScrollbarVisibility: 0 238 | m_VerticalScrollbarVisibility: 0 239 | m_HorizontalScrollbarSpacing: 0 240 | m_VerticalScrollbarSpacing: 0 241 | m_OnValueChanged: 242 | m_PersistentCalls: 243 | m_Calls: [] 244 | --- !u!1 &155392642 245 | GameObject: 246 | m_ObjectHideFlags: 0 247 | m_CorrespondingSourceObject: {fileID: 0} 248 | m_PrefabInstance: {fileID: 0} 249 | m_PrefabAsset: {fileID: 0} 250 | serializedVersion: 6 251 | m_Component: 252 | - component: {fileID: 155392643} 253 | - component: {fileID: 155392646} 254 | - component: {fileID: 155392645} 255 | - component: {fileID: 155392644} 256 | m_Layer: 5 257 | m_Name: Scrollbar 258 | m_TagString: Untagged 259 | m_Icon: {fileID: 0} 260 | m_NavMeshLayer: 0 261 | m_StaticEditorFlags: 0 262 | m_IsActive: 1 263 | --- !u!224 &155392643 264 | RectTransform: 265 | m_ObjectHideFlags: 0 266 | m_CorrespondingSourceObject: {fileID: 0} 267 | m_PrefabInstance: {fileID: 0} 268 | m_PrefabAsset: {fileID: 0} 269 | m_GameObject: {fileID: 155392642} 270 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 271 | m_LocalPosition: {x: 0, y: 0, z: 0} 272 | m_LocalScale: {x: 1, y: 1, z: 1} 273 | m_ConstrainProportionsScale: 0 274 | m_Children: 275 | - {fileID: 823457167} 276 | m_Father: {fileID: 1646839690} 277 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 278 | m_AnchorMin: {x: 1, y: 0} 279 | m_AnchorMax: {x: 1, y: 1} 280 | m_AnchoredPosition: {x: -5, y: 0} 281 | m_SizeDelta: {x: 20, y: 0} 282 | m_Pivot: {x: 0.5, y: 0.5} 283 | --- !u!114 &155392644 284 | MonoBehaviour: 285 | m_ObjectHideFlags: 0 286 | m_CorrespondingSourceObject: {fileID: 0} 287 | m_PrefabInstance: {fileID: 0} 288 | m_PrefabAsset: {fileID: 0} 289 | m_GameObject: {fileID: 155392642} 290 | m_Enabled: 1 291 | m_EditorHideFlags: 0 292 | m_Script: {fileID: 11500000, guid: 2a4db7a114972834c8e4117be1d82ba3, type: 3} 293 | m_Name: 294 | m_EditorClassIdentifier: 295 | m_Navigation: 296 | m_Mode: 3 297 | m_WrapAround: 0 298 | m_SelectOnUp: {fileID: 0} 299 | m_SelectOnDown: {fileID: 0} 300 | m_SelectOnLeft: {fileID: 0} 301 | m_SelectOnRight: {fileID: 0} 302 | m_Transition: 1 303 | m_Colors: 304 | m_NormalColor: {r: 1, g: 1, b: 1, a: 1} 305 | m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} 306 | m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} 307 | m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} 308 | m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} 309 | m_ColorMultiplier: 1 310 | m_FadeDuration: 0.1 311 | m_SpriteState: 312 | m_HighlightedSprite: {fileID: 0} 313 | m_PressedSprite: {fileID: 0} 314 | m_SelectedSprite: {fileID: 0} 315 | m_DisabledSprite: {fileID: 0} 316 | m_AnimationTriggers: 317 | m_NormalTrigger: Normal 318 | m_HighlightedTrigger: Highlighted 319 | m_PressedTrigger: Pressed 320 | m_SelectedTrigger: Highlighted 321 | m_DisabledTrigger: Disabled 322 | m_Interactable: 1 323 | m_TargetGraphic: {fileID: 1011219729} 324 | m_HandleRect: {fileID: 1011219728} 325 | m_Direction: 2 326 | m_Value: 0.9999999 327 | m_Size: 0.40124997 328 | m_NumberOfSteps: 0 329 | m_OnValueChanged: 330 | m_PersistentCalls: 331 | m_Calls: [] 332 | --- !u!114 &155392645 333 | MonoBehaviour: 334 | m_ObjectHideFlags: 0 335 | m_CorrespondingSourceObject: {fileID: 0} 336 | m_PrefabInstance: {fileID: 0} 337 | m_PrefabAsset: {fileID: 0} 338 | m_GameObject: {fileID: 155392642} 339 | m_Enabled: 1 340 | m_EditorHideFlags: 0 341 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 342 | m_Name: 343 | m_EditorClassIdentifier: 344 | m_Material: {fileID: 0} 345 | m_Color: {r: 1, g: 1, b: 1, a: 1} 346 | m_RaycastTarget: 1 347 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 348 | m_Maskable: 1 349 | m_OnCullStateChanged: 350 | m_PersistentCalls: 351 | m_Calls: [] 352 | m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} 353 | m_Type: 1 354 | m_PreserveAspect: 0 355 | m_FillCenter: 1 356 | m_FillMethod: 4 357 | m_FillAmount: 1 358 | m_FillClockwise: 1 359 | m_FillOrigin: 0 360 | m_UseSpriteMesh: 0 361 | m_PixelsPerUnitMultiplier: 1 362 | --- !u!222 &155392646 363 | CanvasRenderer: 364 | m_ObjectHideFlags: 0 365 | m_CorrespondingSourceObject: {fileID: 0} 366 | m_PrefabInstance: {fileID: 0} 367 | m_PrefabAsset: {fileID: 0} 368 | m_GameObject: {fileID: 155392642} 369 | m_CullTransparentMesh: 0 370 | --- !u!1 &316492814 371 | GameObject: 372 | m_ObjectHideFlags: 0 373 | m_CorrespondingSourceObject: {fileID: 0} 374 | m_PrefabInstance: {fileID: 0} 375 | m_PrefabAsset: {fileID: 0} 376 | serializedVersion: 6 377 | m_Component: 378 | - component: {fileID: 316492818} 379 | - component: {fileID: 316492817} 380 | - component: {fileID: 316492819} 381 | m_Layer: 0 382 | m_Name: EventSystem 383 | m_TagString: Untagged 384 | m_Icon: {fileID: 0} 385 | m_NavMeshLayer: 0 386 | m_StaticEditorFlags: 0 387 | m_IsActive: 1 388 | --- !u!114 &316492817 389 | MonoBehaviour: 390 | m_ObjectHideFlags: 0 391 | m_CorrespondingSourceObject: {fileID: 0} 392 | m_PrefabInstance: {fileID: 0} 393 | m_PrefabAsset: {fileID: 0} 394 | m_GameObject: {fileID: 316492814} 395 | m_Enabled: 1 396 | m_EditorHideFlags: 0 397 | m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} 398 | m_Name: 399 | m_EditorClassIdentifier: 400 | m_FirstSelected: {fileID: 0} 401 | m_sendNavigationEvents: 1 402 | m_DragThreshold: 5 403 | --- !u!4 &316492818 404 | Transform: 405 | m_ObjectHideFlags: 0 406 | m_CorrespondingSourceObject: {fileID: 0} 407 | m_PrefabInstance: {fileID: 0} 408 | m_PrefabAsset: {fileID: 0} 409 | m_GameObject: {fileID: 316492814} 410 | serializedVersion: 2 411 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 412 | m_LocalPosition: {x: 0, y: 0, z: 0} 413 | m_LocalScale: {x: 1, y: 1, z: 1} 414 | m_ConstrainProportionsScale: 0 415 | m_Children: [] 416 | m_Father: {fileID: 0} 417 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 418 | --- !u!114 &316492819 419 | MonoBehaviour: 420 | m_ObjectHideFlags: 0 421 | m_CorrespondingSourceObject: {fileID: 0} 422 | m_PrefabInstance: {fileID: 0} 423 | m_PrefabAsset: {fileID: 0} 424 | m_GameObject: {fileID: 316492814} 425 | m_Enabled: 1 426 | m_EditorHideFlags: 0 427 | m_Script: {fileID: 11500000, guid: 01614664b831546d2ae94a42149d80ac, type: 3} 428 | m_Name: 429 | m_EditorClassIdentifier: 430 | m_SendPointerHoverToParent: 1 431 | m_MoveRepeatDelay: 0.5 432 | m_MoveRepeatRate: 0.1 433 | m_XRTrackingOrigin: {fileID: 0} 434 | m_ActionsAsset: {fileID: -944628639613478452, guid: ca9f5fa95ffab41fb9a615ab714db018, 435 | type: 3} 436 | m_PointAction: {fileID: -1654692200621890270, guid: ca9f5fa95ffab41fb9a615ab714db018, 437 | type: 3} 438 | m_MoveAction: {fileID: -8784545083839296357, guid: ca9f5fa95ffab41fb9a615ab714db018, 439 | type: 3} 440 | m_SubmitAction: {fileID: 392368643174621059, guid: ca9f5fa95ffab41fb9a615ab714db018, 441 | type: 3} 442 | m_CancelAction: {fileID: 7727032971491509709, guid: ca9f5fa95ffab41fb9a615ab714db018, 443 | type: 3} 444 | m_LeftClickAction: {fileID: 3001919216989983466, guid: ca9f5fa95ffab41fb9a615ab714db018, 445 | type: 3} 446 | m_MiddleClickAction: {fileID: -2185481485913320682, guid: ca9f5fa95ffab41fb9a615ab714db018, 447 | type: 3} 448 | m_RightClickAction: {fileID: -4090225696740746782, guid: ca9f5fa95ffab41fb9a615ab714db018, 449 | type: 3} 450 | m_ScrollWheelAction: {fileID: 6240969308177333660, guid: ca9f5fa95ffab41fb9a615ab714db018, 451 | type: 3} 452 | m_TrackedDevicePositionAction: {fileID: 6564999863303420839, guid: ca9f5fa95ffab41fb9a615ab714db018, 453 | type: 3} 454 | m_TrackedDeviceOrientationAction: {fileID: 7970375526676320489, guid: ca9f5fa95ffab41fb9a615ab714db018, 455 | type: 3} 456 | m_DeselectOnBackgroundClick: 1 457 | m_PointerBehavior: 0 458 | m_CursorLockBehavior: 0 459 | m_ScrollDeltaPerTick: 6 460 | --- !u!1 &432530561 461 | GameObject: 462 | m_ObjectHideFlags: 0 463 | m_CorrespondingSourceObject: {fileID: 0} 464 | m_PrefabInstance: {fileID: 0} 465 | m_PrefabAsset: {fileID: 0} 466 | serializedVersion: 6 467 | m_Component: 468 | - component: {fileID: 432530562} 469 | - component: {fileID: 432530565} 470 | - component: {fileID: 432530564} 471 | - component: {fileID: 432530563} 472 | m_Layer: 5 473 | m_Name: BackButton 474 | m_TagString: Untagged 475 | m_Icon: {fileID: 0} 476 | m_NavMeshLayer: 0 477 | m_StaticEditorFlags: 0 478 | m_IsActive: 1 479 | --- !u!224 &432530562 480 | RectTransform: 481 | m_ObjectHideFlags: 0 482 | m_CorrespondingSourceObject: {fileID: 0} 483 | m_PrefabInstance: {fileID: 0} 484 | m_PrefabAsset: {fileID: 0} 485 | m_GameObject: {fileID: 432530561} 486 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 487 | m_LocalPosition: {x: 0, y: 0, z: 0} 488 | m_LocalScale: {x: 1, y: 1, z: 1} 489 | m_ConstrainProportionsScale: 0 490 | m_Children: 491 | - {fileID: 531596783} 492 | m_Father: {fileID: 1502237571} 493 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 494 | m_AnchorMin: {x: 0, y: 1} 495 | m_AnchorMax: {x: 0, y: 1} 496 | m_AnchoredPosition: {x: 10, y: -10.0000305} 497 | m_SizeDelta: {x: 160, y: 40} 498 | m_Pivot: {x: 0, y: 1} 499 | --- !u!114 &432530563 500 | MonoBehaviour: 501 | m_ObjectHideFlags: 0 502 | m_CorrespondingSourceObject: {fileID: 0} 503 | m_PrefabInstance: {fileID: 0} 504 | m_PrefabAsset: {fileID: 0} 505 | m_GameObject: {fileID: 432530561} 506 | m_Enabled: 1 507 | m_EditorHideFlags: 0 508 | m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} 509 | m_Name: 510 | m_EditorClassIdentifier: 511 | m_Navigation: 512 | m_Mode: 3 513 | m_WrapAround: 0 514 | m_SelectOnUp: {fileID: 0} 515 | m_SelectOnDown: {fileID: 0} 516 | m_SelectOnLeft: {fileID: 0} 517 | m_SelectOnRight: {fileID: 0} 518 | m_Transition: 1 519 | m_Colors: 520 | m_NormalColor: {r: 1, g: 1, b: 1, a: 1} 521 | m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} 522 | m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} 523 | m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} 524 | m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} 525 | m_ColorMultiplier: 1 526 | m_FadeDuration: 0.1 527 | m_SpriteState: 528 | m_HighlightedSprite: {fileID: 0} 529 | m_PressedSprite: {fileID: 0} 530 | m_SelectedSprite: {fileID: 0} 531 | m_DisabledSprite: {fileID: 0} 532 | m_AnimationTriggers: 533 | m_NormalTrigger: Normal 534 | m_HighlightedTrigger: Highlighted 535 | m_PressedTrigger: Pressed 536 | m_SelectedTrigger: Highlighted 537 | m_DisabledTrigger: Disabled 538 | m_Interactable: 1 539 | m_TargetGraphic: {fileID: 432530564} 540 | m_OnClick: 541 | m_PersistentCalls: 542 | m_Calls: 543 | - m_Target: {fileID: 1787239747} 544 | m_TargetAssemblyTypeName: 545 | m_MethodName: OnBackButtonClick 546 | m_Mode: 1 547 | m_Arguments: 548 | m_ObjectArgument: {fileID: 0} 549 | m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine 550 | m_IntArgument: 0 551 | m_FloatArgument: 0 552 | m_StringArgument: 553 | m_BoolArgument: 0 554 | m_CallState: 2 555 | --- !u!114 &432530564 556 | MonoBehaviour: 557 | m_ObjectHideFlags: 0 558 | m_CorrespondingSourceObject: {fileID: 0} 559 | m_PrefabInstance: {fileID: 0} 560 | m_PrefabAsset: {fileID: 0} 561 | m_GameObject: {fileID: 432530561} 562 | m_Enabled: 1 563 | m_EditorHideFlags: 0 564 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 565 | m_Name: 566 | m_EditorClassIdentifier: 567 | m_Material: {fileID: 0} 568 | m_Color: {r: 1, g: 1, b: 1, a: 1} 569 | m_RaycastTarget: 1 570 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 571 | m_Maskable: 1 572 | m_OnCullStateChanged: 573 | m_PersistentCalls: 574 | m_Calls: [] 575 | m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} 576 | m_Type: 1 577 | m_PreserveAspect: 0 578 | m_FillCenter: 1 579 | m_FillMethod: 4 580 | m_FillAmount: 1 581 | m_FillClockwise: 1 582 | m_FillOrigin: 0 583 | m_UseSpriteMesh: 0 584 | m_PixelsPerUnitMultiplier: 1 585 | --- !u!222 &432530565 586 | CanvasRenderer: 587 | m_ObjectHideFlags: 0 588 | m_CorrespondingSourceObject: {fileID: 0} 589 | m_PrefabInstance: {fileID: 0} 590 | m_PrefabAsset: {fileID: 0} 591 | m_GameObject: {fileID: 432530561} 592 | m_CullTransparentMesh: 0 593 | --- !u!1 &531596782 594 | GameObject: 595 | m_ObjectHideFlags: 0 596 | m_CorrespondingSourceObject: {fileID: 0} 597 | m_PrefabInstance: {fileID: 0} 598 | m_PrefabAsset: {fileID: 0} 599 | serializedVersion: 6 600 | m_Component: 601 | - component: {fileID: 531596783} 602 | - component: {fileID: 531596785} 603 | - component: {fileID: 531596784} 604 | m_Layer: 5 605 | m_Name: Text 606 | m_TagString: Untagged 607 | m_Icon: {fileID: 0} 608 | m_NavMeshLayer: 0 609 | m_StaticEditorFlags: 0 610 | m_IsActive: 1 611 | --- !u!224 &531596783 612 | RectTransform: 613 | m_ObjectHideFlags: 0 614 | m_CorrespondingSourceObject: {fileID: 0} 615 | m_PrefabInstance: {fileID: 0} 616 | m_PrefabAsset: {fileID: 0} 617 | m_GameObject: {fileID: 531596782} 618 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 619 | m_LocalPosition: {x: 0, y: 0, z: 0} 620 | m_LocalScale: {x: 1, y: 1, z: 1} 621 | m_ConstrainProportionsScale: 0 622 | m_Children: [] 623 | m_Father: {fileID: 432530562} 624 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 625 | m_AnchorMin: {x: 0, y: 0} 626 | m_AnchorMax: {x: 1, y: 1} 627 | m_AnchoredPosition: {x: 0, y: 0} 628 | m_SizeDelta: {x: 0, y: 0} 629 | m_Pivot: {x: 0.5, y: 0.5} 630 | --- !u!114 &531596784 631 | MonoBehaviour: 632 | m_ObjectHideFlags: 0 633 | m_CorrespondingSourceObject: {fileID: 0} 634 | m_PrefabInstance: {fileID: 0} 635 | m_PrefabAsset: {fileID: 0} 636 | m_GameObject: {fileID: 531596782} 637 | m_Enabled: 1 638 | m_EditorHideFlags: 0 639 | m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} 640 | m_Name: 641 | m_EditorClassIdentifier: 642 | m_Material: {fileID: 0} 643 | m_Color: {r: 0.196, g: 0.196, b: 0.196, a: 1} 644 | m_RaycastTarget: 1 645 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 646 | m_Maskable: 1 647 | m_OnCullStateChanged: 648 | m_PersistentCalls: 649 | m_Calls: [] 650 | m_FontData: 651 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 652 | m_FontSize: 14 653 | m_FontStyle: 0 654 | m_BestFit: 0 655 | m_MinSize: 10 656 | m_MaxSize: 40 657 | m_Alignment: 4 658 | m_AlignByGeometry: 0 659 | m_RichText: 1 660 | m_HorizontalOverflow: 0 661 | m_VerticalOverflow: 0 662 | m_LineSpacing: 1 663 | m_Text: Back 664 | --- !u!222 &531596785 665 | CanvasRenderer: 666 | m_ObjectHideFlags: 0 667 | m_CorrespondingSourceObject: {fileID: 0} 668 | m_PrefabInstance: {fileID: 0} 669 | m_PrefabAsset: {fileID: 0} 670 | m_GameObject: {fileID: 531596782} 671 | m_CullTransparentMesh: 0 672 | --- !u!1 &823457166 673 | GameObject: 674 | m_ObjectHideFlags: 0 675 | m_CorrespondingSourceObject: {fileID: 0} 676 | m_PrefabInstance: {fileID: 0} 677 | m_PrefabAsset: {fileID: 0} 678 | serializedVersion: 6 679 | m_Component: 680 | - component: {fileID: 823457167} 681 | m_Layer: 5 682 | m_Name: Sliding Area 683 | m_TagString: Untagged 684 | m_Icon: {fileID: 0} 685 | m_NavMeshLayer: 0 686 | m_StaticEditorFlags: 0 687 | m_IsActive: 1 688 | --- !u!224 &823457167 689 | RectTransform: 690 | m_ObjectHideFlags: 0 691 | m_CorrespondingSourceObject: {fileID: 0} 692 | m_PrefabInstance: {fileID: 0} 693 | m_PrefabAsset: {fileID: 0} 694 | m_GameObject: {fileID: 823457166} 695 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 696 | m_LocalPosition: {x: 0, y: 0, z: 0} 697 | m_LocalScale: {x: 1, y: 1, z: 1} 698 | m_ConstrainProportionsScale: 0 699 | m_Children: 700 | - {fileID: 1011219728} 701 | m_Father: {fileID: 155392643} 702 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 703 | m_AnchorMin: {x: 0, y: 0} 704 | m_AnchorMax: {x: 1, y: 1} 705 | m_AnchoredPosition: {x: 0, y: 0} 706 | m_SizeDelta: {x: -20, y: -20} 707 | m_Pivot: {x: 0.5, y: 0.5} 708 | --- !u!1 &1011219727 709 | GameObject: 710 | m_ObjectHideFlags: 0 711 | m_CorrespondingSourceObject: {fileID: 0} 712 | m_PrefabInstance: {fileID: 0} 713 | m_PrefabAsset: {fileID: 0} 714 | serializedVersion: 6 715 | m_Component: 716 | - component: {fileID: 1011219728} 717 | - component: {fileID: 1011219730} 718 | - component: {fileID: 1011219729} 719 | m_Layer: 5 720 | m_Name: Handle 721 | m_TagString: Untagged 722 | m_Icon: {fileID: 0} 723 | m_NavMeshLayer: 0 724 | m_StaticEditorFlags: 0 725 | m_IsActive: 1 726 | --- !u!224 &1011219728 727 | RectTransform: 728 | m_ObjectHideFlags: 0 729 | m_CorrespondingSourceObject: {fileID: 0} 730 | m_PrefabInstance: {fileID: 0} 731 | m_PrefabAsset: {fileID: 0} 732 | m_GameObject: {fileID: 1011219727} 733 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 734 | m_LocalPosition: {x: 0, y: 0, z: 0} 735 | m_LocalScale: {x: 1, y: 1, z: 1} 736 | m_ConstrainProportionsScale: 0 737 | m_Children: [] 738 | m_Father: {fileID: 823457167} 739 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 740 | m_AnchorMin: {x: 0, y: 0} 741 | m_AnchorMax: {x: 0, y: 0} 742 | m_AnchoredPosition: {x: 0, y: 0} 743 | m_SizeDelta: {x: 20, y: 20} 744 | m_Pivot: {x: 0.5, y: 0.5} 745 | --- !u!114 &1011219729 746 | MonoBehaviour: 747 | m_ObjectHideFlags: 0 748 | m_CorrespondingSourceObject: {fileID: 0} 749 | m_PrefabInstance: {fileID: 0} 750 | m_PrefabAsset: {fileID: 0} 751 | m_GameObject: {fileID: 1011219727} 752 | m_Enabled: 1 753 | m_EditorHideFlags: 0 754 | m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} 755 | m_Name: 756 | m_EditorClassIdentifier: 757 | m_Material: {fileID: 0} 758 | m_Color: {r: 1, g: 1, b: 1, a: 1} 759 | m_RaycastTarget: 1 760 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 761 | m_Maskable: 1 762 | m_OnCullStateChanged: 763 | m_PersistentCalls: 764 | m_Calls: [] 765 | m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0} 766 | m_Type: 1 767 | m_PreserveAspect: 0 768 | m_FillCenter: 1 769 | m_FillMethod: 4 770 | m_FillAmount: 1 771 | m_FillClockwise: 1 772 | m_FillOrigin: 0 773 | m_UseSpriteMesh: 0 774 | m_PixelsPerUnitMultiplier: 1 775 | --- !u!222 &1011219730 776 | CanvasRenderer: 777 | m_ObjectHideFlags: 0 778 | m_CorrespondingSourceObject: {fileID: 0} 779 | m_PrefabInstance: {fileID: 0} 780 | m_PrefabAsset: {fileID: 0} 781 | m_GameObject: {fileID: 1011219727} 782 | m_CullTransparentMesh: 0 783 | --- !u!1 &1086899403 784 | GameObject: 785 | m_ObjectHideFlags: 0 786 | m_CorrespondingSourceObject: {fileID: 0} 787 | m_PrefabInstance: {fileID: 0} 788 | m_PrefabAsset: {fileID: 0} 789 | serializedVersion: 6 790 | m_Component: 791 | - component: {fileID: 1086899404} 792 | - component: {fileID: 1086899406} 793 | - component: {fileID: 1086899405} 794 | - component: {fileID: 1086899407} 795 | m_Layer: 5 796 | m_Name: Text 797 | m_TagString: Untagged 798 | m_Icon: {fileID: 0} 799 | m_NavMeshLayer: 0 800 | m_StaticEditorFlags: 0 801 | m_IsActive: 1 802 | --- !u!224 &1086899404 803 | RectTransform: 804 | m_ObjectHideFlags: 0 805 | m_CorrespondingSourceObject: {fileID: 0} 806 | m_PrefabInstance: {fileID: 0} 807 | m_PrefabAsset: {fileID: 0} 808 | m_GameObject: {fileID: 1086899403} 809 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 810 | m_LocalPosition: {x: 0, y: 0, z: 0} 811 | m_LocalScale: {x: 1, y: 1, z: 1} 812 | m_ConstrainProportionsScale: 0 813 | m_Children: [] 814 | m_Father: {fileID: 38156657} 815 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 816 | m_AnchorMin: {x: 0, y: 0} 817 | m_AnchorMax: {x: 1, y: 1} 818 | m_AnchoredPosition: {x: 0, y: 0.000061035156} 819 | m_SizeDelta: {x: 0, y: 0} 820 | m_Pivot: {x: 0.5, y: 1} 821 | --- !u!114 &1086899405 822 | MonoBehaviour: 823 | m_ObjectHideFlags: 0 824 | m_CorrespondingSourceObject: {fileID: 0} 825 | m_PrefabInstance: {fileID: 0} 826 | m_PrefabAsset: {fileID: 0} 827 | m_GameObject: {fileID: 1086899403} 828 | m_Enabled: 1 829 | m_EditorHideFlags: 0 830 | m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} 831 | m_Name: 832 | m_EditorClassIdentifier: 833 | m_Material: {fileID: 0} 834 | m_Color: {r: 1, g: 1, b: 1, a: 1} 835 | m_RaycastTarget: 1 836 | m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} 837 | m_Maskable: 1 838 | m_OnCullStateChanged: 839 | m_PersistentCalls: 840 | m_Calls: [] 841 | m_FontData: 842 | m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} 843 | m_FontSize: 20 844 | m_FontStyle: 0 845 | m_BestFit: 0 846 | m_MinSize: 10 847 | m_MaxSize: 40 848 | m_Alignment: 0 849 | m_AlignByGeometry: 0 850 | m_RichText: 1 851 | m_HorizontalOverflow: 0 852 | m_VerticalOverflow: 0 853 | m_LineSpacing: 1 854 | m_Text: "IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.\r\n\r\nBy 855 | downloading, copying, installing or using the software you agree to this license.\r\nIf 856 | you do not agree to this license, do not download, install,\r\n copy or use the 857 | software.\r\n\r\n\r\n License Agreement\r\n 858 | For Open Source Computer Vision Library\r\n\r\nCopyright (C) 2000-2008, Intel 859 | Corporation, all rights reserved.\r\nCopyright (C) 2008-2011, Willow Garage Inc., 860 | all rights reserved.\r\nThird party copyrights are property of their respective 861 | owners.\r\n\r\nRedistribution and use in source and binary forms, with or without 862 | modification,\r\nare permitted provided that the following conditions are met:\r\n\r\n 863 | * Redistributions of source code must retain the above copyright notice,\r\n 864 | this list of conditions and the following disclaimer.\r\n\r\n * Redistributions 865 | in binary form must reproduce the above copyright notice,\r\n this list of 866 | conditions and the following disclaimer in the documentation\r\n and/or other 867 | materials provided with the distribution.\r\n\r\n * The name of the copyright 868 | holders may not be used to endorse or promote products\r\n derived from this 869 | software without specific prior written permission.\r\n\r\nThis software is provided 870 | by the copyright holders and contributors \"as is\" and\r\nany express or implied 871 | warranties, including, but not limited to, the implied\r\nwarranties of merchantability 872 | and fitness for a particular purpose are disclaimed.\r\nIn no event shall the 873 | Intel Corporation or contributors be liable for any direct,\r\nindirect, incidental, 874 | special, exemplary, or consequential damages\r\n(including, but not limited to, 875 | procurement of substitute goods or services;\r\nloss of use, data, or profits; 876 | or business interruption) however caused\r\nand on any theory of liability, whether 877 | in contract, strict liability,\r\nor tort (including negligence or otherwise) 878 | arising in any way out of\r\nthe use of this software, even if advised of the 879 | possibility of such damage.\r\n" 880 | --- !u!222 &1086899406 881 | CanvasRenderer: 882 | m_ObjectHideFlags: 0 883 | m_CorrespondingSourceObject: {fileID: 0} 884 | m_PrefabInstance: {fileID: 0} 885 | m_PrefabAsset: {fileID: 0} 886 | m_GameObject: {fileID: 1086899403} 887 | m_CullTransparentMesh: 0 888 | --- !u!114 &1086899407 889 | MonoBehaviour: 890 | m_ObjectHideFlags: 0 891 | m_CorrespondingSourceObject: {fileID: 0} 892 | m_PrefabInstance: {fileID: 0} 893 | m_PrefabAsset: {fileID: 0} 894 | m_GameObject: {fileID: 1086899403} 895 | m_Enabled: 1 896 | m_EditorHideFlags: 0 897 | m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} 898 | m_Name: 899 | m_EditorClassIdentifier: 900 | m_HorizontalFit: 0 901 | m_VerticalFit: 2 902 | --- !u!1 &1502237567 903 | GameObject: 904 | m_ObjectHideFlags: 0 905 | m_CorrespondingSourceObject: {fileID: 0} 906 | m_PrefabInstance: {fileID: 0} 907 | m_PrefabAsset: {fileID: 0} 908 | serializedVersion: 6 909 | m_Component: 910 | - component: {fileID: 1502237571} 911 | - component: {fileID: 1502237570} 912 | - component: {fileID: 1502237569} 913 | - component: {fileID: 1502237568} 914 | m_Layer: 5 915 | m_Name: Canvas 916 | m_TagString: Untagged 917 | m_Icon: {fileID: 0} 918 | m_NavMeshLayer: 0 919 | m_StaticEditorFlags: 0 920 | m_IsActive: 1 921 | --- !u!114 &1502237568 922 | MonoBehaviour: 923 | m_ObjectHideFlags: 0 924 | m_CorrespondingSourceObject: {fileID: 0} 925 | m_PrefabInstance: {fileID: 0} 926 | m_PrefabAsset: {fileID: 0} 927 | m_GameObject: {fileID: 1502237567} 928 | m_Enabled: 1 929 | m_EditorHideFlags: 0 930 | m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} 931 | m_Name: 932 | m_EditorClassIdentifier: 933 | m_IgnoreReversedGraphics: 1 934 | m_BlockingObjects: 0 935 | m_BlockingMask: 936 | serializedVersion: 2 937 | m_Bits: 4294967295 938 | --- !u!114 &1502237569 939 | MonoBehaviour: 940 | m_ObjectHideFlags: 0 941 | m_CorrespondingSourceObject: {fileID: 0} 942 | m_PrefabInstance: {fileID: 0} 943 | m_PrefabAsset: {fileID: 0} 944 | m_GameObject: {fileID: 1502237567} 945 | m_Enabled: 1 946 | m_EditorHideFlags: 0 947 | m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} 948 | m_Name: 949 | m_EditorClassIdentifier: 950 | m_UiScaleMode: 1 951 | m_ReferencePixelsPerUnit: 100 952 | m_ScaleFactor: 1 953 | m_ReferenceResolution: {x: 800, y: 600} 954 | m_ScreenMatchMode: 0 955 | m_MatchWidthOrHeight: 0 956 | m_PhysicalUnit: 3 957 | m_FallbackScreenDPI: 96 958 | m_DefaultSpriteDPI: 96 959 | m_DynamicPixelsPerUnit: 1 960 | m_PresetInfoIsWorld: 0 961 | --- !u!223 &1502237570 962 | Canvas: 963 | m_ObjectHideFlags: 0 964 | m_CorrespondingSourceObject: {fileID: 0} 965 | m_PrefabInstance: {fileID: 0} 966 | m_PrefabAsset: {fileID: 0} 967 | m_GameObject: {fileID: 1502237567} 968 | m_Enabled: 1 969 | serializedVersion: 3 970 | m_RenderMode: 0 971 | m_Camera: {fileID: 0} 972 | m_PlaneDistance: 100 973 | m_PixelPerfect: 0 974 | m_ReceivesEvents: 1 975 | m_OverrideSorting: 0 976 | m_OverridePixelPerfect: 0 977 | m_SortingBucketNormalizedSize: 0 978 | m_VertexColorAlwaysGammaSpace: 0 979 | m_AdditionalShaderChannelsFlag: 0 980 | m_UpdateRectTransformForStandalone: 0 981 | m_SortingLayerID: 0 982 | m_SortingOrder: 0 983 | m_TargetDisplay: 0 984 | --- !u!224 &1502237571 985 | RectTransform: 986 | m_ObjectHideFlags: 0 987 | m_CorrespondingSourceObject: {fileID: 0} 988 | m_PrefabInstance: {fileID: 0} 989 | m_PrefabAsset: {fileID: 0} 990 | m_GameObject: {fileID: 1502237567} 991 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 992 | m_LocalPosition: {x: 0, y: 0, z: 0} 993 | m_LocalScale: {x: 0, y: 0, z: 0} 994 | m_ConstrainProportionsScale: 0 995 | m_Children: 996 | - {fileID: 432530562} 997 | - {fileID: 1646839690} 998 | m_Father: {fileID: 0} 999 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 1000 | m_AnchorMin: {x: 0, y: 0} 1001 | m_AnchorMax: {x: 0, y: 0} 1002 | m_AnchoredPosition: {x: 0, y: 0} 1003 | m_SizeDelta: {x: 0, y: 0} 1004 | m_Pivot: {x: 0, y: 0} 1005 | --- !u!1 &1646839689 1006 | GameObject: 1007 | m_ObjectHideFlags: 0 1008 | m_CorrespondingSourceObject: {fileID: 0} 1009 | m_PrefabInstance: {fileID: 0} 1010 | m_PrefabAsset: {fileID: 0} 1011 | serializedVersion: 6 1012 | m_Component: 1013 | - component: {fileID: 1646839690} 1014 | m_Layer: 5 1015 | m_Name: LisenceText 1016 | m_TagString: Untagged 1017 | m_Icon: {fileID: 0} 1018 | m_NavMeshLayer: 0 1019 | m_StaticEditorFlags: 0 1020 | m_IsActive: 1 1021 | --- !u!224 &1646839690 1022 | RectTransform: 1023 | m_ObjectHideFlags: 0 1024 | m_CorrespondingSourceObject: {fileID: 0} 1025 | m_PrefabInstance: {fileID: 0} 1026 | m_PrefabAsset: {fileID: 0} 1027 | m_GameObject: {fileID: 1646839689} 1028 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 1029 | m_LocalPosition: {x: 0, y: 0, z: 0} 1030 | m_LocalScale: {x: 1, y: 1, z: 1} 1031 | m_ConstrainProportionsScale: 0 1032 | m_Children: 1033 | - {fileID: 38156657} 1034 | - {fileID: 155392643} 1035 | m_Father: {fileID: 1502237571} 1036 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 1037 | m_AnchorMin: {x: 0, y: 0} 1038 | m_AnchorMax: {x: 1, y: 1} 1039 | m_AnchoredPosition: {x: 0, y: -25} 1040 | m_SizeDelta: {x: -40, y: -90} 1041 | m_Pivot: {x: 0.5, y: 0.5} 1042 | --- !u!1 &1787239744 1043 | GameObject: 1044 | m_ObjectHideFlags: 0 1045 | m_CorrespondingSourceObject: {fileID: 0} 1046 | m_PrefabInstance: {fileID: 0} 1047 | m_PrefabAsset: {fileID: 0} 1048 | serializedVersion: 6 1049 | m_Component: 1050 | - component: {fileID: 1787239749} 1051 | - component: {fileID: 1787239748} 1052 | - component: {fileID: 1787239746} 1053 | - component: {fileID: 1787239745} 1054 | - component: {fileID: 1787239747} 1055 | m_Layer: 0 1056 | m_Name: Main Camera 1057 | m_TagString: MainCamera 1058 | m_Icon: {fileID: 0} 1059 | m_NavMeshLayer: 0 1060 | m_StaticEditorFlags: 0 1061 | m_IsActive: 1 1062 | --- !u!81 &1787239745 1063 | AudioListener: 1064 | m_ObjectHideFlags: 0 1065 | m_CorrespondingSourceObject: {fileID: 0} 1066 | m_PrefabInstance: {fileID: 0} 1067 | m_PrefabAsset: {fileID: 0} 1068 | m_GameObject: {fileID: 1787239744} 1069 | m_Enabled: 1 1070 | --- !u!124 &1787239746 1071 | Behaviour: 1072 | m_ObjectHideFlags: 0 1073 | m_CorrespondingSourceObject: {fileID: 0} 1074 | m_PrefabInstance: {fileID: 0} 1075 | m_PrefabAsset: {fileID: 0} 1076 | m_GameObject: {fileID: 1787239744} 1077 | m_Enabled: 1 1078 | --- !u!114 &1787239747 1079 | MonoBehaviour: 1080 | m_ObjectHideFlags: 0 1081 | m_CorrespondingSourceObject: {fileID: 0} 1082 | m_PrefabInstance: {fileID: 0} 1083 | m_PrefabAsset: {fileID: 0} 1084 | m_GameObject: {fileID: 1787239744} 1085 | m_Enabled: 1 1086 | m_EditorHideFlags: 0 1087 | m_Script: {fileID: 11500000, guid: d74622c03c0139244a807aa90a085ba4, type: 3} 1088 | m_Name: 1089 | m_EditorClassIdentifier: 1090 | --- !u!20 &1787239748 1091 | Camera: 1092 | m_ObjectHideFlags: 0 1093 | m_CorrespondingSourceObject: {fileID: 0} 1094 | m_PrefabInstance: {fileID: 0} 1095 | m_PrefabAsset: {fileID: 0} 1096 | m_GameObject: {fileID: 1787239744} 1097 | m_Enabled: 1 1098 | serializedVersion: 2 1099 | m_ClearFlags: 1 1100 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0.019607844} 1101 | m_projectionMatrixMode: 1 1102 | m_GateFitMode: 2 1103 | m_FOVAxisMode: 0 1104 | m_Iso: 200 1105 | m_ShutterSpeed: 0.005 1106 | m_Aperture: 16 1107 | m_FocusDistance: 10 1108 | m_FocalLength: 50 1109 | m_BladeCount: 5 1110 | m_Curvature: {x: 2, y: 11} 1111 | m_BarrelClipping: 0.25 1112 | m_Anamorphism: 0 1113 | m_SensorSize: {x: 36, y: 24} 1114 | m_LensShift: {x: 0, y: 0} 1115 | m_NormalizedViewPortRect: 1116 | serializedVersion: 2 1117 | x: 0 1118 | y: 0 1119 | width: 1 1120 | height: 1 1121 | near clip plane: 0.3 1122 | far clip plane: 1000 1123 | field of view: 60 1124 | orthographic: 0 1125 | orthographic size: 5 1126 | m_Depth: -1 1127 | m_CullingMask: 1128 | serializedVersion: 2 1129 | m_Bits: 4294967295 1130 | m_RenderingPath: -1 1131 | m_TargetTexture: {fileID: 0} 1132 | m_TargetDisplay: 0 1133 | m_TargetEye: 3 1134 | m_HDR: 0 1135 | m_AllowMSAA: 1 1136 | m_AllowDynamicResolution: 0 1137 | m_ForceIntoRT: 0 1138 | m_OcclusionCulling: 1 1139 | m_StereoConvergence: 10 1140 | m_StereoSeparation: 0.022 1141 | --- !u!4 &1787239749 1142 | Transform: 1143 | m_ObjectHideFlags: 0 1144 | m_CorrespondingSourceObject: {fileID: 0} 1145 | m_PrefabInstance: {fileID: 0} 1146 | m_PrefabAsset: {fileID: 0} 1147 | m_GameObject: {fileID: 1787239744} 1148 | serializedVersion: 2 1149 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 1150 | m_LocalPosition: {x: 0, y: 1, z: -10} 1151 | m_LocalScale: {x: 1, y: 1, z: 1} 1152 | m_ConstrainProportionsScale: 0 1153 | m_Children: [] 1154 | m_Father: {fileID: 0} 1155 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 1156 | --- !u!1660057539 &9223372036854775807 1157 | SceneRoots: 1158 | m_ObjectHideFlags: 0 1159 | m_Roots: 1160 | - {fileID: 1787239749} 1161 | - {fileID: 1502237571} 1162 | - {fileID: 316492818} 1163 | --------------------------------------------------------------------------------