An example of improving performance of video preview on mobile platform by replacing WebCamTexture of Unity standard API with NatCam.
Перейти к файлу
Enox Software 5f1e3dbae3
Update README.md
2020-03-28 07:31:18 +09:00
Assets v2.3.1 2019-12-30 19:01:39 +09:00
.gitignore v1.0.3 2019-01-12 20:36:49 +09:00
README.md Update README.md 2020-03-28 07:31:18 +09:00
benchmark.jpg Fixed README.md 2018-04-27 18:18:03 +09:00
screenshot01.jpg v1.0.4 2019-01-18 07:02:14 +09:00
screenshot02.jpg v0.0.1 2018-04-05 00:38:00 +09:00
screenshot03.jpg v1.0.0 2018-04-26 19:48:52 +09:00

README.md

NatCam has been deprecated.

An example using the new asset "NatDevice" has been published. https://github.com/EnoxSoftware/NatDeviceWithOpenCVForUnityExample


NatCam With OpenCVForUnity Example

  • An example of a benchmark test integrating NatCam and OpenCVForUnity. (Comparison between WebCamTexture and NatCam API)
  • An example of replacing WebCamTextureToMatHelper with NatCamPreviewToMatHelper.
  • An example of native sharing and save to the camera roll using NatShare API.

Environment

Demo

Setup

  1. Download the latest release unitypackage. NatCamWithOpenCVForUnityExample.unitypackage
  2. Create a new project. (NatCamWithOpenCVForUnityExample)
  3. Import NatCam.
  4. Import NatShare.
  5. Import OpenCVForUnity.
    • Setup the OpenCVForUnity. (Tools > OpenCV for Unity > Set Plugin Import Settings)
  6. Import the NatCamWithOpenCVForUnityExample.unitypackage.
  7. Change the "Minimum API Level" to 22 or higher in the "Player Settings (Androd)" Inspector.
  8. Change the "Target minimum iOS Version" to 11 or higher in the "Player Settings (iOS)" Inspector.
    • Set the reason for accessing the camera in "cameraUsageDescription".
  9. Add the "Assets/NatCamWithOpenCVForUnityExample/*.unity" files to the "Scenes In Build" list in the "Build Settings" window.
  10. Build and Deploy to Android and iOS.

iOS Instructions

After building an Xcode project from Unity, add the following keys to the Info.plist file with a good description:

  • NSPhotoLibraryUsageDescription
  • NSPhotoLibraryAddUsageDescription

ScreenShot

screenshot01.jpg screenshot02.jpg screenshot03.jpg