ARFoundationWithOpenCVForUnityExample
ARFoundationWithOpenCVForUnityExample copied to clipboard
An example of converting an ARFoundation camera image to OpenCV's Mat format.
ARFoundation With OpenCVForUnity Example
- An example of integrating ARFoundation with OpenCVForUnity.
- An example of replacing WebCamTextureToMatHelper with ARFoundationCameraToMatHelper.
- An example of ArUco marker detection from an ARFoundation camera image.
Environment
- Android (Pixel, Galaxy S10+) / iOS (iPhoneSE2)
- Unity >= 2020.3.38f1+
- Scripting backend MONO / IL2CPP
- [AR Foundation] 4.1.13+
- [ARCore XR Plugin] 4.1.13+
- [ARKit XR Plugin] 4.1.13+
- OpenCV for Unity 2.5.1+
Demo
Setup
- Download the latest release unitypackage. ARFoundationWithOpenCVForUnityExample.unitypackage
- Create a new project. (ARFoundationWithOpenCVForUnityExample)
- Install AR Foundation from Package Manager.
- Install ARCore XR Plugin from Package Manager.
- Install ARKit XR Plugin from Package Manager.
- Import OpenCVForUnity.
- Setup the OpenCVForUnity. (Tools > OpenCV for Unity > Set Plugin Import Settings)
- Import the ARFoundationWithOpenCVForUnityExample.unitypackage.
- Change the "Player Settings (Androd)" Inspector as follows.
- Graphics APIs : OpenGLES 3 (Remove "Vulkan" from the Graphics APIs list)
- Minimum API Level : Android 7.0 (API Level 24)
- Open the menu "Edit => Project Settings => XR Plug-in Management (Android)" and check "ARCore".
- Change the "Player Settings (iOS)" Inspector as follows.
- Camera Usage Description : "Required for augmented reality support."
- Target minimum iOS Version : 12.0
- Architecture : ARM64
- Open the menu "Edit => Project Settings => XR Plug-in Management (iOS)" and check "ARKit".
- Add the "Assets/ARFoundationWithOpenCVForUnityExample/*.unity" files to the "Scenes In Build" list in the "Build Settings" window.
- Build and Deploy to Android and iOS.
- (Print the AR marker "CanonicalMarker-d10-i1-sp500-bb1.pdf" on an A4 size paper)
ScreenShot
